Skip to content

Commit 3403ca1

Browse files
addaleaxbcoe
authored andcommitted
fix: adds CLI integration testing, where there was no integration testing before.
1 parent 545cf91 commit 3403ca1

11 files changed

Lines changed: 214 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"clean": "rimraf ./.nyc_output ./node_modules/.cache ./.self_coverage ./test/fixtures/.nyc_output ./test/fixtures/node_modules/.cache *covered.js ./lib/*covered.js",
1010
"build": "node ./build-tests",
1111
"instrument": "node ./build-self-coverage.js",
12-
"run-tests": "tap --no-cov -b ./test/build/*.js ./test/src/source-map-cache.js",
12+
"run-tests": "tap --no-cov -b ./test/build/*.js ./test/src/source-map-cache.js ./test/src/nyc-bin.js",
1313
"report": "istanbul report --include=./.self_coverage/*.json lcov text",
1414
"cover": "npm run clean && npm run build && npm run instrument && npm run run-tests && npm run report",
1515
"dev": "npm run clean && npm run build && npm run run-tests",
@@ -106,6 +106,7 @@
106106
"standard": "^6.0.8",
107107
"standard-version": "^1.1.0",
108108
"tap": "^5.7.1",
109+
"which": "^1.2.4",
109110
"zero-fill": "^2.2.3"
110111
},
111112
"repository": {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node
2+
npm
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// shebang gets added before this line
2+
var which = require('which')
3+
var assert = require('assert')
4+
var foreground = require('foreground-child')
5+
6+
// strip first PATH folder
7+
process.env.PATH = process.env.PATH.replace(/^.+?[:;]/, '')
8+
9+
foreground('npm', process.argv.slice(2))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var a = 0
2+
3+
throw new Error
4+
5+
if (a === 0) {
6+
a++;
7+
a--;
8+
a++;
9+
}

test/fixtures/cli/half-covered.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var a = 0
2+
3+
a++
4+
5+
if (a === 0) {
6+
a++;
7+
a--;
8+
a++;
9+
}

test/fixtures/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"private": true
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var a = 0
2+
3+
a++
4+
5+
if (a === 0) {
6+
a++;
7+
a--;
8+
a++;
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"test": "npm run test:deeper",
5+
"test:deeper": "npm run test:even-deeper",
6+
"test:even-deeper": "node ./half-covered.js"
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var a = 0
2+
3+
a++
4+
5+
if (a === 0) {
6+
a++;
7+
a--;
8+
a++;
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"test": "node ./half-covered.js"
5+
}
6+
}

0 commit comments

Comments
 (0)