A minimal reproduction showing the Oxlint jest and vitest plugins do not
work with vite-plus/test.
The Oxlint jest and vitest plugins include rules that operate on test
functions — e.g. requiring that every test has an assertion, or warning when
.todo is used in a test function. These rules are triggered based on the
import source of the test (or it, describe, etc.) function.
When test is imported from vite-plus/test instead of vitest, Oxlint does
not recognize it as a test function, so the plugin rules silently do nothing.
| Rule | Expected behavior |
|---|---|
jest/expect-expect |
Error when a test body contains no expect call |
vitest/warn-todo |
Error when .todo is used in a test function |
import { defineConfig } from "vite-plus";
export default defineConfig({
lint: {
options: { typeAware: true, typeCheck: true },
plugins: ["jest", "vitest"],
rules: {
"jest/expect-expect": "error",
"vitest/warn-todo": "error",
},
},
fmt: {},
});Both the jest and vitest Oxlint plugins are enabled, and the two rules are
set to "error" so that violations are easy to observe.
-
Install dependencies:
vp install
-
Run the linter:
vp lint
-
Observe the output.
All four calls in index.test.ts should produce lint errors — two
jest/expect-expect errors (one per empty test body) and two
vitest/warn-todo errors (one per .todo usage).
Only the two calls that use vitest's test directly produce errors. The two
calls that use vite-plus/test's test produce no errors at all, even though
they violate the same rules.
import { test as vpTest } from "vite-plus/test";
import { test as vitestTest } from "vitest";
// ✗ Should error (jest/expect-expect) — but does NOT
vpTest(
"vite-plus/test does not have expected jest/expect-expect lint error",
() => {},
);
// ✗ Should error (vitest/warn-todo) — but does NOT
vpTest.todo(
"vite-plus/test does not have expected vitest/warn-todo lint error",
() => {},
);
// ✓ Correctly errors (jest/expect-expect)
vitestTest("vitest does have expected jest/expect-expect lint error", () => {});
// ✓ Correctly errors (vitest/warn-todo)
vitestTest.todo(
"vitest does have expected vitest/warn-todo lint error",
() => {},
);The two pairs of calls are intentionally identical in structure. The only
difference is whether test comes from vite-plus/test or vitest. Oxlint
recognises "vitest" as a known import source for these plugin rules but does
not recognise "vite-plus/test", so the top two calls are silently ignored.
| Package | Version |
|---|---|
vite-plus |
0.1.15 |
vitest |
npm:@voidzero-dev/vite-plus-test@latest |
typescript |
^6.0.2 |