You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

check-packages

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-packages - npm Package Compare versions

Comparing version

to
1.0.0

6

lib/read-dependencies.js

@@ -10,5 +10,9 @@ 'use strict';

const result = childProcess.spawnSync('npm', args);
const result = childProcess.spawnSync('npm', args, { shell: true });
const tree = JSON.parse(result.stdout);
if (!tree) {
throw new Error('Failed to read dependencies');
}
// mark root level -> we want to exclude this level from analysis

@@ -15,0 +19,0 @@ tree.isRoot = true;

12

lib/read-dependencies.test.js

@@ -44,3 +44,3 @@ 'use strict';

expect(childProcess.spawnSync).toHaveBeenCalledWith('npm', [ 'ls', '--json' ]);
expect(childProcess.spawnSync).toHaveBeenCalledWith('npm', [ 'ls', '--json' ], { shell: true });
});

@@ -63,3 +63,3 @@

expect(childProcess.spawnSync).toHaveBeenCalledWith('npm', [ 'ls', '--json', '--production' ]);
expect(childProcess.spawnSync).toHaveBeenCalledWith('npm', [ 'ls', '--json', '--production' ], { shell: true });
});

@@ -82,3 +82,3 @@

expect(childProcess.spawnSync).toHaveBeenCalledWith('npm', [ 'ls', '--json', '--development' ]);
expect(childProcess.spawnSync).toHaveBeenCalledWith('npm', [ 'ls', '--json', '--development' ], { shell: true });
});

@@ -97,2 +97,8 @@

it('throws when parsed tree is null', () => {
childProcess.spawnSync.mockImplementation(() => ({ stdout: null }));
expect(readDependencies).toThrow('Failed to read dependencies');
});
it('returns problems found by npm ls', () => {

@@ -99,0 +105,0 @@ childProcess.spawnSync.mockImplementation(() => ({ stdout: stringifiedTree, stderr: 'missing peer dependencies' }));

{
"name": "check-packages",
"version": "0.1.3",
"version": "1.0.0",
"description": "CLI tool to check your npm dependencies against a list of allowed/forbidden packages.",

@@ -5,0 +5,0 @@ "license": "MIT",