Skip to content

Commit

Permalink
Merge pull request #177 from snyk/test/npm-version-parsing
Browse files Browse the repository at this point in the history
fix: npm version parse test & enable logging
  • Loading branch information
lili2311 authored Feb 21, 2023
2 parents f93a583 + 7b99625 commit e321926
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 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
12 changes: 12 additions & 0 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.

4 changes: 4 additions & 0 deletions test/fixtures/bare-npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "bare-npm",
"version": "1.0.0"
}
3 changes: 3 additions & 0 deletions test/jest/__snapshots__/get-lockfile-version.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`getLockfileVersionFromFile npm 1`] = `"NPM_LOCK_V2"`;
10 changes: 10 additions & 0 deletions test/jest/get-lockfile-version.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getLockfileVersionFromFile } from '../../lib/utils';

describe('getLockfileVersionFromFile', () => {
it('npm', () => {
const result = getLockfileVersionFromFile(
`${__dirname}/../fixtures/bare-npm/package-lock.json`,
);
expect(result).toMatchSnapshot();
});
});

0 comments on commit e321926

Please sign in to comment.