Skip to content

🐛 useValidTestTitle reports RegExp.prototype.test() calls as tests #12027

Description

@marcospgp

Environment

Biome 2.5.14 (bunx @biomejs/biome@2.5.14), macOS 26.5.

What happened

The nursery rule useValidTestTitle treats any call to a method named test as a test declaration. A regular expression's .test(value) is then reported as a test whose title is not a string.

biome.json:

{
  "linter": {
    "rules": {
      "recommended": false,
      "nursery": { "useValidTestTitle": "error" }
    }
  }
}

repro.ts:

const lines = ["# comment", "code"];
export const code = lines.filter((line) => !/^\s*#/.test(line));

biome lint repro.ts prints:

repro.ts:2:58 lint/nursery/useValidTestTitle
  × The test title is not a string.
  > 2 │ export const code = lines.filter((line) => !/^\s*#/.test(line));
      │                                                          ^^^^

In our repository, all 39 of the rule's findings were this shape, and none was a real test.

Expected result

No diagnostic. A member call such as /re/.test(x) or pattern.test(x) is not a test declaration, so the rule would check only calls to a test function, such as test(...), it(...) and describe(...), and their modifiers like test.skip(...). The rule was ported in #9176.

Activity

  1. added theissue type on Sep 29, 2026
  2. added
    A-Linter
    L-JavaScript
    S-Bug-confirmed
    on Sep 29, 2026
  3. self-assigned this
    on Sep 29, 2026
  4. added a commit that references this issue on Sep 29, 2026
    66fbc5f
  5. added a commit that references this issue on Sep 29, 2026
    d555329
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-LinterL-JavaScriptS-Bug-confirmed

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions