mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
chore: improve version detection (#2558)
This commit is contained in:
parent
f345fefd99
commit
5776015058
2 changed files with 12 additions and 4 deletions
|
@ -1,7 +1,8 @@
|
|||
import semver from 'semver';
|
||||
|
||||
export const MIN_NODE_VERSION = '14';
|
||||
export const MIN_NODE_VERSION = '14.0.0';
|
||||
|
||||
export function isVersionValid(version) {
|
||||
export function isVersionValid(processVersion) {
|
||||
const version = processVersion.substr(1);
|
||||
return semver.satisfies(version, `>=${MIN_NODE_VERSION}`);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
import { isVersionValid } from '../src/utils';
|
||||
|
||||
test('valid version node.js', () => {
|
||||
expect(isVersionValid('14.0.0')).toBeTruthy();
|
||||
expect(isVersionValid('v14.0.0')).toBeTruthy();
|
||||
expect(isVersionValid('v15.0.0')).toBeTruthy();
|
||||
expect(isVersionValid('v16.0.0')).toBeTruthy();
|
||||
expect(isVersionValid('v17.0.0')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('is invalid version node.js', () => {
|
||||
expect(isVersionValid('13.0.0')).toBeFalsy();
|
||||
expect(isVersionValid('v13.0.0')).toBeFalsy();
|
||||
expect(isVersionValid('v12.0.0')).toBeFalsy();
|
||||
expect(isVersionValid('v8.0.0')).toBeFalsy();
|
||||
expect(isVersionValid('v4.0.0')).toBeFalsy();
|
||||
expect(isVersionValid('v0.0.10')).toBeFalsy();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue