diff --git a/README.md b/README.md index 7c790603a..815110b65 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,12 @@ After an `npm install`: * You can find the QUnit tests that depend on running MediaWiki under `tests/qunit/` * You can find the isolated QUnit tests under `tests/node-qunit/`, which you - can run with `npm run test:node` + can run with `npm run test:unit` * We recommend you install a file watcher like `nodemon` to watch sources and auto run linting and tests. * `npm install -g nodemon` * Example running linting and node unit tests: - * `nodemon -w src/ --exec "grunt lint:all && npm run test:node"` + * `nodemon -w src/ --exec "grunt lint:all && npm run test:unit"` * Get code coverage report with `npm run coverage` * Reports printed in the `coverage/` folder diff --git a/docs/adr/0007-prefer-running-qunit-tests-in-node-js.md b/docs/adr/0007-prefer-running-qunit-tests-in-node-js.md index 192bb3d62..ed355475c 100644 --- a/docs/adr/0007-prefer-running-qunit-tests-in-node-js.md +++ b/docs/adr/0007-prefer-running-qunit-tests-in-node-js.md @@ -21,7 +21,7 @@ We want to: ## Decision QUnit tests will be migrated from `tests/qunit/ext.popups/` to -`tests/node-qunit/` and will be run by the script `npm run test:node` in a node +`tests/node-qunit/` and will be run by the script `npm run test:unit` in a node environment with access to QUnit, a fake jsdom, and jQuery. Powered by the node package `mw-node-qunit`. diff --git a/package.json b/package.json index 8faba3c0a..7cee4c957 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "start": "webpack -w --mode=development", "build": "NODE_ENV=production webpack --mode=production", "lint:fix": "grunt fix", - "test:node": "node tests/node-qunit/run.js 'tests/node-qunit/**/*.test.js' | tap-mocha-reporter dot", + "test:unit": "node tests/node-qunit/run.js 'tests/node-qunit/**/*.test.js' | tap-mocha-reporter dot", "test": "npm -s run check-built-assets && grunt lint && npm -s run coverage && npm -s run -s doc && bundlesize", "doc": "jsdoc -c jsdoc.json", "node-debug": "node -v && npm -v && echo 'Please ensure you are running the correct version of nvm before running this command.'", "check-built-assets": "echo 'CHECKING BUILD SOURCES ARE COMMITTED OR STAGED' && npm -s run build && git diff --exit-code resources/dist || { npm run node-debug; false; }", - "coverage": "SPAWN_WRAP_SHIM_ROOT=\"$PWD/.nyc_output\" nyc npm -s run test:node", + "coverage": "SPAWN_WRAP_SHIM_ROOT=\"$PWD/.nyc_output\" nyc npm -s run test:unit", "precommit": "npm -s t", "selenium-daily": "npm run selenium-test", "selenium-test": "wdio tests/selenium/wdio.conf.js"