From 33b2905f85ac916337ee9035114a9596b20c6b32 Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Tue, 27 Feb 2024 06:39:37 -0600 Subject: [PATCH] fix(valid-title): False positives with `test.use`, `test.describe.configure`, and `test.slow` Fixes #258 --- src/rules/valid-title.test.ts | 11 +++++++++++ src/rules/valid-title.ts | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/rules/valid-title.test.ts b/src/rules/valid-title.test.ts index cbc0091..db5a2e0 100644 --- a/src/rules/valid-title.test.ts +++ b/src/rules/valid-title.test.ts @@ -85,7 +85,18 @@ runRuleTester('valid-title', rule, { ], valid: [ 'test.describe("the correct way to properly handle all the things", () => {});', + 'test.describe.configure({ mode: "parallel" })', 'test("that all is as it should be", () => {});', + 'test.use({ locale: "en-US" })', + 'test.only("that all is as it should be", () => {});', + 'test.skip("that all is as it should be", () => {});', + 'test.skip(({ browserName }) => browserName === "Chrome");', + 'test.skip();', + 'test.skip(browserName === "Chrome", "This feature is skipped on Chrome")', + 'test.slow("that all is as it should be", () => {});', + 'test.slow(({ browserName }) => browserName === "Chrome");', + 'test.slow();', + 'test.slow(browserName === "webkit", "This feature is slow on Mac")', { code: 'test("correctly sets the value", () => {});', options: [ diff --git a/src/rules/valid-title.ts b/src/rules/valid-title.ts index 6d575c1..357369e 100644 --- a/src/rules/valid-title.ts +++ b/src/rules/valid-title.ts @@ -110,6 +110,11 @@ export default { return; } + // Ignore statements such as `test.slow()`, `test.describe.configure()`, etc. + if (node.arguments.length < 2) { + return; + } + const [argument] = node.arguments; if (!argument) { return;