Add code coverage output generation to npm test (#610)

This commit is contained in:
Darrel O'Pry 2017-09-20 15:23:40 -04:00 committed by Benaiah Mischenko
parent 1def72e93b
commit 1f06885a69
3 changed files with 17 additions and 3 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ yarn-error.log
.vscode/
manifest.yml
.imdone/
/coverage/

View File

@ -5,7 +5,7 @@
"main": "dist/cms.js",
"scripts": {
"start": "webpack-dev-server -d --config webpack.dev.js",
"test": "jest",
"test": "jest --coverage",
"test:watch": "jest --watch",
"build": "cross-env NODE_ENV=production webpack --config webpack.prod.js --display-error-details",
"build:scripts": "cross-env NODE_ENV=production webpack --config webpack.cli.js",
@ -39,7 +39,11 @@
"moduleNameMapper": {
"^.+\\.(png|eot|woff|woff2|ttf|svg|gif)$": "<rootDir>/__mocks__/fileLoaderMock.js",
"^.+\\.s?css$": "<rootDir>/__mocks__/styleLoaderMock.js"
}
},
"mapCoverage": true,
"coverageReporters": ["lcov"],
"collectCoverageFrom": [ "src/**/*.js" ],
"coveragePathIgnorePatterns": [ "/__tests__/" ]
},
"keywords": [
"netlify",

View File

@ -97,7 +97,15 @@ export default function remarkPaddedLinks() {
* nesting. If `end` is truthy, get the last node, otherwise first.
*/
function getEdgeTextChild(node, end) {
const findFn = end ? findLast : find;
/**
* This was changed from a ternary to a long form if due to issues with istanbul's instrumentation and babel's code
* generation.
* TODO: watch https://github.com/istanbuljs/babel-plugin-istanbul/issues/95
* when it is resolved then revert to ```const findFn = end ? findLast : find;```
*/
let findFn;
if (end) { findFn = findLast }
else { findFn = find };
let edgeChildWithValue;
setEdgeChildWithValue(node);