-
Notifications
You must be signed in to change notification settings - Fork 214
Make coverage reports es6 #63
base: master
Are you sure you want to change the base?
Conversation
fcc5301
to
8f2c1fc
Compare
nyc has more accurate coverage than istanbul-cli, so it's ok if they dropped a little bit. |
package.json
Outdated
"test:quick": "babel-node node_modules/.bin/_mocha -R tap test/init.js test/*-test.js" | ||
"test": "npm run test:coverage && npm run --silent cover:check", | ||
"tests-only": "npm run test:quick", | ||
"test:coverage": "nyc --silent node_modules/.bin/_mocha -R tap test/init.js test/*-test.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while we're at it, can this just use mocha
directly, instead of needing the _mocha
istanbul hack?
server.js
Outdated
@@ -1 +1 @@ | |||
module.exports = require('./lib/server.js'); | |||
module.exports = require('./src/server.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break the package. Please revert it.
test/BatchManager-test.js
Outdated
@@ -2,7 +2,7 @@ import { assert } from 'chai'; | |||
import sinon from 'sinon-sandbox'; | |||
|
|||
import { makeJob, COMPONENT_NAME } from './helper'; | |||
import BatchManager from '../lib/utils/BatchManager'; | |||
import BatchManager from '../src/utils/BatchManager'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, we actually want tests to be run on babel output; not on the raw source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can have source maps, even when we're running tests on the babel output. I've set this up with nyc in another package.
8f2c1fc
to
3d63634
Compare
@ljharb rebased + made changes. I guess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is almost ready!
package.json
Outdated
"test:quick": "babel-node node_modules/.bin/_mocha -R tap test/init.js test/*-test.js" | ||
"test:coverage": "nyc --silent node_modules/.bin/mocha -R tap test/init.js test/*-test.js", | ||
"cover:check": "nyc report && echo code coverage thresholds met, achievement unlocked!", | ||
"test:quick": "npm run test:coverage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the point of the "quick" script is to run without coverage :-) can this line be reverted?
.nycrc
Outdated
@@ -0,0 +1,17 @@ | |||
{ | |||
"lines": 91, | |||
"functions": 56, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I ran this locally on node 7, it failed with 55.something - could we drop this to 55
just to avoid the failure later, when I add node 7 to travis?
3d63634
to
f585654
Compare
- Switch to nyc - Update thresholds
f585654
to
5229cc0
Compare
@ljharb rebased again passing with node 6 and 7:
|
@@ -5,13 +5,13 @@ | |||
"main": "lib/index.js", | |||
"scripts": { | |||
"prepublish": "not-in-publish || safe-publish-latest && npm run build", | |||
"build": "rimraf lib && babel src -d lib", | |||
"build": "rimraf lib && babel --source-maps inline src -d lib", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid using inline source maps, and use regular ones instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, running into some problems here.
The higher quality source maps decreases the coverage which isn't a big deal (I guess this was the point :D), but I can't get nyc to map back to original sources.
I tried both with and without the babel-plugin-istanbul
plugin, with every combination of sourceMap
, instrument
and env vars, but I couldn't get the mapping back from the instrumentation code+es5/es5 respectively :(
I can't find anything in the nyc
or babel-plugin-istanbul
docs about external source maps - I also notice the documentation seems to recommend using inline
source maps (https://github.com/istanbuljs/nyc#support-for-custom-require-hooks-babel-webpack-etc)
I'll open an issue+reproducible example on nyc later, but for now, this is blocking me :(
Have you got any thoughts w/r solving this? (You mentioned you had another repo set up with nyc?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/airbnb/prop-types/blob/master/package.json#L52 is the other repo.
I'm not sure how to set it up.
It would be fine to build with inline source maps only when building for coverage, it just means we have to build twice.
"lint": "eslint src test", | ||
"pretest": "npm run --silent lint", | ||
"test": "npm run build && npm run test:coverage && npm run --silent cover:check", | ||
"tests-only": "npm run build && npm run test:quick", | ||
"test:coverage": "babel-node node_modules/.bin/istanbul cover --report html node_modules/.bin/_mocha -- -R tap test/init.js test/*-test.js", | ||
"cover:check": "istanbul check-coverage && echo code coverage thresholds met, achievement unlocked!", | ||
"test:coverage": "nyc --silent node_modules/.bin/mocha -R tap test/init.js test/*-test.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use nyc --silent "$(which mocha)" …
rather than hardcoding node_modules
?
src
rather thanlib
(Used to look like this, now they look like this
test:quick
andtests-only
are kinda useless now but unsure if safe to deprecate (major bump?)