eslint-plugin-jest 27.2.1 → 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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <a href="https://eslint.org/">
3
3
  <img height="150" src="https://eslint.org/assets/images/logo/eslint-logo-color.svg">
4
4
  </a>
5
- <a href="https://facebook.github.io/jest/">
5
+ <a href="https://jestjs.io/">
6
6
  <img width="150" height="150" vspace="" hspace="25" src="https://jestjs.io/img/jest.png">
7
7
  </a>
8
8
  <h1>eslint-plugin-jest</h1>
@@ -11,7 +11,7 @@ This rule _warns_ in the 🎨 `style`
11
11
  <!-- end auto-generated rule header -->
12
12
 
13
13
  > These aliases are going to be removed in the next major version of Jest - see
14
- > <https://github.com/facebook/jest/issues/13164> for more
14
+ > <https://github.com/jestjs/jest/issues/13164> for more
15
15
 
16
16
  Several Jest methods have alias names, such as `toThrow` having the alias of
17
17
  `toThrowError`. This rule ensures that only the canonical name as used in the
@@ -173,4 +173,4 @@ safely disable this rule.
173
173
 
174
174
  ## Further Reading
175
175
 
176
- - [Jest docs - Setup and Teardown](https://facebook.github.io/jest/docs/en/setup-teardown.html)
176
+ - [Jest docs - Setup and Teardown](https://jestjs.io/docs/setup-teardown)
@@ -24,6 +24,10 @@ module.exports = {
24
24
  };
25
25
  ```
26
26
 
27
+ In order to check external snapshots, you must also have `eslint` check files
28
+ with the `.snap` extension by either passing `--ext snap` on the command line or
29
+ by explicitly specifying `.snap` in `overrides`.
30
+
27
31
  ## Rule details
28
32
 
29
33
  This rule looks at all Jest inline and external snapshots (files with `.snap`
@@ -2,12 +2,8 @@
2
2
 
3
3
  <!-- end auto-generated rule header -->
4
4
 
5
- Often while writing tests you have some setup work that needs to happen before
6
- tests run, and you have some finishing work that needs to happen after tests
7
- run. Jest provides helper functions to handle this.
8
-
9
- It's common when writing tests to need to perform setup work that needs to
10
- happen before tests run, and finishing work after tests run.
5
+ It's common when writing tests to need to perform setup work that has to happen
6
+ before tests run, and finishing work after tests run.
11
7
 
12
8
  Because Jest executes all `describe` handlers in a test file _before_ it
13
9
  executes any of the actual tests, it's important to ensure setup and teardown
@@ -66,7 +66,7 @@ This rule is enabled by default.
66
66
  Enforces to use `await` inside block statements. Using `return` will trigger a
67
67
  warning. Returning one line statements with arrow functions is _always allowed_.
68
68
 
69
- Examples of **incorrect** code for the { "alwaysAwait": **true** } option:
69
+ Examples of **incorrect** code for the `{ "alwaysAwait": true }` option:
70
70
 
71
71
  ```js
72
72
  // alwaysAwait: true
@@ -76,7 +76,7 @@ test('test1', async () => {
76
76
  });
77
77
  ```
78
78
 
79
- Examples of **correct** code for the { "alwaysAwait": **true** } option:
79
+ Examples of **correct** code for the `{ "alwaysAwait": true }` option:
80
80
 
81
81
  ```js
82
82
  // alwaysAwait: true
package/lib/index.js CHANGED
@@ -7,6 +7,8 @@ var snapshotProcessor = _interopRequireWildcard(require("./processors/snapshot-p
7
7
  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); }
8
8
  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; }
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ // v5 of `@typescript-eslint/experimental-utils` removed this
11
+
10
12
  // copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
11
13
  /* istanbul ignore next */
12
14
  const interopRequireDefault = obj => obj && obj.__esModule ? obj : {
@@ -30,8 +30,8 @@ var _default = (0, _utils2.createRule)({
30
30
  },
31
31
  defaultOptions: [],
32
32
  create(context) {
33
- var _context$settings, _context$settings$jes;
34
- const jestVersion = parseJestVersion(((_context$settings = context.settings) === null || _context$settings === void 0 ? void 0 : (_context$settings$jes = _context$settings.jest) === null || _context$settings$jes === void 0 ? void 0 : _context$settings$jes.version) || (0, _utils2.detectJestVersion)());
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'
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isSupportedAccessor = exports.isStringNode = exports.isIdentifier = exports.getStringValue = exports.getAccessorValue = void 0;
7
7
  var _utils = require("@typescript-eslint/utils");
8
+ /**
9
+ * A `Literal` with a `value` of type `string`.
10
+ */
11
+
8
12
  /**
9
13
  * Checks if the given `node` is a `StringLiteral`.
10
14
  *
@@ -21,6 +21,22 @@ const createRule = _utils.ESLintUtils.RuleCreator(name => {
21
21
  /**
22
22
  * Represents a `MemberExpression` with a "known" `property`.
23
23
  */
24
+
25
+ /**
26
+ * Represents a `CallExpression` with a "known" `property` accessor.
27
+ *
28
+ * i.e `KnownCallExpression<'includes'>` represents `.includes()`.
29
+ */
30
+
31
+ /**
32
+ * Represents a `MemberExpression` with a "known" `property`, that is called.
33
+ *
34
+ * This is `KnownCallExpression` from the perspective of the `MemberExpression` node.
35
+ */
36
+
37
+ /**
38
+ * Represents a `CallExpression` with a single argument.
39
+ */
24
40
  exports.createRule = createRule;
25
41
  /**
26
42
  * Guards that the given `call` has only one `argument`.
@@ -31,44 +47,44 @@ exports.createRule = createRule;
31
47
  */
32
48
  const hasOnlyOneArgument = call => call.arguments.length === 1;
33
49
  exports.hasOnlyOneArgument = hasOnlyOneArgument;
34
- let DescribeAlias;
35
- exports.DescribeAlias = DescribeAlias;
36
- (function (DescribeAlias) {
50
+ let DescribeAlias = /*#__PURE__*/function (DescribeAlias) {
37
51
  DescribeAlias["describe"] = "describe";
38
52
  DescribeAlias["fdescribe"] = "fdescribe";
39
53
  DescribeAlias["xdescribe"] = "xdescribe";
40
- })(DescribeAlias || (exports.DescribeAlias = DescribeAlias = {}));
41
- let TestCaseName;
42
- exports.TestCaseName = TestCaseName;
43
- (function (TestCaseName) {
54
+ return DescribeAlias;
55
+ }({});
56
+ exports.DescribeAlias = DescribeAlias;
57
+ let TestCaseName = /*#__PURE__*/function (TestCaseName) {
44
58
  TestCaseName["fit"] = "fit";
45
59
  TestCaseName["it"] = "it";
46
60
  TestCaseName["test"] = "test";
47
61
  TestCaseName["xit"] = "xit";
48
62
  TestCaseName["xtest"] = "xtest";
49
- })(TestCaseName || (exports.TestCaseName = TestCaseName = {}));
50
- let HookName;
51
- exports.HookName = HookName;
52
- (function (HookName) {
63
+ return TestCaseName;
64
+ }({});
65
+ exports.TestCaseName = TestCaseName;
66
+ let HookName = /*#__PURE__*/function (HookName) {
53
67
  HookName["beforeAll"] = "beforeAll";
54
68
  HookName["beforeEach"] = "beforeEach";
55
69
  HookName["afterAll"] = "afterAll";
56
70
  HookName["afterEach"] = "afterEach";
57
- })(HookName || (exports.HookName = HookName = {}));
58
- let ModifierName;
59
- exports.ModifierName = ModifierName;
60
- (function (ModifierName) {
71
+ return HookName;
72
+ }({});
73
+ exports.HookName = HookName;
74
+ let ModifierName = /*#__PURE__*/function (ModifierName) {
61
75
  ModifierName["not"] = "not";
62
76
  ModifierName["rejects"] = "rejects";
63
77
  ModifierName["resolves"] = "resolves";
64
- })(ModifierName || (exports.ModifierName = ModifierName = {}));
65
- let EqualityMatcher;
66
- exports.EqualityMatcher = EqualityMatcher;
67
- (function (EqualityMatcher) {
78
+ return ModifierName;
79
+ }({});
80
+ exports.ModifierName = ModifierName;
81
+ let EqualityMatcher = /*#__PURE__*/function (EqualityMatcher) {
68
82
  EqualityMatcher["toBe"] = "toBe";
69
83
  EqualityMatcher["toEqual"] = "toEqual";
70
84
  EqualityMatcher["toStrictEqual"] = "toStrictEqual";
71
- })(EqualityMatcher || (exports.EqualityMatcher = EqualityMatcher = {}));
85
+ return EqualityMatcher;
86
+ }({});
87
+ exports.EqualityMatcher = EqualityMatcher;
72
88
  const joinNames = (a, b) => a && b ? `${a}.${b}` : null;
73
89
  function getNodeName(node) {
74
90
  if ((0, _accessors.isSupportedAccessor)(node)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "27.2.1",
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",
@@ -105,10 +105,10 @@
105
105
  "@babel/preset-typescript": "^7.3.3",
106
106
  "@commitlint/cli": "^17.0.3",
107
107
  "@commitlint/config-conventional": "^17.0.3",
108
- "@schemastore/package": "^0.0.6",
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.3",
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",
@@ -132,20 +132,21 @@
132
132
  "husky": "^8.0.1",
133
133
  "is-ci": "^3.0.0",
134
134
  "jest": "^29.0.0",
135
- "jest-runner-eslint": "^1.1.0",
135
+ "jest-runner-eslint": "^2.0.0",
136
136
  "lint-staged": "^13.0.3",
137
137
  "markdown-link-check": "^3.10.2",
138
138
  "pinst": "^3.0.0",
139
139
  "prettier": "^2.0.5",
140
- "rimraf": "^3.0.0",
141
- "semantic-release": "^19.0.0",
140
+ "rimraf": "^5.0.0",
141
+ "semantic-release": "^21.0.0",
142
142
  "semver": "^7.3.5",
143
143
  "ts-node": "^10.2.1",
144
- "typescript": "^4.4.0"
144
+ "typescript": "^5.0.4"
145
145
  },
146
146
  "peerDependencies": {
147
- "@typescript-eslint/eslint-plugin": "^5.0.0",
148
- "eslint": "^7.0.0 || ^8.0.0"
147
+ "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0",
148
+ "eslint": "^7.0.0 || ^8.0.0",
149
+ "jest": "*"
149
150
  },
150
151
  "peerDependenciesMeta": {
151
152
  "@typescript-eslint/eslint-plugin": {
@@ -155,8 +156,11 @@
155
156
  "optional": true
156
157
  }
157
158
  },
158
- "packageManager": "yarn@3.3.1",
159
+ "packageManager": "yarn@3.6.1",
159
160
  "engines": {
160
161
  "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
162
+ },
163
+ "publishConfig": {
164
+ "provenance": true
161
165
  }
162
166
  }