Skip to content

Commit

Permalink
fix: make tests run on Windows (bcoe#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
laggingreflex authored and bcoe committed Sep 11, 2018
1 parent a2b20f1 commit 39ebad6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "[email protected]:bcoe/c8.git"
},
"scripts": {
"test": "./bin/c8.js --reporter=html --reporter=text mocha ./test/*.js",
"test": "node ./bin/c8.js --reporter=html --reporter=text mocha ./test/*.js",
"posttest": "standard",
"coverage": "./bin/c8.js report --reporter=text-lcov | coveralls",
"release": "standard-version"
Expand Down
16 changes: 10 additions & 6 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

const { spawnSync } = require('child_process')
const c8Path = require.resolve('../bin/c8')
const nodePath = process.execPath

require('chai').should()

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

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

it('omit-relative can be set to false', () => {
const { output } = spawnSync(c8Path, [
const { output } = spawnSync(nodePath, [
c8Path,
'--exclude="test/*.js"',
'--omit-relative=false',
process.execPath,
nodePath,
require.resolve('./fixtures/multiple-spawn')
])
output.toString('utf8').should.match(
Expand Down

0 comments on commit 39ebad6

Please sign in to comment.