Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ pids
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
# Coverage directories used by tools like nyc
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand Down
6 changes: 0 additions & 6 deletions .istanbul.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"lines": 90,
"functions": 55,
"branches": 66,
"statements": 91,
"reporter": [
"html",
"text-summary"
],
"require": [
"babel-register"
],
"exclude": [
"test"
],
"check-coverage": true
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Collaborator

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?

Copy link
Contributor Author

@magicmark magicmark Jul 6, 2017

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?)

Copy link
Collaborator

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",
Copy link
Collaborator

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?

"cover:check": "nyc report && echo code coverage thresholds met, achievement unlocked!",
"test:quick": "babel-node node_modules/.bin/_mocha -R tap test/init.js test/*-test.js"
},
"repository": {
Expand Down Expand Up @@ -50,11 +50,11 @@
"eslint-config-airbnb-base": "^11.2.0",
"eslint-plugin-import": "^2.2.0",
"in-publish": "^2.0.0",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^3.4.1",
"mocha-wrap": "^2.1.1",
"rimraf": "^2.6.1",
"safe-publish-latest": "^1.1.1",
"nyc": "^10.3.2",
"sinon": "^1.17.7",
"sinon-sandbox": "^1.0.2"
},
Expand Down