Skip to content

Commit

Permalink
Breaking: Update plugin:qunit/recommended config (fixes #86)
Browse files Browse the repository at this point in the history
  • Loading branch information
platinumazure committed Aug 31, 2020
1 parent 35b86c6 commit 0938a5b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Each rule has emojis denoting:
| :white_check_mark::wrench: | [literal-compare-order](./docs/rule/literal-compare-order.md) |
| :wrench: | [no-arrow-tests](./docs/rule/no-arrow-tests.md) |
| | [no-assert-equal](./docs/rule/no-assert-equal.md) |
| | [no-assert-logical-expression](./docs/rule/no-assert-logical-expression.md) |
| :white_check_mark: | [no-assert-logical-expression](./docs/rule/no-assert-logical-expression.md) |
| | [no-assert-ok](./docs/rule/no-assert-ok.md) |
| :white_check_mark: | [no-async-in-loops](./docs/rule/no-async-in-loops.md) |
| :two: | [no-async-test](./docs/rule/no-async-test.md) |
| :white_check_mark: | [no-commented-tests](./docs/rule/no-commented-tests.md) |
| :wrench: | [no-compare-relation-boolean](./docs/rule/no-compare-relation-boolean.md) |
| | [no-conditional-assertions](./docs/rule/no-conditional-assertions.md) |
| | [no-early-return](./docs/rule/no-early-return.md) |
| :white_check_mark: | [no-conditional-assertions](./docs/rule/no-conditional-assertions.md) |
| :white_check_mark: | [no-early-return](./docs/rule/no-early-return.md) |
| :two: | [no-global-assertions](./docs/rule/no-global-assertions.md) |
| :two: | [no-global-expect](./docs/rule/no-global-expect.md) |
| :two: | [no-global-module-test](./docs/rule/no-global-module-test.md) |
Expand All @@ -48,7 +48,7 @@ Each rule has emojis denoting:
| :two: | [no-init](./docs/rule/no-init.md) |
| :two: | [no-jsdump](./docs/rule/no-jsdump.md) |
| | [no-loose-assertions](./docs/rule/no-loose-assertions.md) |
| :wrench: | [no-negated-ok](./docs/rule/no-negated-ok.md) |
| :white_check_mark::wrench: | [no-negated-ok](./docs/rule/no-negated-ok.md) |
| | [no-nested-tests](./docs/rule/no-nested-tests.md) |
| :white_check_mark::wrench: | [no-ok-equality](./docs/rule/no-ok-equality.md) |
| :white_check_mark: | [no-only](./docs/rule/no-only.md) |
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/no-assert-logical-expression.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Forbid binary logical expressions in assert arguments (no-assert-logical-expression)

:white_check_mark: The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.

Generally, it is not a good idea to use logical expressions as assertion arguments. Logical-and assertions can be broken down into multiple assertions, while logical-or assertions may be indicative of uncertainty or nondeterminism in a test.

## Rule Details
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/no-conditional-assertions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Forbid assertions within if statements or conditional expressions (no-conditional-assertions)

:white_check_mark: The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.

This rule aims to detect non-deterministic unit testing by looking for assertions in an if statement or conditional expression.

Most of the time, a unit test should know what it is testing and what assertions should be run for a given test. Conditional assertions suggest that the developer is not sure how the unit test should run, or else that the developer is unfamiliar with testing boolean conditions within an assertion.
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/no-early-return.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# prevent early return in a QUnit test (no-early-return)

:white_check_mark: The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.

This rule aims to prevent early returns in a QUnit test. Unit tests which can return early are usually indications that a test is nondeterministic or too dependent on environmental factors. On the rare occasion that a test should be run conditionally, the whole test should be run or skipped, rather than having a test that can return early (which is harder to maintain).

## Rule Details
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/no-negated-ok.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Forbid the use of negations in assert.ok/notOk (no-negated-ok)

:white_check_mark: The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.

:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.

Negated `assert.ok()` or `assert.notOk()` solutions can be misleading, because
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ module.exports = {
rules: {
"qunit/assert-args": "error",
"qunit/literal-compare-order": "error",
"qunit/no-assert-logical-expression": "error",
"qunit/no-async-in-loops": "error",
"qunit/no-commented-tests": "error",
"qunit/no-conditional-assertions": "error",
"qunit/no-early-return": "error",
"qunit/no-identical-names": "error",
"qunit/no-negated-ok": "error",
"qunit/no-ok-equality": "error",
"qunit/no-only": "error",
"qunit/no-reassign-log-callbacks": "error",
Expand Down

0 comments on commit 0938a5b

Please sign in to comment.