Socket
Socket
Sign inDemoInstall

check-packages

Package Overview
Dependencies
135
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc