Stricter check and cleaner messaging
This commit is contained in:
parent
8624ddbdce
commit
48042628a6
@ -696,7 +696,7 @@ describe('setup-node', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fail with unexpected LTS alias (lts/)', async () => {
|
it('fail with unable to parse LTS alias (lts/)', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
inputs['node-version'] = 'lts/';
|
inputs['node-version'] = 'lts/';
|
||||||
|
|
||||||
@ -713,7 +713,7 @@ describe('setup-node', () => {
|
|||||||
'Getting manifest from actions/node-versions@main'
|
'Getting manifest from actions/node-versions@main'
|
||||||
);
|
);
|
||||||
expect(cnSpy).toHaveBeenCalledWith(
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
`::error::Unexpected LTS alias '' for Node version 'lts/'${osm.EOL}`
|
`::error::Unable to parse LTS alias for Node version 'lts/'${osm.EOL}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -13225,7 +13225,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
|
|||||||
}
|
}
|
||||||
exports.getNode = getNode;
|
exports.getNode = getNode;
|
||||||
function isLtsAlias(versionSpec) {
|
function isLtsAlias(versionSpec) {
|
||||||
return versionSpec.startsWith('lts');
|
return versionSpec.startsWith('lts/');
|
||||||
}
|
}
|
||||||
function getManifest(auth) {
|
function getManifest(auth) {
|
||||||
core.debug('Getting manifest from actions/node-versions@main');
|
core.debug('Getting manifest from actions/node-versions@main');
|
||||||
@ -13235,7 +13235,7 @@ function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
|
|||||||
var _a;
|
var _a;
|
||||||
const alias = (_a = versionSpec.split('lts/')[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
const alias = (_a = versionSpec.split('lts/')[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||||
if (!alias) {
|
if (!alias) {
|
||||||
throw new Error(`Unexpected LTS alias '${alias}' for Node version '${versionSpec}'`);
|
throw new Error(`Unable to parse LTS alias for Node version '${versionSpec}'`);
|
||||||
}
|
}
|
||||||
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
|
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
|
||||||
// Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
|
// Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
|
||||||
|
@ -193,7 +193,7 @@ export async function getNode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isLtsAlias(versionSpec: string): boolean {
|
function isLtsAlias(versionSpec: string): boolean {
|
||||||
return versionSpec.startsWith('lts');
|
return versionSpec.startsWith('lts/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getManifest(auth: string | undefined): Promise<tc.IToolRelease[]> {
|
function getManifest(auth: string | undefined): Promise<tc.IToolRelease[]> {
|
||||||
@ -210,7 +210,7 @@ function resolveLtsAliasFromManifest(
|
|||||||
|
|
||||||
if (!alias) {
|
if (!alias) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unexpected LTS alias '${alias}' for Node version '${versionSpec}'`
|
`Unable to parse LTS alias for Node version '${versionSpec}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user