diff --git a/package.json b/package.json index f9316a69..2a6afef2 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "git@github.com: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" diff --git a/test/integration.js b/test/integration.js index 73908cdb..6c1f1d01 100644 --- a/test/integration.js +++ b/test/integration.js @@ -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(` @@ -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(` @@ -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(