mirror of
https://github.com/actions/setup-node.git
synced 2026-03-07 06:51:46 +08:00
Compare commits
2 Commits
9feef93469
...
4ee018ab44
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ee018ab44 | ||
|
|
b431a178ef |
2
.github/eslint-stylish.json
vendored
2
.github/eslint-stylish.json
vendored
@ -4,7 +4,7 @@
|
||||
"owner": "eslint-stylish",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\s*([^\\s].*)$",
|
||||
"regexp": "^([^\\s].*)$",
|
||||
"file": 1
|
||||
},
|
||||
{
|
||||
|
||||
@ -282,43 +282,6 @@ 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';
|
||||
|
||||
8
dist/setup/index.js
vendored
8
dist/setup/index.js
vendored
@ -97519,7 +97519,7 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||
}
|
||||
setupNodeJs() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
var _a;
|
||||
let manifest;
|
||||
let nodeJsVersions;
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
@ -97564,7 +97564,7 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.info(`Not found in manifest. Falling back to download directly from ${(_a = this.nodeInfo.mirror) !== null && _a !== void 0 ? _a : 'Node'}`);
|
||||
core.info('Not found in manifest. Falling back to download directly from Node');
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
@ -97576,8 +97576,8 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||
else {
|
||||
core.info(err.message);
|
||||
}
|
||||
core.debug((_b = err.stack) !== null && _b !== void 0 ? _b : 'empty stack');
|
||||
core.info(`Falling back to download directly from ${(_c = this.nodeInfo.mirror) !== null && _c !== void 0 ? _c : 'Node'}`);
|
||||
core.debug((_a = err.stack) !== null && _a !== void 0 ? _a : 'empty stack');
|
||||
core.info('Falling back to download directly from Node');
|
||||
}
|
||||
if (!toolPath) {
|
||||
toolPath = yield this.downloadDirectlyFromNode();
|
||||
|
||||
@ -96,9 +96,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||
}
|
||||
} else {
|
||||
core.info(
|
||||
`Not found in manifest. Falling back to download directly from ${
|
||||
this.nodeInfo.mirror ?? 'Node'
|
||||
}`
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
@ -114,11 +112,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||
core.info((err as Error).message);
|
||||
}
|
||||
core.debug((err as Error).stack ?? 'empty stack');
|
||||
core.info(
|
||||
`Falling back to download directly from ${
|
||||
this.nodeInfo.mirror ?? 'Node'
|
||||
}`
|
||||
);
|
||||
core.info('Falling back to download directly from Node');
|
||||
}
|
||||
|
||||
if (!toolPath) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user