mirror of
https://github.com/actions/setup-node
synced 2025-04-10 02:45:50 +00:00
chore: change fallback message with mirrors
This commit is contained in:
parent
8f2ef77ada
commit
4731556a4c
3 changed files with 41 additions and 2 deletions
__tests__
dist/setup
src/distributions/official_builds
|
@ -282,6 +282,43 @@ describe('setup-node', () => {
|
|||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
it('falls back to a version from node dist from mirror', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
// a version which is not in the manifest but is in node dist
|
||||
const versionSpec = '11.15.0';
|
||||
const mirror = 'https://my_mirror_url';
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['always-auth'] = false;
|
||||
inputs['token'] = 'faketoken';
|
||||
inputs['mirror'] = mirror;
|
||||
inputs['mirror-token'] = 'faketoken';
|
||||
|
||||
// ... but not in the local cache
|
||||
findSpy.mockImplementation(() => '');
|
||||
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
const toolPath = path.normalize('/cache/node/11.15.0/x64');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
|
||||
await main.run();
|
||||
|
||||
const expPath = path.join(toolPath, 'bin');
|
||||
|
||||
expect(getManifestSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Not found in manifest. Falling back to download directly from ${mirror}`
|
||||
);
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
it('falls back to a version from node dist', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
|
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
|
@ -97564,7 +97564,7 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
}
|
||||
}
|
||||
else {
|
||||
core.info('Not found in manifest. Falling back to download directly from Node');
|
||||
core.info(`Not found in manifest. Falling back to download directly from ${this.nodeInfo.mirror || 'Node'}`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
|
|
|
@ -96,7 +96,9 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||
}
|
||||
} else {
|
||||
core.info(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
`Not found in manifest. Falling back to download directly from ${
|
||||
this.nodeInfo.mirror || 'Node'
|
||||
}`
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Reference in a new issue