Skip to content

Commit d3cc0db

Browse files
authored
fix(expect-expect): don't error on it.todo & test.todo calls (#954)
1 parent 34cdbe0 commit d3cc0db

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/rules/__tests__/expect-expect.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const ruleTester = new TSESLint.RuleTester({
1515

1616
ruleTester.run('expect-expect', rule, {
1717
valid: [
18+
'it.todo("will test something eventually")',
19+
'test.todo("will test something eventually")',
1820
"['x']();",
1921
'it("should pass", () => expect(true).toBeDefined())',
2022
'test("should pass", () => expect(true).toBeDefined())',

src/rules/expect-expect.ts

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
createRule,
1212
getNodeName,
1313
getTestCallExpressionsFromDeclaredVariables,
14+
isSupportedAccessor,
1415
isTestCaseCall,
1516
} from './utils';
1617

@@ -116,6 +117,13 @@ export default createRule<
116117
isTestCaseCall(node) ||
117118
additionalTestBlockFunctions.includes(name)
118119
) {
120+
if (
121+
node.callee.type === AST_NODE_TYPES.MemberExpression &&
122+
isSupportedAccessor(node.callee.property, 'todo')
123+
) {
124+
return;
125+
}
126+
119127
unchecked.push(node);
120128
} else if (matchesAssertFunctionName(name, assertFunctionNames)) {
121129
// Return early in case of nested `it` statements.

0 commit comments

Comments
 (0)