Skip to content

Commit b8e5662

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

File tree

5 files changed

+39
-723
lines changed

5 files changed

+39
-723
lines changed

workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -124,82 +124,6 @@ ArboristNode {
124124
}
125125
`
126126

127-
exports[`test/arborist/pruner.js TAP prune with lockfile with implicit optional peer dependencies > should remove all deps from reified tree 1`] = `
128-
ArboristNode {
129-
"children": Map {
130-
"dedent" => ArboristNode {
131-
"edgesIn": Set {
132-
EdgeIn {
133-
"from": "",
134-
"name": "dedent",
135-
"spec": "^1.6.0",
136-
"type": "prod",
137-
},
138-
},
139-
"edgesOut": Map {
140-
"babel-plugin-macros" => EdgeOut {
141-
"name": "babel-plugin-macros",
142-
"spec": "^3.1.0",
143-
"to": null,
144-
"type": "peerOptional",
145-
},
146-
},
147-
"location": "node_modules/dedent",
148-
"name": "dedent",
149-
"path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/dedent",
150-
"resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz",
151-
"version": "1.6.0",
152-
},
153-
},
154-
"edgesOut": Map {
155-
"dedent" => EdgeOut {
156-
"name": "dedent",
157-
"spec": "^1.6.0",
158-
"to": "node_modules/dedent",
159-
"type": "prod",
160-
},
161-
},
162-
"isProjectRoot": true,
163-
"location": "",
164-
"name": "tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies",
165-
"packageName": "prune-lockfile-optional-peer",
166-
"path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies",
167-
"version": "1.0.0",
168-
}
169-
`
170-
171-
exports[`test/arborist/pruner.js TAP prune with lockfile with implicit optional peer dependencies > should remove optional peer dependencies in package-lock.json 1`] = `
172-
Object {
173-
"lockfileVersion": 3,
174-
"name": "prune-lockfile-optional-peer",
175-
"packages": Object {
176-
"": Object {
177-
"dependencies": Object {
178-
"dedent": "^1.6.0",
179-
},
180-
"name": "prune-lockfile-optional-peer",
181-
"version": "1.0.0",
182-
},
183-
"node_modules/dedent": Object {
184-
"integrity": "sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA==",
185-
"license": "MIT",
186-
"peerDependencies": Object {
187-
"babel-plugin-macros": "^3.1.0",
188-
},
189-
"peerDependenciesMeta": Object {
190-
"babel-plugin-macros": Object {
191-
"optional": true,
192-
},
193-
},
194-
"resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz",
195-
"version": "1.6.0",
196-
},
197-
},
198-
"requires": true,
199-
"version": "1.0.0",
200-
}
201-
`
202-
203127
exports[`test/arborist/pruner.js TAP prune workspaces > must match snapshot 1`] = `
204128
ArboristNode {
205129
"children": Map {

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/node_modules/dedent/package.json

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

0 commit comments

Comments
 (0)