Skip to content

Commit

Permalink
Merge pull request #853 from snyk/feat/node-6-deprecation-warning
Browse files Browse the repository at this point in the history
Feat/node 6 deprecation warning
  • Loading branch information
dkontorovskyy committed Nov 5, 2019
2 parents ad89f10 + 12eab1a commit 779f0ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ async function main() {
exitCode = response.exitCode;
}

if (runtime.isUsingNode6(process.versions.node)) {
alerts.registerAlerts([
{
msg:
'Node.js v6 has past End-of-Life; please upgrade your current Node.js version ' +
'to continue scanning and protecting your projects from security vulnerabilities.',
name: 'Node6EOLWarning',
type: 'info',
},
]);
}

if (!args.options.json) {
console.log(alerts.displayAlerts());
}
Expand Down
6 changes: 5 additions & 1 deletion src/cli/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gte } from 'semver';
import { gte, satisfies } from 'semver';

const MIN_RUNTIME = '6.5.0';

Expand All @@ -7,3 +7,7 @@ export const supportedRange = `>= ${MIN_RUNTIME}`;
export function isSupported(runtimeVersion) {
return gte(runtimeVersion, MIN_RUNTIME);
}

export function isUsingNode6(runtimeVersion) {
return satisfies(runtimeVersion, '6.x');
}
6 changes: 3 additions & 3 deletions test/acceptance/cli-args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('snyk test command should fail when --file is not specified correctly', (t)
if (err) {
throw err;
}
t.equal(
t.match(
stdout.trim(),
'Empty --file argument. Did you mean --file=path/to/file ?',
'correct error output',
Expand Down Expand Up @@ -44,7 +44,7 @@ test('`test multiple paths with --project-name=NAME`', (t) => {
if (err) {
throw err;
}
t.equals(
t.match(
stdout.trim(),
'The following option combination is not currently supported: ["multiple paths","project-name"]',
'correct error output',
Expand All @@ -62,7 +62,7 @@ test('`test --file=file.sln --project-name=NAME`', (t) => {
if (err) {
throw err;
}
t.equals(
t.match(
stdout.trim(),
'The following option combination is not currently supported: ["file=*.sln","project-name"]',
'correct error output',
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/protect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('`protect` should not fail for unauthorized users', (t) => {
if (err) {
throw err;
}
t.equal(
t.match(
stdout.trim(),
'Successfully applied Snyk patches',
'correct output for unauthenticated user',
Expand Down

0 comments on commit 779f0ef

Please sign in to comment.