-
Notifications
You must be signed in to change notification settings - Fork 32
/
bundled-symlink.js
62 lines (58 loc) · 1.32 KB
/
bundled-symlink.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
51
52
53
54
55
56
57
58
59
60
61
62
'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({
pkg: {
'package.json': JSON.stringify({
name: 'test-package',
version: '3.1.4',
main: 'elf.js',
dependencies: {
history: '1.0.0',
},
bundleDependencies: [
'history',
],
}),
'elf.js': elfJS,
'.npmrc': 'packaged=false',
node_modules: {
history: t.fixture('symlink', '../../history'),
},
},
history: {
'package.json': JSON.stringify({
name: 'history',
version: '1.0.0',
main: 'index.js',
files: [
'index.js',
'lib/',
],
}),
'index.js': elfJS,
tests: {
'test.js': 'please do not include me',
},
// this should not be followed, even though the bundled dep is
lib: {
linky: t.fixture('symlink', '../tests'),
},
},
}) + '/pkg'
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/history/index.js',
'node_modules/history/package.json',
'package.json',
])
})