From bb904c4ef99417de0fbaf5c4cf02d40fc7207c91 Mon Sep 17 00:00:00 2001 From: zkochan Date: Sun, 9 Jul 2017 13:51:47 +0300 Subject: [PATCH] test: prune ignores dependencies that are in package.json only --- test/prune.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/test/prune.ts b/test/prune.ts index c702537c8c..09faa3c682 100644 --- a/test/prune.ts +++ b/test/prune.ts @@ -445,3 +445,48 @@ test('remove dependencies that are not in the package', t => { t.end() }) + +test('ignore dependencies that are in package.json but are not in shrinkwrap.yaml', t => { + t.deepEqual(prune({ + shrinkwrapVersion: 3, + registry: 'https://registry.npmjs.org', + dependencies: { + 'is-positive': '1.0.0' + }, + specifiers: { + 'is-positive': '^1.0.0' + }, + packages: { + '/is-positive/1.0.0': { + resolution: { + integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=' + } + }, + } + }, { + name: 'foo', + version: '1.0.0', + dependencies: { + 'is-positive': '^1.0.0', + 'is-negative': '^1.0.0', + } + }), { + shrinkwrapVersion: 3, + registry: 'https://registry.npmjs.org', + dependencies: { + 'is-positive': '1.0.0' + }, + specifiers: { + 'is-positive': '^1.0.0' + }, + packages: { + '/is-positive/1.0.0': { + resolution: { + integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=' + } + } + } + }) + + t.end() +})