Skip to content

Commit 7cf6320

Browse files
committed
feat(vitest-runner): go back to forks
1 parent 87634da commit 7cf6320

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

packages/vitest-runner/src/globalSetup.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { setupCore, teardownCore } from "@codspeed/core";
2-
31
declare const __VERSION__: string;
42

53
/**
@@ -15,15 +13,11 @@ let teardownHappened = false;
1513

1614
export default function () {
1715
logCodSpeed(`@codspeed/vitest-runner v${__VERSION__} - setup`);
18-
setupCore();
19-
20-
logCodSpeed(`PROCESS PID: ${process.pid} in ${__filename}`);
2116

2217
return () => {
2318
if (teardownHappened) throw new Error("teardown called twice");
2419
teardownHappened = true;
2520

26-
teardownCore();
2721
logCodSpeed(`@codspeed/vitest-runner v${__VERSION__} - teardown`);
2822
};
2923
}

packages/vitest-runner/src/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ function applyCodSpeedConfig(config: UserConfig): UserConfig {
88
...config,
99
test: {
1010
...config.test,
11-
pool: "threads",
12-
poolOptions: {
13-
threads: {
14-
singleThread: true,
15-
},
16-
},
11+
pool: "forks",
1712
runner: `${__dirname}/runner.es5.js`,
1813
globalSetup: [
1914
...(config.test?.globalSetup ?? []),

packages/vitest-runner/src/runner.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import {
22
Measurement,
33
optimizeFunction,
44
optimizeFunctionSync,
5+
setupCore,
6+
teardownCore,
57
} from "@codspeed/core";
68
import { Benchmark, Suite } from "vitest";
79
import { NodeBenchmarkRunner } from "vitest/runners";
@@ -73,9 +75,14 @@ async function runBenchmarkSuite(suite: Suite, parentSuiteName?: string) {
7375
class CodSpeedRunner extends NodeBenchmarkRunner {
7476
async runSuite(suite: Suite): Promise<void> {
7577
logCodSpeed(`PROCESS PID: ${process.pid} in ${__filename}`);
78+
setupCore();
79+
7680
logCodSpeed(`running suite ${suite.name}`);
81+
7782
await runBenchmarkSuite(suite);
7883
logCodSpeed(`running suite ${suite.name} done`);
84+
85+
teardownCore();
7986
}
8087
}
8188

0 commit comments

Comments
 (0)