mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Fix: code coverage
Replace Istanbul with nyc, Istanbul's CLI. nyc appears to have some bugs that this patch works around: - When all files in the project are considered, not just those imported via tests, the coverage rates and line numbers vary between runs. This patch disables the `all` option for now and points to the bug: https://github.com/istanbuljs/nyc/issues/537#issuecomment-390814662. - Source map line numbers appear to be incorrect except when `all` is enabled and working correctly (see previous bullet). - `sourceMap` must be disabled to avoid ENAMETOOLONG errors when nyc tries to include them as encoded strings. The patch disables the setting and points to: https://github.com/istanbuljs/nyc/issues/847. Using babel-plugin-istanbul and source-map-support appears to have no effect (the former in tests/node-qunit/run.js and .babelrc). - CI fails with `Error: EACCES: permission denied, mkdir '/nonexistent'`. Specify `SPAWN_WRAP_SHIM_ROOT` instead of constructing a subdirectory from a nonexistent home directory. Bug: T196952 Bug: T193519 Change-Id: Idf2e3accd4a6277cbef91c1156fcd206c9e7d882
This commit is contained in:
parent
3cf54a0ff6
commit
95047ba360
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
/doc/autogenerated/
|
||||
/coverage/
|
||||
/.nyc_output/
|
||||
/node_modules/
|
||||
/vendor/
|
||||
/composer.lock
|
||||
|
|
31
.nycrc.json
Normal file
31
.nycrc.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"//": "todo: enable caching. There are too many other issues to verify that",
|
||||
"//": "caching works correctly.",
|
||||
"cache": false,
|
||||
|
||||
"//": "todo: check coverage on all files not just those included in tests.",
|
||||
"//": "Enable when",
|
||||
"//": "https://github.com/istanbuljs/nyc/issues/537#issuecomment-390814662",
|
||||
"//": "is fixed.",
|
||||
"all": false,
|
||||
|
||||
"//": "Ignore files in vendor/, resources/, and elsewhere.",
|
||||
"include": [ "src/**/*.js" ],
|
||||
|
||||
"//": "Set the coverage percentage by category thresholds.",
|
||||
"statements": 90,
|
||||
"branches": 85,
|
||||
"functions": 85,
|
||||
"lines": 90,
|
||||
|
||||
"//": "Fail if the coverage is below threshold.",
|
||||
"check-coverage": true,
|
||||
|
||||
"//": "Work around source maps being included ",
|
||||
"//": "https://github.com/istanbuljs/nyc/issues/847:",
|
||||
"//": " Error: ENAMETOOLONG: name too long, open '.../vagrant/mediawiki/extensions/Popups/src/data:application/json;...'",
|
||||
"//": "Unfortunately, the reported line numbers appear to be",
|
||||
"//": "nondeterministic across runs when all is enabled and incorrect when",
|
||||
"//": "disabled.",
|
||||
"sourceMap": false
|
||||
}
|
2463
package-lock.json
generated
2463
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -5,13 +5,13 @@
|
|||
"build": "NODE_ENV=production webpack -p",
|
||||
"lint:fix": "grunt fix",
|
||||
"test:node": "node tests/node-qunit/run.js 'tests/node-qunit/**/*.test.js' | tap-dot",
|
||||
"test:dev": "grunt lint && npm run test:node",
|
||||
"test": "npm run check-built-assets && npm run test:dev && npm run doc",
|
||||
"test:dev": "grunt lint && npm -s run coverage && npm -s run -s doc",
|
||||
"test": "npm -s run check-built-assets && npm -s run test:dev",
|
||||
"doc": "jsdoc -c jsdoc.json",
|
||||
"doc:start": "nodemon --watch src --exec 'npm run doc'",
|
||||
"check-built-assets": "echo 'CHECKING BUILD SOURCES ARE COMMITTED OR STAGED' && npm run build && git diff -q resources/dist",
|
||||
"coverage": "istanbul cover node_modules/.bin/mw-node-qunit tests/node-qunit/*.js tests/node-qunit/**/*.js",
|
||||
"precommit": "npm run test:dev && npm run build && git add resources/dist && bundlesize"
|
||||
"doc:start": "nodemon --watch src --exec 'npm -s run doc'",
|
||||
"check-built-assets": "echo 'CHECKING BUILD SOURCES ARE COMMITTED OR STAGED' && npm -s run build && git diff -q resources/dist",
|
||||
"coverage": "SPAWN_WRAP_SHIM_ROOT=\"$PWD/.nyc_output\" nyc npm -s run test:node",
|
||||
"precommit": "npm -s run test:dev && npm -s run build && git add resources/dist && bundlesize"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-loader": "7.1.4",
|
||||
|
@ -27,10 +27,10 @@
|
|||
"grunt-jsonlint": "1.1.0",
|
||||
"grunt-stylelint": "0.10.0",
|
||||
"husky": "0.13.3",
|
||||
"istanbul": "0.4.5",
|
||||
"jsdoc": "3.5.5",
|
||||
"mw-node-qunit": "4.0.0",
|
||||
"nodemon": "1.17.3",
|
||||
"nyc": "12.0.2",
|
||||
"redux": "3.6.0",
|
||||
"redux-thunk": "2.2.0",
|
||||
"stylelint": "9.2.0",
|
||||
|
|
Loading…
Reference in a new issue