Skip to content

Instantly share code, notes, and snippets.

@mahpah

mahpah/.babelrc

Created Oct 19, 2016
Embed
What would you like to do?
Istanbul coverage for babel based nodejs repo
{
"presets": [
"es2015",
"stage-3"
],
"env": {
"test": {
"plugins": [
[
"istanbul",
{
"exclude": [
"**/*.spec.js"
]
}
]
]
}
}
}
class Library {
doThing(source) {
if (source) {
return source;
}
return 'result';
}
}
export const library = () =>
new Library();
import 'babel-polyfill';
import { expect } from 'chai';
import { library } from './dumb';
describe('Library', () => {
let lib;
beforeEach(() => {
lib = library();
});
it('should do thing', () => {
let ret = lib.doThing();
expect(ret).to.exist;
});
it('should echo source', () => {
let source = 'Hi';
let ret = lib.doThing(source);
expect(ret).to.equal(source);
});
});
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test:single": "mocha --compilers js:babel-core/register --recursive **/*.spec.js",
"test": "NODE_ENV=test nyc --reporter=lcov --reporter=text npm run test:single",
"precoverage": "rm -Rf coverage"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"keywords": [],
"author": "Ha Pham <mahpahh@gmail.com> (http://mahpahh.com)",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-plugin-istanbul": "^2.0.3",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-stage-3": "^6.17.0",
"chai": "^3.5.0",
"istanbul": "^0.4.5",
"mocha": "^3.1.2",
"nyc": "^8.3.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment