fix(test): suppress vitest plugin timing noise

This commit is contained in:
Vincent Koc
2026-04-07 10:54:12 +01:00
parent 90e8bef253
commit dbcb1f06ec
2 changed files with 52 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
import { describe, expect, it } from "vitest";
import { resolveVitestNodeArgs, resolveVitestSpawnParams } from "../../scripts/run-vitest.mjs";
import {
resolveVitestNodeArgs,
resolveVitestSpawnParams,
shouldSuppressVitestStderrLine,
} from "../../scripts/run-vitest.mjs";
describe("scripts/run-vitest", () => {
it("adds --no-maglev to vitest child processes by default", () => {
@@ -19,10 +23,21 @@ describe("scripts/run-vitest", () => {
expect(resolveVitestSpawnParams({ PATH: "/usr/bin" }, "darwin")).toEqual({
env: { PATH: "/usr/bin" },
detached: true,
stdio: ["inherit", "pipe", "pipe"],
});
expect(resolveVitestSpawnParams({ PATH: "/usr/bin" }, "win32")).toEqual({
env: { PATH: "/usr/bin" },
detached: false,
stdio: ["inherit", "pipe", "pipe"],
});
});
it("suppresses rolldown plugin timing noise while keeping other stderr intact", () => {
expect(
shouldSuppressVitestStderrLine(
"\u001b[33m[PLUGIN_TIMINGS] Warning:\u001b[0m plugin `foo` was slow\n",
),
).toBe(true);
expect(shouldSuppressVitestStderrLine("real failure output\n")).toBe(false);
});
});