diff --git a/src/rules/no-focused-tests.ts b/src/rules/no-focused-tests.ts index 701e8fac..87dcaf4e 100644 --- a/src/rules/no-focused-tests.ts +++ b/src/rules/no-focused-tests.ts @@ -43,6 +43,22 @@ export default createEslintRule({ messageId: 'noFocusedTests' }) } + + if (callee.type === 'TaggedTemplateExpression') { + const tagCall = callee.tag.type === 'MemberExpression' ? callee.tag.object : null + if (!tagCall) return + + if ( + tagCall.type === 'MemberExpression' + && isTestOrDescribe(tagCall.object) + && isOnly(tagCall.property) + ) { + context.report({ + node: tagCall.property, + messageId: 'noFocusedTests' + }) + } + } } }, CallExpression(node) { diff --git a/tests/no-focused-tests.test.ts b/tests/no-focused-tests.test.ts index af0ab0f4..808fc715 100644 --- a/tests/no-focused-tests.test.ts +++ b/tests/no-focused-tests.test.ts @@ -56,6 +56,32 @@ ruleTester.run(RULE_NAME, rule, { } ], output: 'it.only.each([])("test", () => {});' + }, + { + code: 'test.only.each``("test", () => {});', + errors: [ + { + column: 6, + endColumn: 10, + endLine: 1, + line: 1, + messageId: 'noFocusedTests' + } + ], + output: 'test.only.each``("test", () => {});' + }, + { + code: 'it.only.each``("test", () => {});', + errors: [ + { + column: 4, + endColumn: 8, + endLine: 1, + line: 1, + messageId: 'noFocusedTests' + } + ], + output: 'it.only.each``("test", () => {});' } ] })