mirror of
https://github.com/actions/setup-node.git
synced 2025-04-24 12:22:12 +00:00
Run pre-checkin script
This commit is contained in:
parent
d08b81849e
commit
c78a7a14b3
3 changed files with 1338 additions and 1336 deletions
|
@ -286,7 +286,7 @@ describe('setup-node', () => {
|
|||
const workingUrls = [
|
||||
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
|
||||
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
|
||||
]
|
||||
];
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['always-auth'] = false;
|
||||
|
@ -296,25 +296,25 @@ describe('setup-node', () => {
|
|||
findSpy.mockImplementation(() => '');
|
||||
findAllVersionsSpy.mockImplementation(() => []);
|
||||
|
||||
dlSpy.mockImplementation(async (url) => {
|
||||
dlSpy.mockImplementation(async 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(
|
||||
'/cache/node/13.13.1-nightly20200415947ddec091/x64'
|
||||
);
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
mkdirpSpy.mockImplementation(async () => {})
|
||||
cpSpy.mockImplementation(async () => {})
|
||||
mkdirpSpy.mockImplementation(async () => {});
|
||||
cpSpy.mockImplementation(async () => {});
|
||||
|
||||
await main.run();
|
||||
|
||||
workingUrls.forEach(url => {
|
||||
expect(dlSpy).toHaveBeenCalledWith(url);
|
||||
})
|
||||
});
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${toolPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
|
@ -328,7 +328,7 @@ describe('setup-node', () => {
|
|||
const workingUrls = [
|
||||
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
|
||||
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
|
||||
]
|
||||
];
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['always-auth'] = false;
|
||||
|
@ -338,26 +338,28 @@ describe('setup-node', () => {
|
|||
findSpy.mockImplementation(() => '');
|
||||
findAllVersionsSpy.mockImplementation(() => []);
|
||||
|
||||
dlSpy.mockImplementation(async (url) => {
|
||||
dlSpy.mockImplementation(async 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(
|
||||
'/cache/node/13.13.1-nightly20200415947ddec091/x64'
|
||||
);
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
mkdirpSpy.mockImplementation(async () => {})
|
||||
cpSpy.mockImplementation(async () => {})
|
||||
mkdirpSpy.mockImplementation(async () => {});
|
||||
cpSpy.mockImplementation(async () => {});
|
||||
|
||||
await main.run();
|
||||
|
||||
workingUrls.forEach(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 () => {
|
||||
|
|
6
dist/setup/index.js
vendored
6
dist/setup/index.js
vendored
|
@ -73441,8 +73441,8 @@ class BaseDistribution {
|
|||
downloadPath = yield tc.downloadTool(info.downloadUrl);
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
||||
return yield this.acquireNodeFromFallbackLocation(info.resolvedVersion, info.arch);
|
||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404 && this.osPlat == 'win32') {
|
||||
return yield this.acquireWindowsNodeFromFallbackLocation(info.resolvedVersion, info.arch);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
@ -73458,7 +73458,7 @@ class BaseDistribution {
|
|||
const valid = (_a = semver_1.default.valid(c)) !== null && _a !== void 0 ? _a : versionSpec;
|
||||
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* () {
|
||||
const initialUrl = this.getDistributionUrl();
|
||||
const osArch = this.translateArchToDistUrl(arch);
|
||||
|
|
Loading…
Add table
Reference in a new issue