diff --git a/src/rules/__tests__/no-identical-title.test.ts b/src/rules/__tests__/no-identical-title.test.ts index 6285c376f..de5b03c4d 100644 --- a/src/rules/__tests__/no-identical-title.test.ts +++ b/src/rules/__tests__/no-identical-title.test.ts @@ -124,12 +124,12 @@ ruleTester.run('no-identical-title', rule, { dedent` describe.each\` description - ${'b'} + $\{'b'} \`('$description', () => {}); describe.each\` description - ${'a'} + $\{'a'} \`('$description', () => {}); `, dedent` @@ -141,6 +141,16 @@ ruleTester.run('no-identical-title', rule, { describe('nested', () => {}); }); `, + dedent` + describe.each\`\`('my title', value => {}); + describe.each\`\`('my title', value => {}); + describe.each([])('my title', value => {}); + describe.each([])('my title', value => {}); + `, + dedent` + describe.each([])('when the value is %s', value => {}); + describe.each([])('when the value is %s', value => {}); + `, ], invalid: [ { diff --git a/src/rules/no-identical-title.ts b/src/rules/no-identical-title.ts index f83afb5f2..6f905bb18 100644 --- a/src/rules/no-identical-title.ts +++ b/src/rules/no-identical-title.ts @@ -1,6 +1,6 @@ -import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; import { createRule, + getNodeName, getStringValue, isDescribeCall, isStringNode, @@ -46,7 +46,7 @@ export default createRule({ contexts.push(newDescribeContext()); } - if (node.callee.type === AST_NODE_TYPES.TaggedTemplateExpression) { + if (getNodeName(node.callee)?.endsWith('.each')) { return; }