- Operating system: Linux Mint 22.1
- SonarQube for IntelliJ plugin version: 10.27.1.81796
- IntelliJ version: WebStorm 2025.1.2, WS-251.26094.131
- Programming language you’re coding in: TypeScript
- Is connected mode used: No
When a Vitest test.ts file exists with only test.for
tests, the SonarQube for IDE Plugin raises S2187
.
test.for
is functionally similar to test.each
, providing additional enhancements, and works as a test so S2187
should not be raised.
See https://vitest.dev/api/#test-for as a reference.
example.test.ts
import { test } from "vitest";
// Below are both detected by SonarQube and do not raise S2187
// test("", () => {});
// test.each([{ foo: "bar" }])("test name", ({ foo }) => {});
// This is not detected by SonarQube and raises S2187
test.for([{ foo: "bar" }])("test name", ({ foo }) => {});