Skip to content

💅 lint/suspicious/noDuplicateTestHooks cannot handle test options argument #8265

@tim-we

Description

@tim-we

Environment information

$ npx biome rage --linter
CLI:
  Version:                      2.3.7
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v24.10.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         npm/11.6.1

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         /home/tim-we/biome-test/biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false

Linter:
  JavaScript enabled:           unset
  JSON enabled:                 unset
  CSS enabled:                  unset
  GraphQL enabled:              unset
  Recommended:                  false
  Enabled rules:
    suspicious/noDuplicateTestHooks

Workspace:
  Open Documents:               0

Rule name

lint/suspicious/noDuplicateTestHooks

Playground link

https://biomejs.dev/playground/?lintRules=noDuplicateTestHooks&code=aQBtAHAAbwByAHQAIAB7AGIAZQBmAG8AcgBlAEUAYQBjAGgALAAgAGQAZQBzAGMAcgBpAGIAZQAsACAAZQB4AHAAZQBjAHQALAAgAHQAZQBzAHQAfQAgAGYAcgBvAG0AIAAiAHYAaQB0AGUAcwB0ACIAOwAKAAoAZABlAHMAYwByAGkAYgBlACgAIgBvAHUAdABlAHIAIgAsACAAKAApACAAPQA%2BACAAewAKACAAIABiAGUAZgBvAHIAZQBFAGEAYwBoACgAKAApACAAPQA%2BACAAewAKACAAIAAgACAAYwBvAG4AcwBvAGwAZQAuAGwAbwBnACgAIgBCAGUAZgBvAHIAZQAgAGUAdgBlAHIAeQAgAHQAZQBzAHQAIgApADsACgAgACAAfQApADsACgAKACAAIABkAGUAcwBjAHIAaQBiAGUAKAAiAGkAbgBuAGUAcgAgADEAIgAsACAAKAApACAAPQA%2BACAAewAKACAAIAAgACAAdABlAHMAdAAoACIAaQBuAG4AZQByACAAdABlAHMAdAAgADEAIgAsACAAKAApACAAPQA%2BACAAewAKACAAIAAgACAAIAAgAGUAeABwAGUAYwB0ACgAMQArADEAKQAuAHQAbwBCAGUAKAAyACkAOwAKACAAIAAgACAAfQApADsACgAgACAAfQApADsACgAKACAAIAAvAC8AIAB0AGUAcwB0ACAAbwBwAHQAaQBvAG4AcwAgAGEAcgBlACAAcgBlAHEAdQBpAHIAZQBkACAAdABvACAAcgBlAHAAcgBvAGQAdQBjAGUAIAB0AGgAZQAgAGIAdQBnAAoAIAAgAGQAZQBzAGMAcgBpAGIAZQAoACIAaQBuAG4AZQByACAAMgAiACwAIAB7AHIAZQB0AHIAeQA6ACAAMgB9ACwAIAAoACkAIAA9AD4AIAB7AAoAIAAgACAAIABiAGUAZgBvAHIAZQBFAGEAYwBoACgAKAApACAAPQA%2BACAAewAKACAAIAAgACAAIAAgAGMAbwBuAHMAbwBsAGUALgBsAG8AZwAoACIAYgBlAGYAbwByAGUAIABpAG4AbgBlAHIAIAAyACIAKQA7AAoAIAAgACAAIAB9ACkAOwAKAAoAIAAgACAAIAB0AGUAcwB0ACgAIgBpAG4AbgBlAHIAIAB0AGUAcwB0ACAAMgAiACwAIAAoACkAIAA9AD4AIAB7AAoAIAAgACAAIAAgACAAZQB4AHAAZQBjAHQAKAAxACsATQBhAHQAaAAuAHIAbwB1AG4AZAAoADIAIAAqACAATQBhAHQAaAAuAHIAYQBuAGQAbwBtACgAKQApACkALgB0AG8AQgBlACgAMwApADsACgAgACAAIAAgAH0AKQAKACAAIAB9ACkAOwAKAH0AKQA%3D

Expected result

Vitest allows you to nest describe(...) function calls and it sometimes makes sense to use a test hook in the outer and another one in the inner describe call. Biome seems to support this unless you use the test options argument. Then it reports a duplicate test hook.

This is valid vitest code, as you can see here: https://stackblitz.com/edit/vitest-dev-vitest-v3jy9zzt?file=biome.test.ts

If this gets acknowledged as a bug and you are willing to receive PRs for this I will look into it when I find the time.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugS-Help-wantedStatus: you're familiar with the code base and want to help the project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions