2
2
3
3
const { spawnSync } = require ( 'child_process' )
4
4
const c8Path = require . resolve ( '../bin/c8' )
5
+ const nodePath = process . execPath
5
6
6
7
require ( 'chai' ) . should ( )
7
8
8
9
describe ( 'c8' , ( ) => {
9
10
it ( 'reports coverage for script that exits normally' , ( ) => {
10
- const { output } = spawnSync ( c8Path , [
11
+ const { output } = spawnSync ( nodePath , [
12
+ c8Path ,
11
13
'--exclude="test/*.js"' ,
12
- process . execPath ,
14
+ nodePath ,
13
15
require . resolve ( './fixtures/normal' )
14
16
] )
15
17
output . toString ( 'utf8' ) . should . include ( `
@@ -23,9 +25,10 @@ All files | 91.18 | 88.89 | 0 | 91.18 | |
23
25
} )
24
26
25
27
it ( 'merges reports from subprocesses together' , ( ) => {
26
- const { output } = spawnSync ( c8Path , [
28
+ const { output } = spawnSync ( nodePath , [
29
+ c8Path ,
27
30
'--exclude="test/*.js"' ,
28
- process . execPath ,
31
+ nodePath ,
29
32
require . resolve ( './fixtures/multiple-spawn' )
30
33
] )
31
34
output . toString ( 'utf8' ) . should . include ( `
@@ -39,10 +42,11 @@ All files | 100 | 77.78 | 100 | 100 |
39
42
} )
40
43
41
44
it ( 'omit-relative can be set to false' , ( ) => {
42
- const { output } = spawnSync ( c8Path , [
45
+ const { output } = spawnSync ( nodePath , [
46
+ c8Path ,
43
47
'--exclude="test/*.js"' ,
44
48
'--omit-relative=false' ,
45
- process . execPath ,
49
+ nodePath ,
46
50
require . resolve ( './fixtures/multiple-spawn' )
47
51
] )
48
52
output . toString ( 'utf8' ) . should . match (
0 commit comments