Skip to content

Commit 2a6d010

Browse files
committed
test: update case
1 parent 6e921e1 commit 2a6d010

File tree

3 files changed

+27
-647
lines changed

3 files changed

+27
-647
lines changed

workspaces/arborist/test/arborist/pruner.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,19 @@ t.test('prune with lockfile', async t => {
4040
})
4141

4242
t.test('prune with lockfile with implicit optional peer dependencies', async t => {
43-
const opts = {}
44-
45-
// todo: for some reason on Windows when doing this test NPM looks for
46-
// the cache in the home directory, resulting in an unexpected real
47-
// call being made to the registry
48-
if (process.platform === 'win32') {
49-
opts.cache = 'C:\\npm\\cache\\_cacache'
50-
}
51-
5243
const path = fixture(t, 'prune-lockfile-optional-peer')
53-
const tree = await pruneTree(path, opts)
44+
const tree = await pruneTree(path, { audit: false })
5445

5546
const dep = tree.children.get('dedent')
56-
t.ok(dep, 'required prod dep was pruned from tree')
47+
t.ok(dep, 'required prod dep was not pruned from tree')
5748

5849
const optionalPeerDep = tree.children.get('babel-plugin-macros')
59-
t.notOk(optionalPeerDep, 'all listed optional peer deps pruned from tree')
50+
t.notOk(optionalPeerDep, 'optional peer dep was pruned from tree')
6051

61-
t.matchSnapshot(
62-
require(path + '/package-lock.json'),
63-
'should remove optional peer dependencies in package-lock.json'
64-
)
65-
t.matchSnapshot(
66-
printTree(tree),
67-
'should remove all deps from reified tree'
52+
t.notMatch(
53+
fs.readFileSync(path + '/package-lock.json'),
54+
'node_modules/babel-plugin-macros',
55+
'should remove optional peer dep from package-lock.json'
6856
)
6957
})
7058

workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package-lock.json

Lines changed: 2 additions & 314 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)