check-packages
Advanced tools
Comparing version 0.1.3 to 1.0.0
@@ -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; |
@@ -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", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
38441
995
0