Socket
Socket
Sign inDemoInstall

eslint-plugin-jest

Package Overview
Dependencies
Maintainers
11
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 26.1.4 to 26.1.5

2

docs/rules/no-conditional-expect.md

@@ -110,3 +110,3 @@ # Prevent calling `expect` conditionally (`no-conditional-expect`)

A better way to handle this situation is to introduce a wrapper to handle the
catching, and otherwise returns a specific "no error thrown" error if nothing is
catching, and otherwise return a specific "no error thrown" error if nothing is
thrown by the wrapped function:

@@ -113,0 +113,0 @@

@@ -40,4 +40,3 @@ # Disallow use of deprecated functions (`no-deprecated-functions`)

for type checkers to handle, and their use via `require` deprecated. Finally,
the release of Jest 26 saw them removed from the `require` function all
together.
the release of Jest 26 saw them removed from the `require` function altogether.

@@ -44,0 +43,0 @@ ### `jest.runTimersToTime`

@@ -10,3 +10,3 @@ # Disallow identical titles (`no-identical-title`)

This rule looks at the title of every test and test suites. It will report when
This rule looks at the title of every test and test suite. It will report when
two test suites or two test cases at the same level of a test suite have the

@@ -13,0 +13,0 @@ same title.

@@ -12,4 +12,4 @@ # Disallow Jasmine globals (`no-jasmine-globals`)

This rule reports on any usage of Jasmine globals which is not ported to Jest,
and suggests alternative from Jest's own API.
This rule reports on any usage of Jasmine globals, which is not ported to Jest,
and suggests alternatives from Jest's own API.

@@ -16,0 +16,0 @@ ### Default configuration

@@ -20,2 +20,2 @@ # Disallow importing Jest (`no-jest-import`)

\*[The Jest Object](https://facebook.github.io/jest/docs/en/jest-object.html)
- [The Jest Object](https://facebook.github.io/jest/docs/en/jest-object.html)

@@ -121,4 +121,4 @@ # disallow large snapshots (`no-large-snapshots`)

[External Snapshots](https://jestjs.io/docs/en/snapshot-testing#snapshot-testing-with-jest).
If only `maxSize` is provided on options, the value of `maxSize` will be used to
both snapshot types (Inline and External).
If only `maxSize` is provided on options, the value of `maxSize` will be used
for both snapshot types (Inline and External).

@@ -125,0 +125,0 @@ Since `eslint-disable` comments are not preserved by Jest when updating

@@ -64,3 +64,3 @@ # Disallow using `expect` outside of `it` or `test` blocks (`no-standalone-expect`)

\*Note that this rule will not trigger if the helper function is never used even
thought the `expect` will not execute. Rely on a rule like no-unused-vars for
though the `expect` will not execute. Rely on a rule like no-unused-vars for
this case.

@@ -67,0 +67,0 @@

# Suggest using the built-in comparison matchers (`prefer-comparison-matcher`)
Jest has a number of built-in matchers for comparing numbers which allow for
Jest has a number of built-in matchers for comparing numbers, which allow for
more readable tests and error messages if an expectation fails.

@@ -5,0 +5,0 @@

# Suggest using the built-in equality matchers (`prefer-equality-matcher`)
Jest has built-in matchers for expecting equality which allow for more readable
Jest has built-in matchers for expecting equality, which allow for more readable
tests and error messages if an expectation fails.

@@ -5,0 +5,0 @@

@@ -218,3 +218,3 @@ # Suggest using `expect.assertions()` OR `expect.hasAssertions()` (`prefer-expect-assertions`)

it.each([1, 2, 3])('returns ok', id => {
expect.assertions(3);
expect.assertions(1);

@@ -221,0 +221,0 @@ client.get(`/users/${id}`, response => {

# Suggest having hooks before any test cases (`prefer-hooks-on-top`)
While hooks can be setup anywhere in a test file, they are always called in a
specific order which means it can be confusing if they're intermixed with test
specific order, which means it can be confusing if they're intermixed with test
cases.

@@ -6,0 +6,0 @@

@@ -76,4 +76,4 @@ # Enforce lowercase test names (`prefer-lowercase-title`)

This array option allows specifying prefixes which contain capitals that titles
can start with. This can be useful when writing tests for api endpoints, where
This array option allows specifying prefixes, which contain capitals that titles
can start with. This can be useful when writing tests for API endpoints, where
you'd like to prefix with the HTTP method.

@@ -80,0 +80,0 @@

@@ -139,7 +139,7 @@ # Enforce valid `expect()` usage (`valid-expect`)

);
await Promise.all(
await Promise.all([
expect(Promise.resolve('hello')).resolves.toEqual('hello'),
expect(Promise.resolve('hi')).resolves.toEqual('hi'),
);
]);
});
```

@@ -140,2 +140,4 @@ "use strict";

inTestCaseCall = false;
if (node.arguments.length < 2) {

@@ -142,0 +144,0 @@ return;

{
"name": "eslint-plugin-jest",
"version": "26.1.4",
"version": "26.1.5",
"description": "ESLint rules for Jest",

@@ -114,3 +114,3 @@ "keywords": [

"eslint-plugin-prettier": "^3.4.1",
"eslint-remote-tester": "^2.1.0",
"eslint-remote-tester": "^2.1.3",
"eslint-remote-tester-repositories": "^0.0.5",

@@ -117,0 +117,0 @@ "husky": "^7.0.2",

@@ -62,2 +62,30 @@ <div align="center">

### Running rules only on test-related files
The rules provided by this plugin assume that the files they are checking are
test-related. This means it's generally not suitable to include them in your
top-level configuration as that applies to all files being linted which can
include source files.
You can use
[overrides](https://eslint.org/docs/user-guide/configuring/configuration-files#how-do-overrides-work)
to have ESLint apply additional rules to specific files:
```json
{
"extends": ["eslint:recommended"],
"overrides": [
{
"files": ["test/**"],
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"],
"rules": { "jest/prefer-expect-assertions": "off" }
}
],
"rules": {
"indent": ["error", 2]
}
}
```
### Jest `version` setting

@@ -215,4 +243,4 @@

the rules here will fallback to doing nothing if type information is not
available, meaning its safe to include them in shared configs that could be used
on JavaScript and TypeScript projects.
available, meaning it's safe to include them in shared configs that could be
used on JavaScript and TypeScript projects.

@@ -219,0 +247,0 @@ Also note that `unbound-method` depends on `@typescript-eslint/eslint-plugin`,

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