diff --git a/packages/cli/src/utils.ts b/packages/cli/src/utils.ts index c991ba0bf..cd6e8752b 100644 --- a/packages/cli/src/utils.ts +++ b/packages/cli/src/utils.ts @@ -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}`); } diff --git a/packages/cli/test/utils.spec.ts b/packages/cli/test/utils.spec.ts index e7c027bd4..fdd3d258f 100644 --- a/packages/cli/test/utils.spec.ts +++ b/packages/cli/test/utils.spec.ts @@ -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(); });