eslint-plugin-jest 27.2.2 → 27.2.3
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/lib/rules/no-deprecated-functions.js +2 -2
- package/package.json +6 -6
- package/lib/processors/__tests__/snapshot-processor.test.js +0 -36
- package/lib/rules/__tests__/consistent-test-it.test.js +0 -921
- package/lib/rules/__tests__/expect-expect.test.js +0 -347
- package/lib/rules/__tests__/fixtures/class.ts +0 -13
- package/lib/rules/__tests__/fixtures/file.ts +0 -0
- package/lib/rules/__tests__/fixtures/foo.ts +0 -1
- package/lib/rules/__tests__/fixtures/indent/indent-invalid-fixture-1.js +0 -530
- package/lib/rules/__tests__/fixtures/indent/indent-valid-fixture-1.js +0 -530
- package/lib/rules/__tests__/fixtures/react.tsx +0 -0
- package/lib/rules/__tests__/fixtures/tsconfig-withmeta.json +0 -6
- package/lib/rules/__tests__/fixtures/tsconfig.json +0 -16
- package/lib/rules/__tests__/fixtures/unstrict/file.ts +0 -0
- package/lib/rules/__tests__/fixtures/unstrict/react.tsx +0 -0
- package/lib/rules/__tests__/fixtures/unstrict/tsconfig.json +0 -15
- package/lib/rules/__tests__/max-expects.test.js +0 -330
- package/lib/rules/__tests__/max-nested-describe.test.js +0 -247
- package/lib/rules/__tests__/no-alias-methods.test.js +0 -190
- package/lib/rules/__tests__/no-commented-out-tests.test.js +0 -213
- package/lib/rules/__tests__/no-conditional-expect.test.js +0 -696
- package/lib/rules/__tests__/no-conditional-in-test.test.js +0 -777
- package/lib/rules/__tests__/no-deprecated-functions.test.js +0 -119
- package/lib/rules/__tests__/no-disabled-tests.test.js +0 -241
- package/lib/rules/__tests__/no-done-callback.test.js +0 -424
- package/lib/rules/__tests__/no-duplicate-hooks.test.js +0 -469
- package/lib/rules/__tests__/no-export.test.js +0 -107
- package/lib/rules/__tests__/no-focused-tests.test.js +0 -373
- package/lib/rules/__tests__/no-hooks.test.js +0 -90
- package/lib/rules/__tests__/no-identical-title.test.js +0 -270
- package/lib/rules/__tests__/no-if.test.js +0 -787
- package/lib/rules/__tests__/no-interpolation-in-snapshots.test.js +0 -58
- package/lib/rules/__tests__/no-jasmine-globals.test.js +0 -206
- package/lib/rules/__tests__/no-large-snapshots.test.js +0 -237
- package/lib/rules/__tests__/no-mocks-import.test.js +0 -73
- package/lib/rules/__tests__/no-restricted-jest-methods.test.js +0 -103
- package/lib/rules/__tests__/no-restricted-matchers.test.js +0 -244
- package/lib/rules/__tests__/no-standalone-expect.test.js +0 -230
- package/lib/rules/__tests__/no-test-prefixes.test.js +0 -206
- package/lib/rules/__tests__/no-test-return-statement.test.js +0 -122
- package/lib/rules/__tests__/no-untyped-mock-factory.test.js +0 -149
- package/lib/rules/__tests__/prefer-called-with.test.js +0 -40
- package/lib/rules/__tests__/prefer-comparison-matcher.test.js +0 -200
- package/lib/rules/__tests__/prefer-each.test.js +0 -295
- package/lib/rules/__tests__/prefer-equality-matcher.test.js +0 -184
- package/lib/rules/__tests__/prefer-expect-assertions.test.js +0 -1437
- package/lib/rules/__tests__/prefer-expect-resolves.test.js +0 -96
- package/lib/rules/__tests__/prefer-hooks-in-order.test.js +0 -678
- package/lib/rules/__tests__/prefer-hooks-on-top.test.js +0 -218
- package/lib/rules/__tests__/prefer-lowercase-title.test.js +0 -619
- package/lib/rules/__tests__/prefer-mock-promise-shorthand.test.js +0 -360
- package/lib/rules/__tests__/prefer-snapshot-hint.test.js +0 -784
- package/lib/rules/__tests__/prefer-spy-on.test.js +0 -100
- package/lib/rules/__tests__/prefer-strict-equal.test.js +0 -46
- package/lib/rules/__tests__/prefer-to-be.test.js +0 -438
- package/lib/rules/__tests__/prefer-to-contain.test.js +0 -301
- package/lib/rules/__tests__/prefer-to-have-length.test.js +0 -99
- package/lib/rules/__tests__/prefer-todo.test.js +0 -78
- package/lib/rules/__tests__/require-hook.test.js +0 -403
- package/lib/rules/__tests__/require-to-throw-message.test.js +0 -108
- package/lib/rules/__tests__/require-top-level-describe.test.js +0 -236
- package/lib/rules/__tests__/test-utils.js +0 -11
- package/lib/rules/__tests__/unbound-method.test.js +0 -518
- package/lib/rules/__tests__/valid-describe-callback.test.js +0 -305
- package/lib/rules/__tests__/valid-expect-in-promise.test.js +0 -1583
- package/lib/rules/__tests__/valid-expect.test.js +0 -894
- package/lib/rules/__tests__/valid-title.test.js +0 -1147
- package/lib/rules/utils/__tests__/detectJestVersion.test.js +0 -221
- package/lib/rules/utils/__tests__/parseJestFnCall.test.js +0 -809
|
@@ -30,8 +30,8 @@ var _default = (0, _utils2.createRule)({
|
|
|
30
30
|
},
|
|
31
31
|
defaultOptions: [],
|
|
32
32
|
create(context) {
|
|
33
|
-
var _context$settings
|
|
34
|
-
const jestVersion = parseJestVersion(((_context$settings = context.settings) === null || _context$settings === void 0
|
|
33
|
+
var _context$settings;
|
|
34
|
+
const jestVersion = parseJestVersion(((_context$settings = context.settings) === null || _context$settings === void 0 || (_context$settings = _context$settings.jest) === null || _context$settings === void 0 ? void 0 : _context$settings.version) || (0, _utils2.detectJestVersion)());
|
|
35
35
|
const deprecations = {
|
|
36
36
|
...(jestVersion >= 15 && {
|
|
37
37
|
'jest.resetModuleRegistry': 'jest.resetModules'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "27.2.
|
|
3
|
+
"version": "27.2.3",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"email": "hello@jkimbo.com",
|
|
15
15
|
"url": "jkimbo.com"
|
|
16
16
|
},
|
|
17
|
-
"main": "lib/",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
18
|
"files": [
|
|
19
19
|
"docs/",
|
|
20
20
|
"lib/"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "babel --extensions .js,.ts src --out-dir lib --copy-files && rimraf lib/__tests__ 'lib/**/__tests__'",
|
|
23
|
+
"build": "babel --extensions .js,.ts src --out-dir lib --copy-files && rimraf --glob lib/__tests__ 'lib/**/__tests__'",
|
|
24
24
|
"_postinstall": "is-ci || husky install",
|
|
25
25
|
"lint": "eslint . --ignore-pattern '!.eslintrc.js' --ext js,ts",
|
|
26
26
|
"prepack": "rimraf lib && yarn build",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@schemastore/package": "^0.0.8",
|
|
109
109
|
"@semantic-release/changelog": "^6.0.0",
|
|
110
110
|
"@semantic-release/git": "^10.0.0",
|
|
111
|
-
"@tsconfig/node14": "^1.0
|
|
111
|
+
"@tsconfig/node14": "^14.1.0",
|
|
112
112
|
"@types/dedent": "^0.7.0",
|
|
113
113
|
"@types/eslint": "^8.4.6",
|
|
114
114
|
"@types/jest": "^29.0.0",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"typescript": "^5.0.4"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|
|
147
|
-
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
147
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0",
|
|
148
148
|
"eslint": "^7.0.0 || ^8.0.0",
|
|
149
149
|
"jest": "*"
|
|
150
150
|
},
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"optional": true
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
|
-
"packageManager": "yarn@3.6.
|
|
159
|
+
"packageManager": "yarn@3.6.1",
|
|
160
160
|
"engines": {
|
|
161
161
|
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
|
162
162
|
},
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var snapshotProcessor = _interopRequireWildcard(require("../snapshot-processor"));
|
|
4
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
5
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
6
|
-
describe('snapshot-processor', () => {
|
|
7
|
-
it('exports an object with preprocess and postprocess functions', () => {
|
|
8
|
-
expect(snapshotProcessor).toMatchObject({
|
|
9
|
-
preprocess: expect.any(Function),
|
|
10
|
-
postprocess: expect.any(Function)
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
describe('preprocess function', () => {
|
|
14
|
-
it('should pass on untouched source code to source array', () => {
|
|
15
|
-
const {
|
|
16
|
-
preprocess
|
|
17
|
-
} = snapshotProcessor;
|
|
18
|
-
const sourceCode = "const name = 'johnny bravo';";
|
|
19
|
-
const result = preprocess(sourceCode);
|
|
20
|
-
expect(result).toEqual([sourceCode]);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe('postprocess function', () => {
|
|
24
|
-
it('should only return messages about snapshot specific rules', () => {
|
|
25
|
-
const {
|
|
26
|
-
postprocess
|
|
27
|
-
} = snapshotProcessor;
|
|
28
|
-
const result = postprocess([['no-console', 'global-require', 'jest/no-large-snapshots'].map(ruleId => ({
|
|
29
|
-
ruleId
|
|
30
|
-
}))]);
|
|
31
|
-
expect(result).toEqual([{
|
|
32
|
-
ruleId: 'jest/no-large-snapshots'
|
|
33
|
-
}]);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|