Skip to content

Commit

Permalink
Add notice about binaries not being updated yet
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolai-laevskii committed Oct 19, 2023
1 parent 2a017f3 commit 7d66b4b
Show file tree
Hide file tree
Showing 3 changed files with 834 additions and 199 deletions.
35 changes: 35 additions & 0 deletions __tests__/official-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,41 @@ describe('setup-node', () => {
expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`);
});

it('reports when download failed but version exists', 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';

inputs['node-version'] = versionSpec;
inputs['always-auth'] = false;
inputs['token'] = 'faketoken';

// ... but not in the local cache
findSpy.mockImplementation(() => '');

dlSpy.mockImplementationOnce(async () => {
throw new tc.HTTPError(404);
});

await main.run();

expect(getManifestSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith(
`Attempting to download ${versionSpec}...`
);
expect(logSpy).toHaveBeenCalledWith(
'Not found in manifest. Falling back to download directly from Node'
);
expect(dlSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith(
`Node version ${versionSpec} for platform ${os.platform} and architecture ${os.arch} was found but failed to download. ` +
'This usually happens when downloadable binaries are not fully updated at https://nodejs.org/. ' +
'To resolve this issue you may either fall back to the older version or try again later.'
);
});

it('acquires specified architecture of node', async () => {
for (const {arch, version, osSpec} of [
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
Expand Down
Loading

0 comments on commit 7d66b4b

Please sign in to comment.