Skip to content

Commit a6782da

Browse files
authored
Merge branch 'main' into feat/validate-mocked-module-path
2 parents 80063e6 + 4851e6b commit a6782da

File tree

10 files changed

+662
-428
lines changed

10 files changed

+662
-428
lines changed

.yarn/releases/yarn-4.10.3.cjs renamed to .yarn/releases/yarn-4.11.0.cjs

Lines changed: 300 additions & 300 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ enableGlobalCache: true
22

33
nodeLinker: node-modules
44

5-
yarnPath: .yarn/releases/yarn-4.10.3.cjs
5+
yarnPath: .yarn/releases/yarn-4.11.0.cjs

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [29.1.0](https://github.com/jest-community/eslint-plugin-jest/compare/v29.0.1...v29.1.0) (2025-11-10)
2+
3+
4+
### Features
5+
6+
* **prefer-lowercase-title:** allow ignoring `todo`s ([#1843](https://github.com/jest-community/eslint-plugin-jest/issues/1843)) ([4658638](https://github.com/jest-community/eslint-plugin-jest/commit/4658638ef45a58e35e9aed1fa959f9421361a476))
7+
18
## [29.0.1](https://github.com/jest-community/eslint-plugin-jest/compare/v29.0.0...v29.0.1) (2025-06-18)
29

310

docs/rules/prefer-lowercase-title.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,18 @@ describe('MyClass', () => {
109109
});
110110
});
111111
```
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+
```

docs/rules/valid-title.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ describe('foo', () => {
175175
interface Options {
176176
ignoreSpaces?: boolean;
177177
ignoreTypeOfDescribeName?: boolean;
178+
ignoreTypeOfTestName?: boolean;
178179
disallowedWords?: string[];
179180
mustNotMatch?: Partial<Record<'describe' | 'test' | 'it', string>> | string;
180181
mustMatch?: Partial<Record<'describe' | 'test' | 'it', string>> | string;
@@ -187,12 +188,12 @@ Default: `false`
187188

188189
When enabled, the leading and trailing spaces won't be checked.
189190

190-
#### `ignoreTypeOfDescribeName`
191+
#### `ignoreTypeOfDescribeName` & `ignoreTypeOfTestName`
191192

192193
Default: `false`
193194

194-
When enabled, the type of the first argument to `describe` blocks won't be
195-
checked.
195+
When enabled, the type of the first argument to `describe`/`test` blocks won't
196+
be checked.
196197

197198
#### `disallowedWords`
198199

markdown_link_check_config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@
66
"Accept-Encoding": "br, gzip, deflate"
77
}
88
}
9+
],
10+
"replacementPatterns": [
11+
{
12+
"pattern": "^https://www\\.npmjs\\.com/package",
13+
"replacement": "https://registry.npmjs.org"
14+
}
915
]
1016
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-jest",
3-
"version": "29.0.1",
3+
"version": "29.1.0",
44
"description": "ESLint rules for Jest",
55
"keywords": [
66
"eslint",
@@ -134,7 +134,7 @@
134134
"optional": true
135135
}
136136
},
137-
"packageManager": "yarn@4.10.3",
137+
"packageManager": "yarn@4.11.0",
138138
"engines": {
139139
"node": "^20.12.0 || ^22.0.0 || >=24.0.0"
140140
}

src/rules/__tests__/prefer-lowercase-title.test.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,3 +646,95 @@ ruleTester.run('prefer-lowercase-title with ignoreTopLevelDescribe', rule, {
646646
},
647647
],
648648
});
649+
650+
ruleTester.run('prefer-lowercase-title with ignoreTodos', rule, {
651+
valid: [
652+
{
653+
code: 'test.todo(`Foo`, function () {})',
654+
options: [{ ignoreTodos: true }],
655+
},
656+
{
657+
code: 'it.todo(`Foo`, function () {})',
658+
options: [{ ignoreTodos: true }],
659+
},
660+
{
661+
code: 'it.todo("Foo", () => {})',
662+
options: [{ ignoreTodos: true }],
663+
},
664+
{
665+
code: 'it.only.todo("Foo", () => {})',
666+
options: [{ ignoreTodos: true }],
667+
},
668+
{
669+
code: 'it.todo.only("Foo", () => {})',
670+
options: [{ ignoreTodos: true }],
671+
},
672+
],
673+
invalid: [
674+
{
675+
code: "describe('Foo', function () {})",
676+
output: "describe('foo', function () {})",
677+
options: [{ ignoreTodos: true }],
678+
errors: [
679+
{
680+
messageId: 'unexpectedCase',
681+
data: { method: DescribeAlias.describe },
682+
column: 10,
683+
line: 1,
684+
},
685+
],
686+
},
687+
{
688+
code: "it('Foo', function () {})",
689+
output: "it('foo', function () {})",
690+
options: [{ ignoreTodos: true }],
691+
errors: [
692+
{
693+
messageId: 'unexpectedCase',
694+
data: { method: TestCaseName.it },
695+
column: 4,
696+
line: 1,
697+
},
698+
],
699+
},
700+
{
701+
code: "test('Foo', function () {})",
702+
output: "test('foo', function () {})",
703+
options: [{ ignoreTodos: true }],
704+
errors: [
705+
{
706+
messageId: 'unexpectedCase',
707+
data: { method: TestCaseName.test },
708+
column: 6,
709+
line: 1,
710+
},
711+
],
712+
},
713+
{
714+
code: "test.only('Foo', function () {})",
715+
output: "test.only('foo', function () {})",
716+
options: [{ ignoreTodos: true }],
717+
errors: [
718+
{
719+
messageId: 'unexpectedCase',
720+
data: { method: TestCaseName.test },
721+
column: 11,
722+
line: 1,
723+
},
724+
],
725+
},
726+
{
727+
code: "test.skip('Foo', function () {})",
728+
output: "test.skip('foo', function () {})",
729+
options: [{ ignoreTodos: true }],
730+
errors: [
731+
{
732+
messageId: 'unexpectedCase',
733+
data: { method: TestCaseName.test },
734+
column: 11,
735+
line: 1,
736+
},
737+
],
738+
},
739+
],
740+
});

src/rules/prefer-lowercase-title.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
type StringNode,
66
TestCaseName,
77
createRule,
8+
getAccessorValue,
89
getStringValue,
910
isStringNode,
1011
isTypeOfJestFnCall,
@@ -47,6 +48,7 @@ export default createRule<
4748
ignore: readonly IgnorableFunctionExpressions[];
4849
allowedPrefixes: readonly string[];
4950
ignoreTopLevelDescribe: boolean;
51+
ignoreTodos: boolean;
5052
}>,
5153
],
5254
'unexpectedCase'
@@ -88,17 +90,33 @@ export default createRule<
8890
type: 'boolean',
8991
default: false,
9092
},
93+
ignoreTodos: {
94+
type: 'boolean',
95+
default: false,
96+
},
9197
},
9298
additionalProperties: false,
9399
},
94100
],
95101
},
96102
defaultOptions: [
97-
{ ignore: [], allowedPrefixes: [], ignoreTopLevelDescribe: false },
103+
{
104+
ignore: [],
105+
allowedPrefixes: [],
106+
ignoreTopLevelDescribe: false,
107+
ignoreTodos: false,
108+
},
98109
],
99110
create(
100111
context,
101-
[{ ignore = [], allowedPrefixes = [], ignoreTopLevelDescribe }],
112+
[
113+
{
114+
ignore = [],
115+
allowedPrefixes = [],
116+
ignoreTopLevelDescribe,
117+
ignoreTodos,
118+
},
119+
],
102120
) {
103121
const ignores = populateIgnores(ignore);
104122
let numberOfDescribeBlocks = 0;
@@ -121,6 +139,14 @@ export default createRule<
121139
return;
122140
}
123141

142+
// Ignore *.todo test and/or test suites
143+
if (
144+
ignoreTodos &&
145+
jestFnCall.members.some(s => getAccessorValue(s) === 'todo')
146+
) {
147+
return;
148+
}
149+
124150
const [firstArg] = node.arguments;
125151

126152
const description = getStringValue(firstArg);

0 commit comments

Comments
 (0)