mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 12:13:35 +00:00 
			
		
		
		
	Run pre-checkin script
This commit is contained in:
		
							parent
							
								
									d08b81849e
								
							
						
					
					
						commit
						c78a7a14b3
					
				@ -286,7 +286,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
    const workingUrls = [
 | 
					    const workingUrls = [
 | 
				
			||||||
      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
 | 
					      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
 | 
				
			||||||
      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
 | 
					      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
 | 
				
			||||||
    ]
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    inputs['node-version'] = versionSpec;
 | 
					    inputs['node-version'] = versionSpec;
 | 
				
			||||||
    inputs['always-auth'] = false;
 | 
					    inputs['always-auth'] = false;
 | 
				
			||||||
@ -296,25 +296,25 @@ describe('setup-node', () => {
 | 
				
			|||||||
    findSpy.mockImplementation(() => '');
 | 
					    findSpy.mockImplementation(() => '');
 | 
				
			||||||
    findAllVersionsSpy.mockImplementation(() => []);
 | 
					    findAllVersionsSpy.mockImplementation(() => []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dlSpy.mockImplementation(async (url) => {
 | 
					    dlSpy.mockImplementation(async url => {
 | 
				
			||||||
      if (workingUrls.includes(url)) {
 | 
					      if (workingUrls.includes(url)) {
 | 
				
			||||||
        return '/some/temp/path'
 | 
					        return '/some/temp/path';
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      throw new tc.HTTPError(404)
 | 
					      throw new tc.HTTPError(404);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    const toolPath = path.normalize(
 | 
					    const toolPath = path.normalize(
 | 
				
			||||||
      '/cache/node/13.13.1-nightly20200415947ddec091/x64'
 | 
					      '/cache/node/13.13.1-nightly20200415947ddec091/x64'
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    cacheSpy.mockImplementation(async () => toolPath);
 | 
					    cacheSpy.mockImplementation(async () => toolPath);
 | 
				
			||||||
    mkdirpSpy.mockImplementation(async () => {})
 | 
					    mkdirpSpy.mockImplementation(async () => {});
 | 
				
			||||||
    cpSpy.mockImplementation(async () => {})
 | 
					    cpSpy.mockImplementation(async () => {});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await main.run();
 | 
					    await main.run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    workingUrls.forEach(url => {
 | 
					    workingUrls.forEach(url => {
 | 
				
			||||||
      expect(dlSpy).toHaveBeenCalledWith(url);
 | 
					      expect(dlSpy).toHaveBeenCalledWith(url);
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
    expect(cnSpy).toHaveBeenCalledWith(`::add-path::${toolPath}${osm.EOL}`);
 | 
					    expect(cnSpy).toHaveBeenCalledWith(`::add-path::${toolPath}${osm.EOL}`);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -328,7 +328,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
    const workingUrls = [
 | 
					    const workingUrls = [
 | 
				
			||||||
      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
 | 
					      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
 | 
				
			||||||
      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
 | 
					      `https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
 | 
				
			||||||
    ]
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    inputs['node-version'] = versionSpec;
 | 
					    inputs['node-version'] = versionSpec;
 | 
				
			||||||
    inputs['always-auth'] = false;
 | 
					    inputs['always-auth'] = false;
 | 
				
			||||||
@ -338,26 +338,28 @@ describe('setup-node', () => {
 | 
				
			|||||||
    findSpy.mockImplementation(() => '');
 | 
					    findSpy.mockImplementation(() => '');
 | 
				
			||||||
    findAllVersionsSpy.mockImplementation(() => []);
 | 
					    findAllVersionsSpy.mockImplementation(() => []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dlSpy.mockImplementation(async (url) => {
 | 
					    dlSpy.mockImplementation(async url => {
 | 
				
			||||||
      if (workingUrls.includes(url)) {
 | 
					      if (workingUrls.includes(url)) {
 | 
				
			||||||
        return '/some/temp/path'
 | 
					        return '/some/temp/path';
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      throw new tc.HTTPError(404)
 | 
					      throw new tc.HTTPError(404);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    const toolPath = path.normalize(
 | 
					    const toolPath = path.normalize(
 | 
				
			||||||
      '/cache/node/13.13.1-nightly20200415947ddec091/x64'
 | 
					      '/cache/node/13.13.1-nightly20200415947ddec091/x64'
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    cacheSpy.mockImplementation(async () => toolPath);
 | 
					    cacheSpy.mockImplementation(async () => toolPath);
 | 
				
			||||||
    mkdirpSpy.mockImplementation(async () => {})
 | 
					    mkdirpSpy.mockImplementation(async () => {});
 | 
				
			||||||
    cpSpy.mockImplementation(async () => {})
 | 
					    cpSpy.mockImplementation(async () => {});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await main.run();
 | 
					    await main.run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    workingUrls.forEach(url => {
 | 
					    workingUrls.forEach(url => {
 | 
				
			||||||
      expect(dlSpy).not.toHaveBeenCalledWith(url);
 | 
					      expect(dlSpy).not.toHaveBeenCalledWith(url);
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
    expect(cnSpy).toHaveBeenCalledWith(`::error::Unexpected HTTP response: 404${osm.EOL}`);
 | 
					    expect(cnSpy).toHaveBeenCalledWith(
 | 
				
			||||||
 | 
					      `::error::Unexpected HTTP response: 404${osm.EOL}`
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('does not find a version that does not exist', async () => {
 | 
					  it('does not find a version that does not exist', async () => {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@ -73441,8 +73441,8 @@ class BaseDistribution {
 | 
				
			|||||||
                downloadPath = yield tc.downloadTool(info.downloadUrl);
 | 
					                downloadPath = yield tc.downloadTool(info.downloadUrl);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (err) {
 | 
					            catch (err) {
 | 
				
			||||||
                if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
 | 
					                if (err instanceof tc.HTTPError && err.httpStatusCode == 404 && this.osPlat == 'win32') {
 | 
				
			||||||
                    return yield this.acquireNodeFromFallbackLocation(info.resolvedVersion, info.arch);
 | 
					                    return yield this.acquireWindowsNodeFromFallbackLocation(info.resolvedVersion, info.arch);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                throw err;
 | 
					                throw err;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -73458,7 +73458,7 @@ class BaseDistribution {
 | 
				
			|||||||
        const valid = (_a = semver_1.default.valid(c)) !== null && _a !== void 0 ? _a : versionSpec;
 | 
					        const valid = (_a = semver_1.default.valid(c)) !== null && _a !== void 0 ? _a : versionSpec;
 | 
				
			||||||
        return { range: valid, options };
 | 
					        return { range: valid, options };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    acquireNodeFromFallbackLocation(version, arch = os_1.default.arch()) {
 | 
					    acquireWindowsNodeFromFallbackLocation(version, arch = os_1.default.arch()) {
 | 
				
			||||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
					        return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
            const initialUrl = this.getDistributionUrl();
 | 
					            const initialUrl = this.getDistributionUrl();
 | 
				
			||||||
            const osArch = this.translateArchToDistUrl(arch);
 | 
					            const osArch = this.translateArchToDistUrl(arch);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user