-
Notifications
You must be signed in to change notification settings - Fork 32
/
bundled-scoped.js
50 lines (46 loc) · 1.08 KB
/
bundled-scoped.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict'
const Arborist = require('@npmcli/arborist')
const t = require('tap')
const packlist = require('../')
const elfJS = `
module.exports = elf =>
console.log("i'm a elf")
`
const pkg = t.testdir({
'package.json': JSON.stringify({
name: 'test-package',
version: '3.1.4',
main: 'elf.js',
dependencies: {
'@npmwombat/history': '1.0.0',
},
bundleDependencies: [
'@npmwombat/history',
],
}),
'elf.js': elfJS,
'.npmrc': 'packaged=false',
node_modules: {
'@npmwombat': {
history: {
'package.json': JSON.stringify({
name: '@npmwombat/history',
version: '1.0.0',
main: 'index.js',
}),
'index.js': elfJS,
},
},
},
})
t.test('includes bundled dependency', async (t) => {
const arborist = new Arborist({ path: pkg })
const tree = await arborist.loadActual()
const files = await packlist({ path: pkg, tree })
t.same(files, [
'elf.js',
'node_modules/@npmwombat/history/index.js',
'node_modules/@npmwombat/history/package.json',
'package.json',
])
})