Socket
Socket
Sign inDemoInstall

eslint-plugin-jest

Package Overview
Dependencies
Maintainers
10
Versions
325
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jest - npm Package Compare versions

Comparing version 23.10.0 to 23.11.0

docs/rules/no-restricted-matchers.md

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [23.11.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.10.0...v23.11.0) (2020-05-12)
### Features
* create `no-restricted-matchers` rule ([#575](https://github.com/jest-community/eslint-plugin-jest/issues/575)) ([ac926e7](https://github.com/jest-community/eslint-plugin-jest/commit/ac926e779958240506ee506047c9a5364bb70aea))
# [23.10.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.9.0...v23.10.0) (2020-05-09)

@@ -2,0 +9,0 @@

2

docs/rules/consistent-test-it.md

@@ -1,2 +0,2 @@

# Have control over `test` and `it` usages (consistent-test-it)
# Have control over `test` and `it` usages (`consistent-test-it`)

@@ -3,0 +3,0 @@ Jest allows you to choose how you want to define your tests, using the `it` or

@@ -1,2 +0,2 @@

# Enforce assertion to be made in a test body (expect-expect)
# Enforce assertion to be made in a test body (`expect-expect`)

@@ -3,0 +3,0 @@ Ensure that there is at least one `expect` call made in a test.

@@ -1,2 +0,2 @@

# Enforce lowercase test names (lowercase-name)
# Enforce lowercase test names (`lowercase-name`)

@@ -3,0 +3,0 @@ ## Rule details

@@ -1,2 +0,2 @@

# Don't use alias methods (no-alias-methods)
# Don't use alias methods (`no-alias-methods`)

@@ -3,0 +3,0 @@ Several Jest methods have alias names, such as `toThrow` having the alias of

@@ -1,2 +0,2 @@

# Disallow commented out tests (no-commented-out-tests)
# Disallow commented out tests (`no-commented-out-tests`)

@@ -3,0 +3,0 @@ This rule raises a warning about commented out tests. It's similar to

@@ -1,2 +0,2 @@

# Disallow disabled tests (no-disabled-tests)
# Disallow disabled tests (`no-disabled-tests`)

@@ -3,0 +3,0 @@ Jest has a feature that allows you to temporarily mark tests as disabled. This

@@ -1,2 +0,2 @@

# Disallow duplicate setup and teardown hooks (no-duplicate-hooks)
# Disallow duplicate setup and teardown hooks (`no-duplicate-hooks`)

@@ -3,0 +3,0 @@ A describe block should not contain duplicate hooks.

@@ -1,2 +0,2 @@

# Avoid using `expect().resolves` (no-expect-resolves)
# Avoid using `expect().resolves` (`no-expect-resolves`)

@@ -3,0 +3,0 @@ Jest allows you to test a promise resolve value using `await expect().resolves`.

@@ -1,2 +0,2 @@

# no export from test file (no-export)
# Prevent exporting from test files (`no-export`)

@@ -3,0 +3,0 @@ Prevents exports from test files. If a file has at least 1 test in it, then this

@@ -1,2 +0,2 @@

# Disallow focused tests (no-focused-tests)
# Disallow focused tests (`no-focused-tests`)

@@ -3,0 +3,0 @@ Jest has a feature that allows you to focus tests by appending `.only` or

@@ -1,2 +0,2 @@

# Disallow setup and teardown hooks (no-hooks)
# Disallow setup and teardown hooks (`no-hooks`)

@@ -3,0 +3,0 @@ Jest provides global functions for setup and teardown tasks, which are called

@@ -1,2 +0,2 @@

# Disallow identical titles (no-identical-title)
# Disallow identical titles (`no-identical-title`)

@@ -3,0 +3,0 @@ Having identical titles for two different tests or test suites may create

@@ -1,2 +0,2 @@

# Disallow conditional logic. (no-if)
# Disallow conditional logic (`no-if`)

@@ -3,0 +3,0 @@ Conditional logic in tests is usually an indication that a test is attempting to

@@ -1,2 +0,2 @@

# Disallow Jasmine globals
# Disallow Jasmine globals (`no-jasmine-globals`)

@@ -3,0 +3,0 @@ `jest` uses `jasmine` as a test runner. A side effect of this is that both a

@@ -1,2 +0,2 @@

# Disallow importing Jest(no-jest-import)
# Disallow importing Jest (`no-jest-import`)

@@ -3,0 +3,0 @@ The `jest` object is automatically in scope within every test file. The methods

@@ -1,2 +0,2 @@

# disallow large snapshots (no-large-snapshots)
# disallow large snapshots (`no-large-snapshots`)

@@ -3,0 +3,0 @@ When using Jest's snapshot capability one should be mindful of the size of

@@ -1,2 +0,2 @@

# Disallow manually importing from `__mocks__` (no-mocks-import)
# Disallow manually importing from `__mocks__` (`no-mocks-import`)

@@ -3,0 +3,0 @@ When using `jest.mock`, your tests (just like the code being tested) should

@@ -1,2 +0,2 @@

# No standalone expect in a describe block (no-standalone-expect)
# No standalone expect in a describe block (`no-standalone-expect`)

@@ -3,0 +3,0 @@ Prevents `expect` statements outside of a `test` or `it` block. An `expect`

@@ -1,2 +0,2 @@

# Avoid using a callback in asynchronous tests (no-test-callback)
# Avoid using a callback in asynchronous tests (`no-test-callback`)

@@ -3,0 +3,0 @@ Jest allows you to pass a callback to test definitions, typically called `done`,

@@ -1,2 +0,2 @@

# Use `.only` and `.skip` over `f` and `x` (no-test-prefixes)
# Use `.only` and `.skip` over `f` and `x` (`no-test-prefixes`)

@@ -3,0 +3,0 @@ Jest allows you to choose how you want to define focused and skipped tests, with

@@ -1,2 +0,2 @@

# Disallow explicitly returning from tests (no-test-return-statement)
# Disallow explicitly returning from tests (`no-test-return-statement`)

@@ -3,0 +3,0 @@ Tests in Jest should be void and not return values.

@@ -1,2 +0,2 @@

# Disallow using `toBeTruthy()` & `toBeFalsy()` (no-truthy-falsy)
# Disallow using `toBeTruthy()` & `toBeFalsy()` (`no-truthy-falsy`)

@@ -3,0 +3,0 @@ Tests against boolean values should assert true or false. Asserting `toBeTruthy`

@@ -1,2 +0,2 @@

# Prevent catch assertions in tests (no-try-expect)
# Prevent catch assertions in tests (`no-try-expect`)

@@ -3,0 +3,0 @@ This rule prevents the use of `expect` inside `catch` blocks.

@@ -1,2 +0,2 @@

# Suggest using `toBeCalledWith` OR `toHaveBeenCalledWith` (prefer-called-with)
# Suggest using `toBeCalledWith` OR `toHaveBeenCalledWith` (`prefer-called-with`)

@@ -3,0 +3,0 @@ The `toBeCalled()` matcher is used to assert that a mock function has been

@@ -1,2 +0,2 @@

# Suggest using `expect.assertions()` OR `expect.hasAssertions()` (prefer-expect-assertions)
# Suggest using `expect.assertions()` OR `expect.hasAssertions()` (`prefer-expect-assertions`)

@@ -3,0 +3,0 @@ Ensure every test to have either `expect.assertions(<number of assertions>)` OR

@@ -1,2 +0,2 @@

# Suggest to have all hooks at top-level before tests (prefer-hooks-on-top)
# Suggest to have all hooks at top-level before tests (`prefer-hooks-on-top`)

@@ -3,0 +3,0 @@ All hooks should be defined before the start of the tests

@@ -1,2 +0,2 @@

# Suggest using inline snapshots (prefer-inline-snapshots)
# Suggest using inline snapshots (`prefer-inline-snapshots`)

@@ -3,0 +3,0 @@ In order to make snapshot tests more managable and reviewable

@@ -1,2 +0,2 @@

# Suggest using `jest.spyOn()` (prefer-spy-on)
# Suggest using `jest.spyOn()` (`prefer-spy-on`)

@@ -3,0 +3,0 @@ When mocking a function by overwriting a property you have to manually restore

@@ -1,2 +0,2 @@

# Suggest using `toStrictEqual()` (prefer-strict-equal)
# Suggest using `toStrictEqual()` (`prefer-strict-equal`)

@@ -3,0 +3,0 @@ `toStrictEqual` not only checks that two objects contain the same data but also

@@ -1,2 +0,2 @@

# Suggest using `toBeNull()` (prefer-to-be-null)
# Suggest using `toBeNull()` (`prefer-to-be-null`)

@@ -3,0 +3,0 @@ In order to have a better failure message, `toBeNull()` should be used upon

@@ -1,2 +0,2 @@

# Suggest using `toBeUndefined()` (prefer-to-be-undefined)
# Suggest using `toBeUndefined()` (`prefer-to-be-undefined`)

@@ -3,0 +3,0 @@ In order to have a better failure message, `toBeUndefined()` should be used upon

@@ -1,2 +0,2 @@

# Suggest using `toContain()` (prefer-to-contain)
# Suggest using `toContain()` (`prefer-to-contain`)

@@ -3,0 +3,0 @@ In order to have a better failure message, `toContain()` should be used upon

@@ -1,2 +0,2 @@

# Suggest using `toHaveLength()` (prefer-to-have-length)
# Suggest using `toHaveLength()` (`prefer-to-have-length`)

@@ -3,0 +3,0 @@ In order to have a better failure message, `toHaveLength()` should be used upon

@@ -1,2 +0,2 @@

# Suggest using `test.todo` (prefer-todo)
# Suggest using `test.todo` (`prefer-todo`)

@@ -3,0 +3,0 @@ When test cases are empty then it is better to mark them as `test.todo` as it

@@ -1,2 +0,2 @@

# Require a message for `toThrow()` (require-to-throw-message)
# Require a message for `toThrow()` (`require-to-throw-message`)

@@ -3,0 +3,0 @@ `toThrow()`, and its alias `toThrowError()`, are used to check if an error is

@@ -1,2 +0,2 @@

# Require top-level describe block (require-top-level-describe)
# Require top-level describe block (`require-top-level-describe`)

@@ -3,0 +3,0 @@ Jest allows you to organise your test files the way you want it. However, the

@@ -1,2 +0,2 @@

# Enforce valid `describe()` callback (valid-describe)
# Enforce valid `describe()` callback (`valid-describe`)

@@ -3,0 +3,0 @@ Using an improper `describe()` callback function can lead to unexpected test

@@ -1,2 +0,2 @@

# Enforce having return statement when testing with promises (valid-expect-in-promise)
# Enforce having return statement when testing with promises (`valid-expect-in-promise`)

@@ -3,0 +3,0 @@ Ensure to return promise when having assertions in `then` or `catch` block of

@@ -1,2 +0,2 @@

# Enforce valid `expect()` usage (valid-expect)
# Enforce valid `expect()` usage (`valid-expect`)

@@ -3,0 +3,0 @@ Ensure `expect()` is called with a single argument and there is an actual

@@ -1,2 +0,2 @@

# describe/test titles should be valid (valid-title)
# describe/test titles should be valid (`valid-title`)

@@ -3,0 +3,0 @@ Checks that the title of Jest blocks are valid by ensuring that titles are:

@@ -37,3 +37,3 @@ "use strict";

docs: {
description: 'Enforce `it`, `test` and `describe` to have descriptions that begin with a lowercase letter. This provides more readable test failures.',
description: 'Enforce lowercase test names',
category: 'Best Practices',

@@ -40,0 +40,0 @@ recommended: false

@@ -19,3 +19,3 @@ "use strict";

category: 'Best Practices',
description: "This rule raises a warning about commented out tests. It's similar to no-disabled-tests rule.",
description: 'Disallow commented out tests',
recommended: false

@@ -22,0 +22,0 @@ },

@@ -17,3 +17,3 @@ "use strict";

category: 'Best Practices',
description: 'Prevents exports from test files. If a file has at least 1 test in it, then this rule will prevent exports.',
description: 'Prevent exporting from test files',
recommended: false

@@ -20,0 +20,0 @@ },

@@ -15,3 +15,3 @@ "use strict";

docs: {
description: "The `jest` object is automatically in scope within every test file. The methods in the `jest` object help create mocks and let you control Jest's overall behavior. It is therefore completely unnecessary to import in `jest`, as Jest doesn't export anything in the first place.",
description: 'Disallow importing Jest',
category: 'Best Practices',

@@ -18,0 +18,0 @@ recommended: 'error'

@@ -24,3 +24,3 @@ "use strict";

category: 'Best Practices',
description: 'When using `jest.mock`, your tests (just like the code being tested) should import from `./x`, not `./__mocks__/x`. Not following this rule can lead to confusion, because you will have multiple instances of the mocked module',
description: 'Disallow manually importing from __mocks__ ',
recommended: 'error'

@@ -27,0 +27,0 @@ },

@@ -27,3 +27,3 @@ "use strict";

category: 'Possible Errors',
description: 'Using an improper `describe()` callback function can lead to unexpected test errors.',
description: 'Enforce valid `describe()` callback',
recommended: 'warn'

@@ -30,0 +30,0 @@ },

{
"name": "eslint-plugin-jest",
"version": "23.10.0",
"version": "23.11.0",
"description": "Eslint rules for Jest",
"repository": "jest-community/eslint-plugin-jest",
"license": "MIT",
"keywords": [

@@ -12,2 +10,4 @@ "eslint",

],
"repository": "jest-community/eslint-plugin-jest",
"license": "MIT",
"author": {

@@ -18,2 +18,3 @@ "name": "Jonathan Kim",

},
"main": "lib/",
"files": [

@@ -23,63 +24,25 @@ "docs/",

],
"main": "lib/",
"engines": {
"node": ">=8"
},
"peerDependencies": {
"eslint": ">=5"
},
"scripts": {
"build": "babel --extensions .js,.ts src --out-dir lib --copy-files",
"postbuild": "rimraf lib/__tests__ lib/**/__tests__",
"lint": "eslint . --ignore-pattern '!.eslintrc.js' --ext js,ts",
"prepare": "yarn build && yarn postbuild",
"lint": "eslint . --ignore-pattern '!.eslintrc.js' --ext js,ts",
"prepublishOnly": "yarn build",
"prettylint": "prettylint docs/**/*.md README.md package.json",
"prepublishOnly": "yarn build",
"pretest": "yarn build",
"test": "jest",
"build": "babel --extensions .js,.ts src --out-dir lib --copy-files",
"postbuild": "rimraf lib/__tests__ lib/**/__tests__",
"tools:generate-rules-table": "ts-node -T tools/generate-rules-table",
"typecheck": "tsc -p ."
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^2.5.0"
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-typescript": "^7.3.3",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@schemastore/package": "^0.0.5",
"@semantic-release/changelog": "^3.0.5",
"@semantic-release/git": "^7.0.17",
"@types/eslint": "^6.1.3",
"@types/jest": "^25.1.0",
"@types/node": "^12.6.6",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"babel-jest": "^25.2.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"eslint": "^5.1.0 || ^6.0.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-eslint-plugin": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"husky": "^3.0.9",
"jest": "^25.2.0",
"jest-runner-eslint": "^0.7.1",
"lint-staged": "^9.4.2",
"prettier": "^1.19.1",
"prettylint": "^1.0.0",
"resolve-from": "^5.0.0",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.28",
"typescript": "^3.5.3"
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"prettier": {
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all"
},
"lint-staged": {

@@ -95,2 +58,7 @@ "*.{js,ts}": [

},
"prettier": {
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all"
},
"jest": {

@@ -125,13 +93,47 @@ "coverageThreshold": {

},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
"dependencies": {
"@typescript-eslint/experimental-utils": "^2.5.0"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-typescript": "^7.3.3",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@schemastore/package": "^0.0.5",
"@semantic-release/changelog": "^3.0.5",
"@semantic-release/git": "^7.0.17",
"@types/eslint": "^6.1.3",
"@types/jest": "^25.1.0",
"@types/node": "^12.6.6",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"babel-jest": "^25.2.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"eslint": "^5.1.0 || ^6.0.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-eslint-plugin": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"husky": "^3.0.9",
"jest": "^25.2.0",
"jest-runner-eslint": "^0.8.0",
"lint-staged": "^9.4.2",
"prettier": "^1.19.1",
"prettylint": "^1.0.0",
"resolve-from": "^5.0.0",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.28",
"ts-node": "^8.10.1",
"typescript": "^3.5.3"
},
"peerDependencies": {
"eslint": ">=5"
},
"engines": {
"node": ">=8"
},
"release": {

@@ -138,0 +140,0 @@ "plugins": [

@@ -128,46 +128,51 @@ <div align="center">

| Rule | Description | Configurations | Fixable |
| ------------------------------ | ----------------------------------------------------------------- | ---------------- | ------------------- |
| [consistent-test-it][] | Enforce consistent test or it keyword | | ![fixable-green][] |
| [expect-expect][] | Enforce assertion to be made in a test body | ![recommended][] | |
| [lowercase-name][] | Disallow capitalized test names | | ![fixable-green][] |
| [no-alias-methods][] | Disallow alias methods | ![style][] | ![fixable-green][] |
| [no-commented-out-tests][] | Disallow commented out tests | ![recommended][] | |
| [no-deprecated-functions][] | Disallow use of deprecated functions | | ![fixable-green][] |
| [no-disabled-tests][] | Disallow disabled tests | ![recommended][] | |
| [no-duplicate-hooks][] | Disallow duplicate hooks within a `describe` block | | |
| [no-expect-resolves][] | Disallow using `expect().resolves` | | |
| [no-export][] | Disallow export from test files | ![recommended][] | |
| [no-focused-tests][] | Disallow focused tests | ![recommended][] | |
| [no-hooks][] | Disallow setup and teardown hooks | | |
| [no-identical-title][] | Disallow identical titles | ![recommended][] | |
| [no-if][] | Disallow conditional logic | | |
| [no-jasmine-globals][] | Disallow Jasmine globals | ![recommended][] | ![fixable-yellow][] |
| [no-jest-import][] | Disallow importing `jest` | ![recommended][] | |
| [no-large-snapshots][] | Disallow large snapshots | | |
| [no-mocks-import][] | Disallow manually importing from `__mocks__` | ![recommended][] | |
| [no-standalone-expect][] | Prevents `expect` statements outside of a `test` or `it` block | ![recommended][] | |
| [no-test-callback][] | Using a callback in asynchronous tests | ![recommended][] | ![fixable-green][] |
| [no-test-prefixes][] | Disallow using `f` & `x` prefixes to define focused/skipped tests | ![recommended][] | ![fixable-green][] |
| [no-test-return-statement][] | Disallow explicitly returning from tests | | |
| [no-truthy-falsy][] | Disallow using `toBeTruthy()` & `toBeFalsy()` | | |
| [no-try-expect][] | Prevent `catch` assertions in tests | ![recommended][] | |
| [prefer-called-with][] | Suggest using `toBeCalledWith()` OR `toHaveBeenCalledWith()` | | |
| [prefer-expect-assertions][] | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | |
| [prefer-hooks-on-top][] | Suggest to have all hooks at top-level before tests | | |
| [prefer-inline-snapshots][] | Suggest using `toMatchInlineSnapshot()` | | ![fixable-green][] |
| [prefer-spy-on][] | Suggest using `jest.spyOn()` | | ![fixable-green][] |
| [prefer-strict-equal][] | Suggest using `toStrictEqual()` | | ![fixable-green][] |
| [prefer-to-be-null][] | Suggest using `toBeNull()` | ![style][] | ![fixable-green][] |
| [prefer-to-be-undefined][] | Suggest using `toBeUndefined()` | ![style][] | ![fixable-green][] |
| [prefer-to-contain][] | Suggest using `toContain()` | ![style][] | ![fixable-green][] |
| [prefer-to-have-length][] | Suggest using `toHaveLength()` | ![style][] | ![fixable-green][] |
| [prefer-todo][] | Suggest using `test.todo()` | | ![fixable-green][] |
| [require-top-level-describe][] | Require a top-level `describe` block | | |
| [require-to-throw-message][] | Require that `toThrow()` and `toThrowError` includes a message | | |
| [valid-describe][] | Enforce valid `describe()` callback | ![recommended][] | |
| [valid-expect-in-promise][] | Enforce having return statement when testing with promises | ![recommended][] | |
| [valid-expect][] | Enforce valid `expect()` usage | ![recommended][] | |
| [valid-title][] | Enforce valid titles for jest blocks | | |
<!-- begin rules list -->
| Rule | Description | Configurations | Fixable |
| ---------------------------------------------------------------------- | --------------------------------------------------------------- | ---------------- | ------------ |
| [consistent-test-it](docs/rules/consistent-test-it.md) | Have control over `test` and `it` usages | | ![fixable][] |
| [expect-expect](docs/rules/expect-expect.md) | Enforce assertion to be made in a test body | ![recommended][] | |
| [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-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions | | ![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 | | |
| [no-expect-resolves](docs/rules/no-expect-resolves.md) | Disallow expect.resolves | | |
| [no-export](docs/rules/no-export.md) | Prevent exporting from test files | ![recommended][] | |
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests | ![recommended][] | ![fixable][] |
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks | | |
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles | ![recommended][] | |
| [no-if](docs/rules/no-if.md) | Disallow conditional logic | | |
| [no-jasmine-globals](docs/rules/no-jasmine-globals.md) | Disallow Jasmine globals | ![recommended][] | ![fixable][] |
| [no-jest-import](docs/rules/no-jest-import.md) | Disallow importing Jest | ![recommended][] | |
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | disallow large snapshots | | |
| [no-mocks-import](docs/rules/no-mocks-import.md) | Disallow manually importing from **mocks** | ![recommended][] | |
| [no-restricted-matchers](docs/rules/no-restricted-matchers.md) | Disallow specific matchers & modifiers | | |
| [no-standalone-expect](docs/rules/no-standalone-expect.md) | Prevents expects that are outside of an it or test block. | ![recommended][] | |
| [no-test-callback](docs/rules/no-test-callback.md) | Avoid using a callback in asynchronous tests | ![recommended][] | ![fixable][] |
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Use `.only` and `.skip` over `f` and `x` | ![recommended][] | ![fixable][] |
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | |
| [no-truthy-falsy](docs/rules/no-truthy-falsy.md) | Disallow using `toBeTruthy()` & `toBeFalsy()` | | |
| [no-try-expect](docs/rules/no-try-expect.md) | Prefer using toThrow for exception tests | ![recommended][] | |
| [prefer-called-with](docs/rules/prefer-called-with.md) | Suggest using `toBeCalledWith()` OR `toHaveBeenCalledWith()` | | |
| [prefer-expect-assertions](docs/rules/prefer-expect-assertions.md) | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | |
| [prefer-hooks-on-top](docs/rules/prefer-hooks-on-top.md) | Suggest to have all hooks at top level | | |
| [prefer-inline-snapshots](docs/rules/prefer-inline-snapshots.md) | Suggest using inline snapshots | | ![fixable][] |
| [prefer-spy-on](docs/rules/prefer-spy-on.md) | Suggest using `jest.spyOn()` | | ![fixable][] |
| [prefer-strict-equal](docs/rules/prefer-strict-equal.md) | Suggest using toStrictEqual() | | ![fixable][] |
| [prefer-to-be-null](docs/rules/prefer-to-be-null.md) | Suggest using `toBeNull()` | ![style][] | ![fixable][] |
| [prefer-to-be-undefined](docs/rules/prefer-to-be-undefined.md) | Suggest using `toBeUndefined()` | ![style][] | ![fixable][] |
| [prefer-to-contain](docs/rules/prefer-to-contain.md) | Suggest using `toContain()` | ![style][] | ![fixable][] |
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using `toHaveLength()` | ![style][] | ![fixable][] |
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | ![fixable][] |
| [require-to-throw-message](docs/rules/require-to-throw-message.md) | Require a message for `toThrow()` | | |
| [require-top-level-describe](docs/rules/require-top-level-describe.md) | Prevents test cases and hooks to be outside of a describe block | | |
| [valid-describe](docs/rules/valid-describe.md) | Enforce valid `describe()` callback | ![recommended][] | |
| [valid-expect](docs/rules/valid-expect.md) | Enforce valid `expect()` usage | ![recommended][] | |
| [valid-expect-in-promise](docs/rules/valid-expect-in-promise.md) | Enforce having return statement when testing with promises | ![recommended][] | |
| [valid-title](docs/rules/valid-title.md) | Enforce valid titles | | ![fixable][] |
<!-- end rules list -->
## Credit

@@ -187,46 +192,4 @@

[consistent-test-it]: docs/rules/consistent-test-it.md
[expect-expect]: docs/rules/expect-expect.md
[lowercase-name]: docs/rules/lowercase-name.md
[no-alias-methods]: docs/rules/no-alias-methods.md
[no-commented-out-tests]: docs/rules/no-commented-out-tests.md
[no-deprecated-functions]: docs/rules/no-deprecated-functions.md
[no-disabled-tests]: docs/rules/no-disabled-tests.md
[no-duplicate-hooks]: docs/rules/no-duplicate-hooks.md
[no-expect-resolves]: docs/rules/no-expect-resolves.md
[no-export]: docs/rules/no-export.md
[no-focused-tests]: docs/rules/no-focused-tests.md
[no-hooks]: docs/rules/no-hooks.md
[no-identical-title]: docs/rules/no-identical-title.md
[no-if]: docs/rules/no-if.md
[no-jasmine-globals]: docs/rules/no-jasmine-globals.md
[no-jest-import]: docs/rules/no-jest-import.md
[no-large-snapshots]: docs/rules/no-large-snapshots.md
[no-mocks-import]: docs/rules/no-mocks-import.md
[no-standalone-expect]: docs/rules/no-standalone-expect.md
[no-test-callback]: docs/rules/no-test-callback.md
[no-test-prefixes]: docs/rules/no-test-prefixes.md
[no-test-return-statement]: docs/rules/no-test-return-statement.md
[no-truthy-falsy]: docs/rules/no-truthy-falsy.md
[no-try-expect]: docs/rules/no-try-expect.md
[prefer-called-with]: docs/rules/prefer-called-with.md
[prefer-expect-assertions]: docs/rules/prefer-expect-assertions.md
[prefer-inline-snapshots]: docs/rules/prefer-inline-snapshots.md
[prefer-hooks-on-top]: docs/rules/prefer-hooks-on-top.md
[prefer-spy-on]: docs/rules/prefer-spy-on.md
[prefer-strict-equal]: docs/rules/prefer-strict-equal.md
[prefer-to-be-null]: docs/rules/prefer-to-be-null.md
[prefer-to-be-undefined]: docs/rules/prefer-to-be-undefined.md
[prefer-to-contain]: docs/rules/prefer-to-contain.md
[prefer-to-have-length]: docs/rules/prefer-to-have-length.md
[prefer-todo]: docs/rules/prefer-todo.md
[require-top-level-describe]: docs/rules/require-top-level-describe.md
[require-to-throw-message]: docs/rules/require-to-throw-message.md
[valid-describe]: docs/rules/valid-describe.md
[valid-expect-in-promise]: docs/rules/valid-expect-in-promise.md
[valid-expect]: docs/rules/valid-expect.md
[valid-title]: docs/rules/valid-title.md
[fixable-green]: https://img.shields.io/badge/-fixable-green.svg
[fixable-yellow]: https://img.shields.io/badge/-fixable-yellow.svg
[recommended]: https://img.shields.io/badge/-recommended-lightgrey.svg
[fixable]: https://img.shields.io/badge/-fixable-green.svg
[style]: https://img.shields.io/badge/-style-blue.svg
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc