33const { spawnSync } = require ( 'child_process' )
44const c8Path = require . resolve ( '../bin/c8' )
55const nodePath = process . execPath
6+ const chaiJestSnapshot = require ( 'chai-jest-snapshot' )
67
7- require ( 'chai' ) . should ( )
8+ require ( 'chai' )
9+ . use ( chaiJestSnapshot )
10+ . should ( )
11+
12+ beforeEach ( function ( ) { chaiJestSnapshot . configureUsingMochaContext ( this ) } )
813
914describe ( 'c8' , ( ) => {
1015 it ( 'reports coverage for script that exits normally' , ( ) => {
@@ -15,14 +20,7 @@ describe('c8', () => {
1520 nodePath ,
1621 require . resolve ( './fixtures/normal' )
1722 ] )
18- output . toString ( 'utf8' ) . should . include ( `
19- -----------|----------|----------|----------|----------|-------------------|
20- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
21- -----------|----------|----------|----------|----------|-------------------|
22- All files | 91.18 | 88.89 | 0 | 91.18 | |
23- async.js | 100 | 100 | 100 | 100 | |
24- normal.js | 85.71 | 75 | 0 | 85.71 | 14,15,16 |
25- -----------|----------|----------|----------|----------|-------------------|` )
23+ output . toString ( 'utf8' ) . should . matchSnapshot ( )
2624 } )
2725
2826 it ( 'merges reports from subprocesses together' , ( ) => {
@@ -33,22 +31,7 @@ All files | 91.18 | 88.89 | 0 | 91.18 | |
3331 nodePath ,
3432 require . resolve ( './fixtures/multiple-spawn' )
3533 ] )
36- output . toString ( 'utf8' ) . should . include ( `
37- --------------------|----------|----------|----------|----------|-------------------|
38- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
39- --------------------|----------|----------|----------|----------|-------------------|
40- All files | 94.12 | 70.59 | 0 | 94.12 | |
41- bin | 83.72 | 57.14 | 100 | 83.72 | |
42- c8.js | 83.72 | 57.14 | 100 | 83.72 |... 22,40,41,42,43 |
43- lib | 96.41 | 65.38 | 100 | 96.41 | |
44- parse-args.js | 97.47 | 44.44 | 100 | 97.47 | 55,56 |
45- report.js | 95.45 | 76.47 | 100 | 95.45 | 51,52,53,54 |
46- test/fixtures | 95.16 | 83.33 | 0 | 95.16 | |
47- async.js | 100 | 100 | 100 | 100 | |
48- multiple-spawn.js | 100 | 100 | 100 | 100 | |
49- normal.js | 85.71 | 75 | 0 | 85.71 | 14,15,16 |
50- subprocess.js | 100 | 71.43 | 100 | 100 | 9,13 |
51- --------------------|----------|----------|----------|----------|-------------------|` )
34+ output . toString ( 'utf8' ) . should . matchSnapshot ( )
5235 } )
5336
5437 it ( 'omit-relative can be set to false' , ( ) => {
0 commit comments