Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand current syntax to support aliases for latest version (current/latest/node) #483

Merged
merged 23 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
amend unit tests
  • Loading branch information
panticmilos committed May 9, 2022
commit bd4ffc78c2d6b727970d523b7eb69069206ce463
17 changes: 1 addition & 16 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,10 +920,6 @@ describe('setup-node', () => {
os.platform = 'darwin';
os.arch = 'x64';

const expectedVersion = nodeTestDist[0];

let expectedUrl = `https://nodejs.org/dist/${expectedVersion.version}/node-${expectedVersion.version}-${os.platform}-${os.arch}.tar.gz`;

findSpy.mockImplementation(() => '');
getManifestSpy.mockImplementation(() => {
throw new Error('Unable to download manifest');
Expand All @@ -932,21 +928,10 @@ describe('setup-node', () => {
// Act
await main.run();

// Assert
expect(logSpy).toHaveBeenCalledWith(
`Attempting to download ${inputVersion}...`
);

// assert
expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');

expect(logSpy).toHaveBeenCalledWith('getting latest node version...');

expect(logSpy).toHaveBeenCalledWith(
`Acquiring ${expectedVersion.version.substring(
1,
expectedVersion.version.length
)} - ${os.arch} from ${expectedUrl}`
);
}
);
});
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"semver": "^6.1.1"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/jest": "^27.5.0",
"@types/node": "^16.11.25",
"@types/semver": "^6.0.0",
"@zeit/ncc": "^0.21.0",
Expand Down
3 changes: 1 addition & 2 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as tc from '@actions/tool-cache';
import * as path from 'path';
import * as semver from 'semver';
import fs = require('fs');
import * as installer from './installer';

//
// Node versions interface
Expand Down Expand Up @@ -372,7 +371,7 @@ async function queryDistForMatch(
}

let versions: string[] = [];
let nodeVersions = await installer.getVersionsFromDist();
let nodeVersions = await getVersionsFromDist();

if (
versionSpec === 'current' ||
Expand Down