-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.js
52 lines (50 loc) · 1.38 KB
/
test.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
const path = require('path');
const test = require('ava');
// eslint-disable-next-line import/no-extraneous-dependencies
const m = require('nm-prune');
let fileCountWithoutLicenses = 0;
test('sanity test', t =>
m.prep(process.cwd()).then((info) => {
const {
fileCount,
dirCount,
prunePath,
usingCustomPrune,
modulePath,
files,
dirs,
size,
} = info;
t.is(typeof info, 'object');
t.is(modulePath, path.join(__dirname, 'node_modules'));
t.is(usingCustomPrune, false);
t.pass(prunePath.includes('default-prune.json'));
t.pass(size > 1000);
t.pass(Array.isArray(files));
t.pass(Array.isArray(dirs));
t.pass(fileCount > 100);
t.pass(dirCount > 50);
fileCountWithoutLicenses = fileCount;
}));
test('sanity test with license pruning', t =>
m.prep(process.cwd(), { pruneLicense: true, }).then((info) => {
const {
fileCount,
dirCount,
prunePath,
usingCustomPrune,
modulePath,
files,
dirs,
size,
} = info;
t.is(typeof info, 'object');
t.is(modulePath, path.join(__dirname, 'node_modules'));
t.is(usingCustomPrune, false);
t.pass(prunePath.includes('default-prune.json'));
t.pass(size > 1000);
t.pass(Array.isArray(files));
t.pass(Array.isArray(dirs));
t.pass(fileCount > fileCountWithoutLicenses);
t.pass(dirCount > 50);
}));