eslint-plugin-jest 29.0.2-next.1 → 29.1.0
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.
|
@@ -109,3 +109,18 @@ describe('MyClass', () => {
|
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
```
|
|
112
|
+
|
|
113
|
+
### `ignoreTodos`
|
|
114
|
+
|
|
115
|
+
This option is used to control whether
|
|
116
|
+
[`todo`](https://jestjs.io/docs/api#testtodoname) Jest functions to be checked
|
|
117
|
+
by this rule. By the default, the option is set to false.
|
|
118
|
+
|
|
119
|
+
Example of **correct** code for the `{ "ignoreTodos": true }` option:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
/* eslint jest/prefer-lowercase-title: ["error", { "ignoreTodos": true }] */
|
|
123
|
+
test.todo('Uppercase description');
|
|
124
|
+
|
|
125
|
+
it.todo('Uppercase description');
|
|
126
|
+
```
|
|
@@ -175,6 +175,7 @@ describe('foo', () => {
|
|
|
175
175
|
interface Options {
|
|
176
176
|
ignoreSpaces?: boolean;
|
|
177
177
|
ignoreTypeOfDescribeName?: boolean;
|
|
178
|
+
ignoreTypeOfTestName?: boolean;
|
|
178
179
|
disallowedWords?: string[];
|
|
179
180
|
mustNotMatch?: Partial<Record<'describe' | 'test' | 'it', string>> | string;
|
|
180
181
|
mustMatch?: Partial<Record<'describe' | 'test' | 'it', string>> | string;
|
|
@@ -187,12 +188,12 @@ Default: `false`
|
|
|
187
188
|
|
|
188
189
|
When enabled, the leading and trailing spaces won't be checked.
|
|
189
190
|
|
|
190
|
-
#### `ignoreTypeOfDescribeName`
|
|
191
|
+
#### `ignoreTypeOfDescribeName` & `ignoreTypeOfTestName`
|
|
191
192
|
|
|
192
193
|
Default: `false`
|
|
193
194
|
|
|
194
|
-
When enabled, the type of the first argument to `describe` blocks won't
|
|
195
|
-
checked.
|
|
195
|
+
When enabled, the type of the first argument to `describe`/`test` blocks won't
|
|
196
|
+
be checked.
|
|
196
197
|
|
|
197
198
|
#### `disallowedWords`
|
|
198
199
|
|
|
@@ -53,6 +53,10 @@ var _default = exports.default = (0, _utils.createRule)({
|
|
|
53
53
|
ignoreTopLevelDescribe: {
|
|
54
54
|
type: 'boolean',
|
|
55
55
|
default: false
|
|
56
|
+
},
|
|
57
|
+
ignoreTodos: {
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
default: false
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
62
|
additionalProperties: false
|
|
@@ -61,12 +65,14 @@ var _default = exports.default = (0, _utils.createRule)({
|
|
|
61
65
|
defaultOptions: [{
|
|
62
66
|
ignore: [],
|
|
63
67
|
allowedPrefixes: [],
|
|
64
|
-
ignoreTopLevelDescribe: false
|
|
68
|
+
ignoreTopLevelDescribe: false,
|
|
69
|
+
ignoreTodos: false
|
|
65
70
|
}],
|
|
66
71
|
create(context, [{
|
|
67
72
|
ignore = [],
|
|
68
73
|
allowedPrefixes = [],
|
|
69
|
-
ignoreTopLevelDescribe
|
|
74
|
+
ignoreTopLevelDescribe,
|
|
75
|
+
ignoreTodos
|
|
70
76
|
}]) {
|
|
71
77
|
const ignores = populateIgnores(ignore);
|
|
72
78
|
let numberOfDescribeBlocks = 0;
|
|
@@ -84,6 +90,11 @@ var _default = exports.default = (0, _utils.createRule)({
|
|
|
84
90
|
} else if (jestFnCall.type !== 'test') {
|
|
85
91
|
return;
|
|
86
92
|
}
|
|
93
|
+
|
|
94
|
+
// Ignore *.todo test and/or test suites
|
|
95
|
+
if (ignoreTodos && jestFnCall.members.some(s => (0, _utils.getAccessorValue)(s) === 'todo')) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
87
98
|
const [firstArg] = node.arguments;
|
|
88
99
|
const description = (0, _utils.getStringValue)(firstArg);
|
|
89
100
|
if (allowedPrefixes.some(name => description.startsWith(name))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "29.0
|
|
3
|
+
"version": "29.1.0",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -94,13 +94,14 @@
|
|
|
94
94
|
"@types/semver": "^7.5.8",
|
|
95
95
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
96
96
|
"@typescript-eslint/parser": "^8.0.0",
|
|
97
|
+
"@typescript-eslint/utils": "^8.0.0",
|
|
97
98
|
"babel-jest": "^30.0.0",
|
|
98
99
|
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
|
99
100
|
"dedent": "^1.5.0",
|
|
100
101
|
"eslint": "^8.57.0",
|
|
101
102
|
"eslint-config-prettier": "^10.0.0",
|
|
102
103
|
"eslint-doc-generator": "^2.0.0",
|
|
103
|
-
"eslint-plugin-eslint-plugin": "
|
|
104
|
+
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
104
105
|
"eslint-plugin-import": "^2.25.1",
|
|
105
106
|
"eslint-plugin-n": "^17.0.0",
|
|
106
107
|
"eslint-plugin-prettier": "^5.0.0",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"optional": true
|
|
134
135
|
}
|
|
135
136
|
},
|
|
136
|
-
"packageManager": "yarn@4.
|
|
137
|
+
"packageManager": "yarn@4.11.0",
|
|
137
138
|
"engines": {
|
|
138
139
|
"node": "^20.12.0 || ^22.0.0 || >=24.0.0"
|
|
139
140
|
}
|