Skip to content

Commit 08e44d0

Browse files
laggingreflexbcoe
authored andcommitted
fix: make tests run on Windows (bcoe#25)
1 parent 6c664fe commit 08e44d0

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "[email protected]:bcoe/c8.git"
1010
},
1111
"scripts": {
12-
"test": "./bin/c8.js --reporter=html --reporter=text mocha ./test/*.js",
12+
"test": "node ./bin/c8.js --reporter=html --reporter=text mocha ./test/*.js",
1313
"posttest": "standard",
1414
"coverage": "./bin/c8.js report --reporter=text-lcov | coveralls",
1515
"release": "standard-version"

test/integration.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
const { spawnSync } = require('child_process')
44
const c8Path = require.resolve('../bin/c8')
5+
const nodePath = process.execPath
56

67
require('chai').should()
78

89
describe('c8', () => {
910
it('reports coverage for script that exits normally', () => {
10-
const { output } = spawnSync(c8Path, [
11+
const { output } = spawnSync(nodePath, [
12+
c8Path,
1113
'--exclude="test/*.js"',
12-
process.execPath,
14+
nodePath,
1315
require.resolve('./fixtures/normal')
1416
])
1517
output.toString('utf8').should.include(`
@@ -23,9 +25,10 @@ All files | 91.18 | 88.89 | 0 | 91.18 | |
2325
})
2426

2527
it('merges reports from subprocesses together', () => {
26-
const { output } = spawnSync(c8Path, [
28+
const { output } = spawnSync(nodePath, [
29+
c8Path,
2730
'--exclude="test/*.js"',
28-
process.execPath,
31+
nodePath,
2932
require.resolve('./fixtures/multiple-spawn')
3033
])
3134
output.toString('utf8').should.include(`
@@ -39,10 +42,11 @@ All files | 100 | 77.78 | 100 | 100 |
3942
})
4043

4144
it('omit-relative can be set to false', () => {
42-
const { output } = spawnSync(c8Path, [
45+
const { output } = spawnSync(nodePath, [
46+
c8Path,
4347
'--exclude="test/*.js"',
4448
'--omit-relative=false',
45-
process.execPath,
49+
nodePath,
4650
require.resolve('./fixtures/multiple-spawn')
4751
])
4852
output.toString('utf8').should.match(

0 commit comments

Comments
 (0)