eslint-plugin-jest 27.1.7 β 27.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -210,58 +210,59 @@ set to warn in.\
|
|
|
210
210
|
π‘ Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\
|
|
211
211
|
β Deprecated.
|
|
212
212
|
|
|
213
|
-
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description
|
|
214
|
-
| :--------------------------------------------------------------------------- |
|
|
215
|
-
| [consistent-test-it](docs/rules/consistent-test-it.md) | Enforce `test` and `it` usage conventions
|
|
216
|
-
| [expect-expect](docs/rules/expect-expect.md) | Enforce assertion to be made in a test body
|
|
217
|
-
| [max-expects](docs/rules/max-expects.md) | Enforces a maximum number assertion calls in a test body
|
|
218
|
-
| [max-nested-describe](docs/rules/max-nested-describe.md) | Enforces a maximum depth to nested describe calls
|
|
219
|
-
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods
|
|
220
|
-
| [no-commented-out-tests](docs/rules/no-commented-out-tests.md) | Disallow commented out tests
|
|
221
|
-
| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Disallow calling `expect` conditionally
|
|
222
|
-
| [no-conditional-in-test](docs/rules/no-conditional-in-test.md) | Disallow conditional logic in tests
|
|
223
|
-
| [no-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions
|
|
224
|
-
| [no-disabled-tests](docs/rules/no-disabled-tests.md) | Disallow disabled tests
|
|
225
|
-
| [no-done-callback](docs/rules/no-done-callback.md) | Disallow using a callback in asynchronous tests and hooks
|
|
226
|
-
| [no-duplicate-hooks](docs/rules/no-duplicate-hooks.md) | Disallow duplicate setup and teardown hooks
|
|
227
|
-
| [no-export](docs/rules/no-export.md) | Disallow using `exports` in files containing tests
|
|
228
|
-
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests
|
|
229
|
-
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks
|
|
230
|
-
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles
|
|
231
|
-
| [no-if](docs/rules/no-if.md) | Disallow conditional logic
|
|
232
|
-
| [no-interpolation-in-snapshots](docs/rules/no-interpolation-in-snapshots.md) | Disallow string interpolation inside snapshots
|
|
233
|
-
| [no-jasmine-globals](docs/rules/no-jasmine-globals.md) | Disallow Jasmine globals
|
|
234
|
-
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | Disallow large snapshots
|
|
235
|
-
| [no-mocks-import](docs/rules/no-mocks-import.md) | Disallow manually importing from `__mocks__`
|
|
236
|
-
| [no-restricted-jest-methods](docs/rules/no-restricted-jest-methods.md) | Disallow specific `jest.` methods
|
|
237
|
-
| [no-restricted-matchers](docs/rules/no-restricted-matchers.md) | Disallow specific matchers & modifiers
|
|
238
|
-
| [no-standalone-expect](docs/rules/no-standalone-expect.md) | Disallow using `expect` outside of `it` or `test` blocks
|
|
239
|
-
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Require using `.only` and `.skip` over `f` and `x`
|
|
240
|
-
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests
|
|
241
|
-
| [
|
|
242
|
-
| [prefer-
|
|
243
|
-
| [prefer-
|
|
244
|
-
| [prefer-
|
|
245
|
-
| [prefer-
|
|
246
|
-
| [prefer-expect-
|
|
247
|
-
| [prefer-
|
|
248
|
-
| [prefer-hooks-
|
|
249
|
-
| [prefer-
|
|
250
|
-
| [prefer-
|
|
251
|
-
| [prefer-
|
|
252
|
-
| [prefer-
|
|
253
|
-
| [prefer-
|
|
254
|
-
| [prefer-
|
|
255
|
-
| [prefer-to-
|
|
256
|
-
| [prefer-to-
|
|
257
|
-
| [prefer-
|
|
258
|
-
| [
|
|
259
|
-
| [require-
|
|
260
|
-
| [require-
|
|
261
|
-
| [
|
|
262
|
-
| [valid-
|
|
263
|
-
| [valid-expect
|
|
264
|
-
| [valid-
|
|
213
|
+
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ | β οΈ | π§ | π‘ | β |
|
|
214
|
+
| :--------------------------------------------------------------------------- | :------------------------------------------------------------------------ | :-- | :-- | :-- | :-- | :-- |
|
|
215
|
+
| [consistent-test-it](docs/rules/consistent-test-it.md) | Enforce `test` and `it` usage conventions | | | π§ | | |
|
|
216
|
+
| [expect-expect](docs/rules/expect-expect.md) | Enforce assertion to be made in a test body | | β
| | | |
|
|
217
|
+
| [max-expects](docs/rules/max-expects.md) | Enforces a maximum number assertion calls in a test body | | | | | |
|
|
218
|
+
| [max-nested-describe](docs/rules/max-nested-describe.md) | Enforces a maximum depth to nested describe calls | | | | | |
|
|
219
|
+
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | β
| π¨ | π§ | | |
|
|
220
|
+
| [no-commented-out-tests](docs/rules/no-commented-out-tests.md) | Disallow commented out tests | | β
| | | |
|
|
221
|
+
| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Disallow calling `expect` conditionally | β
| | | | |
|
|
222
|
+
| [no-conditional-in-test](docs/rules/no-conditional-in-test.md) | Disallow conditional logic in tests | | | | | |
|
|
223
|
+
| [no-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions | β
| | π§ | | |
|
|
224
|
+
| [no-disabled-tests](docs/rules/no-disabled-tests.md) | Disallow disabled tests | | β
| | | |
|
|
225
|
+
| [no-done-callback](docs/rules/no-done-callback.md) | Disallow using a callback in asynchronous tests and hooks | β
| | | π‘ | |
|
|
226
|
+
| [no-duplicate-hooks](docs/rules/no-duplicate-hooks.md) | Disallow duplicate setup and teardown hooks | | | | | |
|
|
227
|
+
| [no-export](docs/rules/no-export.md) | Disallow using `exports` in files containing tests | β
| | | | |
|
|
228
|
+
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests | β
| | | π‘ | |
|
|
229
|
+
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks | | | | | |
|
|
230
|
+
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles | β
| | | | |
|
|
231
|
+
| [no-if](docs/rules/no-if.md) | Disallow conditional logic | | | | | β |
|
|
232
|
+
| [no-interpolation-in-snapshots](docs/rules/no-interpolation-in-snapshots.md) | Disallow string interpolation inside snapshots | β
| | | | |
|
|
233
|
+
| [no-jasmine-globals](docs/rules/no-jasmine-globals.md) | Disallow Jasmine globals | β
| | π§ | | |
|
|
234
|
+
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | Disallow large snapshots | | | | | |
|
|
235
|
+
| [no-mocks-import](docs/rules/no-mocks-import.md) | Disallow manually importing from `__mocks__` | β
| | | | |
|
|
236
|
+
| [no-restricted-jest-methods](docs/rules/no-restricted-jest-methods.md) | Disallow specific `jest.` methods | | | | | |
|
|
237
|
+
| [no-restricted-matchers](docs/rules/no-restricted-matchers.md) | Disallow specific matchers & modifiers | | | | | |
|
|
238
|
+
| [no-standalone-expect](docs/rules/no-standalone-expect.md) | Disallow using `expect` outside of `it` or `test` blocks | β
| | | | |
|
|
239
|
+
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Require using `.only` and `.skip` over `f` and `x` | β
| | π§ | | |
|
|
240
|
+
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | | | | |
|
|
241
|
+
| [no-untyped-mock-factory](docs/rules/no-untyped-mock-factory.md) | Disallow using `jest.mock()` factories without an explicit type parameter | | | π§ | | |
|
|
242
|
+
| [prefer-called-with](docs/rules/prefer-called-with.md) | Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()` | | | | | |
|
|
243
|
+
| [prefer-comparison-matcher](docs/rules/prefer-comparison-matcher.md) | Suggest using the built-in comparison matchers | | | π§ | | |
|
|
244
|
+
| [prefer-each](docs/rules/prefer-each.md) | Prefer using `.each` rather than manual loops | | | | | |
|
|
245
|
+
| [prefer-equality-matcher](docs/rules/prefer-equality-matcher.md) | Suggest using the built-in equality matchers | | | | π‘ | |
|
|
246
|
+
| [prefer-expect-assertions](docs/rules/prefer-expect-assertions.md) | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | | | π‘ | |
|
|
247
|
+
| [prefer-expect-resolves](docs/rules/prefer-expect-resolves.md) | Prefer `await expect(...).resolves` over `expect(await ...)` syntax | | | π§ | | |
|
|
248
|
+
| [prefer-hooks-in-order](docs/rules/prefer-hooks-in-order.md) | Prefer having hooks in a consistent order | | | | | |
|
|
249
|
+
| [prefer-hooks-on-top](docs/rules/prefer-hooks-on-top.md) | Suggest having hooks before any test cases | | | | | |
|
|
250
|
+
| [prefer-lowercase-title](docs/rules/prefer-lowercase-title.md) | Enforce lowercase test names | | | π§ | | |
|
|
251
|
+
| [prefer-mock-promise-shorthand](docs/rules/prefer-mock-promise-shorthand.md) | Prefer mock resolved/rejected shorthands for promises | | | π§ | | |
|
|
252
|
+
| [prefer-snapshot-hint](docs/rules/prefer-snapshot-hint.md) | Prefer including a hint with external snapshots | | | | | |
|
|
253
|
+
| [prefer-spy-on](docs/rules/prefer-spy-on.md) | Suggest using `jest.spyOn()` | | | π§ | | |
|
|
254
|
+
| [prefer-strict-equal](docs/rules/prefer-strict-equal.md) | Suggest using `toStrictEqual()` | | | | π‘ | |
|
|
255
|
+
| [prefer-to-be](docs/rules/prefer-to-be.md) | Suggest using `toBe()` for primitive literals | π¨ | | π§ | | |
|
|
256
|
+
| [prefer-to-contain](docs/rules/prefer-to-contain.md) | Suggest using `toContain()` | π¨ | | π§ | | |
|
|
257
|
+
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using `toHaveLength()` | π¨ | | π§ | | |
|
|
258
|
+
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | | π§ | | |
|
|
259
|
+
| [require-hook](docs/rules/require-hook.md) | Require setup and teardown code to be within a hook | | | | | |
|
|
260
|
+
| [require-to-throw-message](docs/rules/require-to-throw-message.md) | Require a message for `toThrow()` | | | | | |
|
|
261
|
+
| [require-top-level-describe](docs/rules/require-top-level-describe.md) | Require test cases and hooks to be inside a `describe` block | | | | | |
|
|
262
|
+
| [valid-describe-callback](docs/rules/valid-describe-callback.md) | Enforce valid `describe()` callback | β
| | | | |
|
|
263
|
+
| [valid-expect](docs/rules/valid-expect.md) | Enforce valid `expect()` usage | β
| | | | |
|
|
264
|
+
| [valid-expect-in-promise](docs/rules/valid-expect-in-promise.md) | Require promises that have expectations in their chain to be valid | β
| | | | |
|
|
265
|
+
| [valid-title](docs/rules/valid-title.md) | Enforce valid titles | β
| | π§ | | |
|
|
265
266
|
|
|
266
267
|
### Requires Type Checking
|
|
267
268
|
|
|
@@ -273,7 +274,7 @@ set to warn in.\
|
|
|
273
274
|
|
|
274
275
|
In order to use the rules powered by TypeScript type-checking, you must be using
|
|
275
276
|
`@typescript-eslint/parser` & adjust your eslint config as outlined
|
|
276
|
-
[here](https://typescript-eslint.io/
|
|
277
|
+
[here](https://typescript-eslint.io/linting/typed-linting).
|
|
277
278
|
|
|
278
279
|
Note that unlike the type-checking rules in `@typescript-eslint/eslint-plugin`,
|
|
279
280
|
the rules here will fallback to doing nothing if type information is not
|
package/docs/rules/no-if.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Disallow conditional logic (`no-if`)
|
|
2
2
|
|
|
3
3
|
β This rule is deprecated. It was replaced by
|
|
4
|
-
[`jest/no-conditional-in-test`](
|
|
4
|
+
[`jest/no-conditional-in-test`](no-conditional-in-test.md).
|
|
5
5
|
|
|
6
6
|
<!-- end auto-generated rule header -->
|
|
7
7
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Disallow using `jest.mock()` factories without an explicit type parameter (`no-untyped-mock-factory`)
|
|
2
|
+
|
|
3
|
+
π§ This rule is automatically fixable by the
|
|
4
|
+
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
5
|
+
|
|
6
|
+
<!-- end auto-generated rule header -->
|
|
7
|
+
|
|
8
|
+
By default, `jest.mock` and `jest.doMock` allow any type to be returned by a
|
|
9
|
+
mock factory. A generic type parameter can be used to enforce that the factory
|
|
10
|
+
returns an object with the same shape as the original module, or some other
|
|
11
|
+
strict type. Requiring a type makes it easier to use TypeScript to catch changes
|
|
12
|
+
needed in test mocks when the source module changes.
|
|
13
|
+
|
|
14
|
+
> **Warning**
|
|
15
|
+
>
|
|
16
|
+
> This rule expects to be run on TypeScript files **only**. If you are using a
|
|
17
|
+
> codebase that has a mix of JavaScript and TypeScript tests, you can use
|
|
18
|
+
> [overrides](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#how-do-overrides-work)
|
|
19
|
+
> to apply this rule to just your TypeScript test files.
|
|
20
|
+
|
|
21
|
+
## Rule details
|
|
22
|
+
|
|
23
|
+
This rule triggers a warning if `mock()` or `doMock()` is used without a generic
|
|
24
|
+
type parameter or return type.
|
|
25
|
+
|
|
26
|
+
The following patterns are considered errors:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
jest.mock('../moduleName', () => {
|
|
30
|
+
return jest.fn(() => 42);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
jest.mock('./module', () => ({
|
|
34
|
+
...jest.requireActual('./module'),
|
|
35
|
+
foo: jest.fn(),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
jest.mock('random-num', () => {
|
|
39
|
+
return jest.fn(() => 42);
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The following patterns are not considered errors:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
// Uses typeof import()
|
|
47
|
+
jest.mock<typeof import('../moduleName')>('../moduleName', () => {
|
|
48
|
+
return jest.fn(() => 42);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
jest.mock<typeof import('./module')>('./module', () => ({
|
|
52
|
+
...jest.requireActual('./module'),
|
|
53
|
+
foo: jest.fn(),
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
// Uses custom type
|
|
57
|
+
jest.mock<() => number>('random-num', () => {
|
|
58
|
+
return jest.fn(() => 42);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// No factory
|
|
62
|
+
jest.mock('random-num');
|
|
63
|
+
|
|
64
|
+
// Virtual mock
|
|
65
|
+
jest.mock(
|
|
66
|
+
'../moduleName',
|
|
67
|
+
() => {
|
|
68
|
+
return jest.fn(() => 42);
|
|
69
|
+
},
|
|
70
|
+
{ virtual: true },
|
|
71
|
+
);
|
|
72
|
+
```
|
package/lib/index.js
CHANGED
|
@@ -17,18 +17,9 @@ const importDefault = moduleName =>
|
|
|
17
17
|
interopRequireDefault(require(moduleName)).default;
|
|
18
18
|
const rulesDir = (0, _path.join)(__dirname, 'rules');
|
|
19
19
|
const excludedFiles = ['__tests__', 'detectJestVersion', 'utils'];
|
|
20
|
-
const rules = (0, _fs.readdirSync)(rulesDir).map(rule => (0, _path.parse)(rule).name).filter(rule => !excludedFiles.includes(rule)).
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}), {});
|
|
24
|
-
const recommendedRules = Object.entries(rules).filter(([, rule]) => rule.meta.docs.recommended).reduce((acc, [name, rule]) => ({
|
|
25
|
-
...acc,
|
|
26
|
-
[`jest/${name}`]: rule.meta.docs.recommended
|
|
27
|
-
}), {});
|
|
28
|
-
const allRules = Object.entries(rules).filter(([, rule]) => !rule.meta.deprecated).reduce((acc, [name]) => ({
|
|
29
|
-
...acc,
|
|
30
|
-
[`jest/${name}`]: 'error'
|
|
31
|
-
}), {});
|
|
20
|
+
const rules = Object.fromEntries((0, _fs.readdirSync)(rulesDir).map(rule => (0, _path.parse)(rule).name).filter(rule => !excludedFiles.includes(rule)).map(rule => [rule, importDefault((0, _path.join)(rulesDir, rule))]));
|
|
21
|
+
const recommendedRules = Object.fromEntries(Object.entries(rules).filter(([, rule]) => rule.meta.docs.recommended).map(([name, rule]) => [`jest/${name}`, rule.meta.docs.recommended]));
|
|
22
|
+
const allRules = Object.fromEntries(Object.entries(rules).filter(([, rule]) => !rule.meta.deprecated).map(([name]) => [`jest/${name}`, 'error']));
|
|
32
23
|
const createConfig = rules => ({
|
|
33
24
|
plugins: ['jest'],
|
|
34
25
|
env: {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _utils = require("@typescript-eslint/utils");
|
|
8
|
+
var _utils2 = require("./utils");
|
|
9
|
+
const findModuleName = node => {
|
|
10
|
+
if (node.type === _utils.AST_NODE_TYPES.Literal && typeof node.value === 'string') {
|
|
11
|
+
return node;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
var _default = (0, _utils2.createRule)({
|
|
16
|
+
name: __filename,
|
|
17
|
+
meta: {
|
|
18
|
+
docs: {
|
|
19
|
+
category: 'Best Practices',
|
|
20
|
+
description: 'Disallow using `jest.mock()` factories without an explicit type parameter',
|
|
21
|
+
recommended: false
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
addTypeParameterToModuleMock: 'Add a type parameter to the mock factory such as `typeof import({{ moduleName }})`'
|
|
25
|
+
},
|
|
26
|
+
fixable: 'code',
|
|
27
|
+
schema: [],
|
|
28
|
+
type: 'suggestion'
|
|
29
|
+
},
|
|
30
|
+
defaultOptions: [],
|
|
31
|
+
create(context) {
|
|
32
|
+
return {
|
|
33
|
+
CallExpression(node) {
|
|
34
|
+
const {
|
|
35
|
+
callee,
|
|
36
|
+
typeParameters
|
|
37
|
+
} = node;
|
|
38
|
+
if (callee.type !== _utils.AST_NODE_TYPES.MemberExpression) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const {
|
|
42
|
+
property
|
|
43
|
+
} = callee;
|
|
44
|
+
if (node.arguments.length === 2 && (0, _utils2.isTypeOfJestFnCall)(node, context, ['jest']) && (0, _utils2.isSupportedAccessor)(property) && ['mock', 'doMock'].includes((0, _utils2.getAccessorValue)(property))) {
|
|
45
|
+
const [nameNode, factoryNode] = node.arguments;
|
|
46
|
+
const hasTypeParameter = typeParameters !== undefined && typeParameters.params.length > 0;
|
|
47
|
+
const hasReturnType = (0, _utils2.isFunction)(factoryNode) && factoryNode.returnType !== undefined;
|
|
48
|
+
if (hasTypeParameter || hasReturnType) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const moduleName = findModuleName(nameNode);
|
|
52
|
+
context.report({
|
|
53
|
+
messageId: 'addTypeParameterToModuleMock',
|
|
54
|
+
data: {
|
|
55
|
+
moduleName: (moduleName === null || moduleName === void 0 ? void 0 : moduleName.raw) ?? './module-name'
|
|
56
|
+
},
|
|
57
|
+
node,
|
|
58
|
+
fix(fixer) {
|
|
59
|
+
if (!moduleName) return [];
|
|
60
|
+
return [fixer.insertTextAfter(callee, `<typeof import(${moduleName.raw})>`)];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
exports.default = _default;
|
|
@@ -50,7 +50,7 @@ const isPromiseMethodThatUsesValue = (node, identifier) => {
|
|
|
50
50
|
const nodeName = (0, _utils2.getNodeName)(node.argument);
|
|
51
51
|
if (['Promise.all', 'Promise.allSettled'].includes(nodeName)) {
|
|
52
52
|
const [firstArg] = node.argument.arguments;
|
|
53
|
-
if (firstArg.type === _utils.AST_NODE_TYPES.ArrayExpression && firstArg.elements.some(nod => (0, _utils2.isIdentifier)(nod, name))) {
|
|
53
|
+
if (firstArg.type === _utils.AST_NODE_TYPES.ArrayExpression && firstArg.elements.some(nod => nod && (0, _utils2.isIdentifier)(nod, name))) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -67,10 +67,10 @@ const isPromiseMethodThatUsesValue = (node, identifier) => {
|
|
|
67
67
|
*/
|
|
68
68
|
const isValueAwaitedInElements = (name, elements) => {
|
|
69
69
|
for (const element of elements) {
|
|
70
|
-
if (element.type === _utils.AST_NODE_TYPES.AwaitExpression && (0, _utils2.isIdentifier)(element.argument, name)) {
|
|
70
|
+
if ((element === null || element === void 0 ? void 0 : element.type) === _utils.AST_NODE_TYPES.AwaitExpression && (0, _utils2.isIdentifier)(element.argument, name)) {
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
|
-
if (element.type === _utils.AST_NODE_TYPES.ArrayExpression && isValueAwaitedInElements(name, element.elements)) {
|
|
73
|
+
if ((element === null || element === void 0 ? void 0 : element.type) === _utils.AST_NODE_TYPES.ArrayExpression && isValueAwaitedInElements(name, element.elements)) {
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "27.1
|
|
3
|
+
"version": "27.2.1",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"eslint-plugin-node": "^11.0.0",
|
|
129
129
|
"eslint-plugin-prettier": "^4.2.1",
|
|
130
130
|
"eslint-remote-tester": "^3.0.0",
|
|
131
|
-
"eslint-remote-tester-repositories": "~0.0
|
|
131
|
+
"eslint-remote-tester-repositories": "~1.0.0",
|
|
132
132
|
"husky": "^8.0.1",
|
|
133
133
|
"is-ci": "^3.0.0",
|
|
134
134
|
"jest": "^29.0.0",
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"optional": true
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
-
"packageManager": "yarn@3.3.
|
|
158
|
+
"packageManager": "yarn@3.3.1",
|
|
159
159
|
"engines": {
|
|
160
160
|
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
|
161
161
|
}
|