|
1 | 1 | import { getV8Flags } from "@codspeed/core"; |
2 | 2 | import { fromPartial } from "@total-typescript/shoehorn"; |
3 | 3 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
| 4 | +import { type ViteUserConfig } from "vitest/config"; |
4 | 5 | import codspeedPlugin from "../index"; |
5 | 6 |
|
6 | 7 | const coreMocks = vi.hoisted(() => { |
@@ -34,10 +35,10 @@ function apply(mode: string) { |
34 | 35 | return plugin.apply({}, fromPartial({ mode })); |
35 | 36 | } |
36 | 37 |
|
37 | | -function config() { |
| 38 | +function config(userConfig: ViteUserConfig = {}) { |
38 | 39 | if (typeof plugin.config !== "function") |
39 | 40 | throw new Error("config is not a function"); |
40 | | - return plugin.config.call({} as never, {}, fromPartial({})); |
| 41 | + return plugin.config.call({} as never, userConfig, fromPartial({})); |
41 | 42 | } |
42 | 43 |
|
43 | 44 | describe("codSpeedPlugin", () => { |
@@ -148,9 +149,18 @@ describe("codSpeedPlugin", () => { |
148 | 149 | provider: expect.stringContaining( |
149 | 150 | "packages/vitest-plugin/src/v5/provider.ts", |
150 | 151 | ), |
| 152 | + suppressExportGetterWarnings: true, |
151 | 153 | }, |
152 | 154 | }, |
153 | 155 | }); |
154 | 156 | }); |
| 157 | + |
| 158 | + it("should keep an explicit suppressExportGetterWarnings from the user", () => { |
| 159 | + const result = config({ |
| 160 | + test: { benchmark: { suppressExportGetterWarnings: false } }, |
| 161 | + }) as ViteUserConfig; |
| 162 | + |
| 163 | + expect(result.test?.benchmark?.suppressExportGetterWarnings).toBe(false); |
| 164 | + }); |
155 | 165 | }); |
156 | 166 | }); |
0 commit comments