-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Issue
When using Vitest with the projects configuration, the CodSpeed plugin's custom runner is not applied to project-level configurations. This prevents benchmarks from running correctly in the CodSpeed environment.
The root cause is that the projects syntax does not extend the runner configuration from the root vitest.config.ts to individual project configurations.
Workaround
Root Configuration
In your root vitest.config.ts, modify the plugin configuration to disable the global setup:
import codspeedPlugin from "@codspeed/vitest-plugin";
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [
{
...codspeedPlugin(),
config() {
// @ts-expect-error
const normalConfig = codspeedPlugin().config?.();
normalConfig.test.globalSetup = undefined;
return normalConfig;
},
},
],
test: {
projects: ["packages/*"],
},
});Package-Level Configuration
In each package that defines benchmarks, add a vitest.config.ts:
import codspeedPlugin from "@codspeed/vitest-plugin";
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [codspeedPlugin()],
});This ensures the CodSpeed runner is properly configured at the package level where benchmarks are defined.
Metadata
Metadata
Assignees
Labels
No labels