Skip to content

Commit

Permalink
fix(valid-title): False positives with test.use, `test.describe.con…
Browse files Browse the repository at this point in the history
…figure`, and `test.slow`

Fixes #258
  • Loading branch information
mskelton committed Feb 27, 2024
1 parent 3bb8c6a commit 33b2905
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/rules/valid-title.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
5 changes: 5 additions & 0 deletions src/rules/valid-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 33b2905

Please sign in to comment.