Skip to content

Commit

Permalink
chore: enable Node 12 tests since CLI still supports it
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 authored and JamesPatrickGill committed Feb 21, 2023
1 parent 19c2f71 commit 7b99625
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,26 @@ workflows:
branches:
ignore:
- master
- test-windows:
name: Windows Tests for Node v12 support
context: nodejs-install
node_version: "12.22.12"
requires:
- Lint
filters:
branches:
ignore:
- master
- test-unix:
name: Unix Tests for Node v12 support
context: nodejs-install
node_version: "12.22.12"
requires:
- Lint
filters:
branches:
ignore:
- master
- release:
name: Release
context: nodejs-app-release
Expand Down
5 changes: 0 additions & 5 deletions lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { readFileSync } from 'fs';
import { InvalidUserInputError } from './errors';
import * as baseDebug from 'debug';

const debug = baseDebug('snyk-nodejs-parser');

export enum NodeLockfileVersion {
NpmLockV1 = 'NPM_LOCK_V1',
Expand Down Expand Up @@ -46,7 +43,6 @@ export function getNpmLockfileVersion(
| NodeLockfileVersion.NpmLockV3 {
try {
const lockfileJson = JSON.parse(lockFileContents);

const lockfileVersion: number | null = lockfileJson.lockfileVersion || null;

switch (lockfileVersion) {
Expand All @@ -64,7 +60,6 @@ export function getNpmLockfileVersion(
);
}
} catch (e) {
debug('Failed to parse lockfile version: ', e);
throw new InvalidUserInputError(
`Problem parsing package-lock.json - make sure the package-lock.json is a valid JSON file`,
);
Expand Down
13 changes: 10 additions & 3 deletions test/fixtures/bare-npm/package-lock.json

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

13 changes: 2 additions & 11 deletions test/fixtures/bare-npm/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
{
"name": "Example",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "Example",
"version": "1.0.0"
}
}
"name": "bare-npm",
"version": "1.0.0"
}

2 changes: 1 addition & 1 deletion test/jest/__snapshots__/get-lockfile-version.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`getLockfileVersionFromFile npm 1`] = `"NPM_LOCK_V1"`;
exports[`getLockfileVersionFromFile npm 1`] = `"NPM_LOCK_V2"`;

0 comments on commit 7b99625

Please sign in to comment.