Skip to content

Commit 2dc2aa0

Browse files
committed
Change the default of --forbid-only to check for process.env.CI
1 parent 65a91b5 commit 2dc2aa0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
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',

0 commit comments

Comments
 (0)