-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
log-packed.spec.ts
58 lines (53 loc) · 2.16 KB
/
log-packed.spec.ts
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
import npmlog from 'npmlog';
import { logPacked } from '../lib';
describe('log-packed', () => {
const pkg = {
name: '@lerna-lite/core',
version: '1.3.0',
dependencies: {
'tiny-tarball': '^1.0.0',
},
devDependencies: {
'eslint': '^8.16.0',
},
location: '',
manifestLocation: '',
packed: {
id: '@lerna-lite/core@1.4.1',
name: '@lerna-lite/core',
filename: 'lerna-lite.tar.tgz',
files: [{ 'package-1': 'location1' }],
version: '1.4.1',
size: 84219,
shasum: 'ABC123',
integrity: 'ABC123',
unpackedSize: 340009,
entryCount: 14,
bundled: [{
name: 'test'
}]
},
}
it('should display dry-run details', () => {
const logSpy = jest.spyOn(npmlog, 'notice');
logPacked(pkg, true);
expect(logSpy).toHaveBeenCalledWith('=== Bundled Dependencies ===', '');
expect(logSpy).toHaveBeenCalledWith('=== Tarball Details ===', '');
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('size: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('package size: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('unpacked size: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('shasum: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('integrity: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('bundled deps: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('bundled files: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('own files: '));
expect(logSpy).toHaveBeenCalledWith('', expect.stringContaining('total files: '));
expect(logSpy).toHaveBeenCalledWith('', '--- dry-run details ---');
expect(logSpy).toHaveBeenCalledWith('', 'package name: @lerna-lite/core');
expect(logSpy).toHaveBeenCalledWith('dependencies:', '');
expect(logSpy).toHaveBeenCalledWith('', 'tiny-tarball | ^1.0.0');
expect(logSpy).toHaveBeenCalledWith('devDependencies:', '');
expect(logSpy).toHaveBeenCalledWith('', 'eslint | ^8.16.0');
expect(logSpy).toHaveBeenCalledWith('', '');
});
});