Skip to content

Commit b3ebca5

Browse files
authored
Use istanbul babel plugin only in tests (#536)
Prevents coverage instrumentation code from being in the final package. Fixes #535.
1 parent 9585a70 commit b3ebca5

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

.babelrc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
}
1010
]
1111
],
12-
"plugins": [
13-
"istanbul"
14-
]
12+
"env": {
13+
"test": {
14+
"plugins": [
15+
"istanbul"
16+
]
17+
}
18+
}
1519
}

package-lock.json

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"build": "babel lib --out-dir dist",
2828
"prepare": "npm run build",
2929
"lint": "eslint . --ignore-path .gitignore",
30-
"coverage": "nyc --require @babel/register mocha -- 'test/*.test.js'",
30+
"coverage": "cross-env NODE_ENV=test nyc --require @babel/register mocha -- 'test/*.test.js'",
3131
"report": "nyc report --reporter=text-lcov | coveralls",
3232
"test": "npm run lint && npm run coverage"
3333
},
@@ -57,6 +57,7 @@
5757
"babel-plugin-istanbul": "^5.2.0",
5858
"chai": "^4.2.0",
5959
"coveralls": "^3.0.9",
60+
"cross-env": "^6.0.3",
6061
"eslint": "^6.7.2",
6162
"eslint-config-airbnb-base": "^14.0.0",
6263
"eslint-plugin-import": "^2.19.1",

0 commit comments

Comments
 (0)