From 40cd89ddf1d6ebbde8ad455f333dda7b61878ffe Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sun, 2 Aug 2020 17:44:27 +1200 Subject: [PATCH] feat: add `no-conditional-expect` to the recommended ruleset BREAKING CHANGE: recommend `no-conditional-expect` rule --- README.md | 2 +- src/__tests__/__snapshots__/rules.test.ts.snap | 1 + src/rules/no-conditional-expect.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 489029171..d67c42dc6 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ installations requiring long-term consistency. | [lowercase-name](docs/rules/lowercase-name.md) | Enforce lowercase test names | | ![fixable][] | | [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | ![style][] | ![fixable][] | | [no-commented-out-tests](docs/rules/no-commented-out-tests.md) | Disallow commented out tests | ![recommended][] | | -| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Prevent calling `expect` conditionally | | | +| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Prevent calling `expect` conditionally | ![recommended][] | | | [no-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions | ![recommended][] | ![fixable][] | | [no-disabled-tests](docs/rules/no-disabled-tests.md) | Disallow disabled tests | ![recommended][] | | | [no-duplicate-hooks](docs/rules/no-duplicate-hooks.md) | Disallow duplicate setup and teardown hooks | | | diff --git a/src/__tests__/__snapshots__/rules.test.ts.snap b/src/__tests__/__snapshots__/rules.test.ts.snap index 21de3f8e6..7b68036c7 100644 --- a/src/__tests__/__snapshots__/rules.test.ts.snap +++ b/src/__tests__/__snapshots__/rules.test.ts.snap @@ -66,6 +66,7 @@ Object { "rules": Object { "jest/expect-expect": "warn", "jest/no-commented-out-tests": "warn", + "jest/no-conditional-expect": "error", "jest/no-deprecated-functions": "error", "jest/no-disabled-tests": "warn", "jest/no-export": "error", diff --git a/src/rules/no-conditional-expect.ts b/src/rules/no-conditional-expect.ts index 511a20dc5..2b9d91774 100644 --- a/src/rules/no-conditional-expect.ts +++ b/src/rules/no-conditional-expect.ts @@ -12,7 +12,7 @@ export default createRule({ docs: { description: 'Prevent calling `expect` conditionally', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { conditionalExpect: 'Avoid calling `expect` conditionally`',