Skip to content

Commit e71cacc

Browse files
committed
feat!: change the default of --forbid-only to check for process.env.CI
1 parent 65a91b5 commit e71cacc

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

docs/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,12 @@ Enforce a rule that tests may not be exclusive (use of e.g., `describe.only()` o
947947

948948
`--forbid-only` causes Mocha to fail when an exclusive ("only'd") test or suite is encountered, and it will abort further test execution.
949949

950+
Defaults:
951+
952+
1. Before v12: false
953+
2. After v12: false, unless an environment variable called `CI` is set. Many popular
954+
CI providers, like github actions or gitlab, do this automatically.
955+
950956
### `--forbid-pending`
951957

952958
Enforce a rule that tests may not be skipped (use of e.g., `describe.skip()`, `it.skip()`, or `this.skip()` anywhere is disallowed).

lib/cli/run.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ exports.builder = yargs =>
123123
},
124124
'forbid-only': {
125125
description: 'Fail if exclusive test(s) encountered',
126-
group: GROUPS.RULES
126+
group: GROUPS.RULES,
127+
default: !!process.env.CI,
127128
},
128129
'forbid-pending': {
129130
description: 'Fail if pending test(s) encountered',

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@
8181
"test-node:interfaces:tdd": "npm run -s test-node-run -- --ui tdd test/interfaces/tdd.spec",
8282
"test-node:interfaces": "run-p test-node:interfaces:*",
8383
"test-node:jsapi": "node test/jsapi/index.js",
84-
"test-node:only:bddRequire": "npm run -s test-node-run-only -- --ui qunit test/only/bdd-require.spec --no-parallel",
85-
"test-node:only:globalBdd": "npm run -s test-node-run-only -- --ui bdd test/only/global/bdd.spec --no-parallel",
86-
"test-node:only:globalQunit": "npm run -s test-node-run-only -- --ui qunit test/only/global/qunit.spec --no-parallel",
87-
"test-node:only:globalTdd": "npm run -s test-node-run-only -- --ui tdd test/only/global/tdd.spec --no-parallel",
84+
"test-node:only:bddRequire": "npm run -s test-node-run-only -- --ui qunit test/only/bdd-require.spec --no-parallel --no-forbid-only",
85+
"test-node:only:globalBdd": "npm run -s test-node-run-only -- --ui bdd test/only/global/bdd.spec --no-parallel --no-forbid-only",
86+
"test-node:only:globalQunit": "npm run -s test-node-run-only -- --ui qunit test/only/global/qunit.spec --no-parallel --no-forbid-only",
87+
"test-node:only:globalTdd": "npm run -s test-node-run-only -- --ui tdd test/only/global/tdd.spec --no-parallel --no-forbid-only",
8888
"test-node:only": "run-p test-node:only:*",
8989
"test-node:reporters": "npm run -s test-node-run -- \"test/reporters/*.spec.js\"",
9090
"test-node:requires": "npm run -s test-node-run -- --require coffeescript/register --require test/require/a.js --require test/require/b.coffee --require test/require/c.js --require test/require/d.coffee test/require/require.spec.js",

0 commit comments

Comments
 (0)