Skip to content

Commit 75b3fdf

Browse files
fix(relay): run Alchemy test hooks on the runner's Vitest
Alchemy's test helper imports hooks from bare `vitest`, which resolved to a different Vitest 5 copy than the one running relay tests, so its afterAll threw "failed to find the current suite". Patch it to import from `vite-plus/test`, like the existing @effect/vitest patch, and give relay the catalog TypeScript so it shares the workspace's vite-plus instance. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 5d2cebe commit 75b3fdf

4 files changed

Lines changed: 109 additions & 412 deletions

File tree

‎infra/relay/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@effect/vitest": "catalog:",
2929
"@types/node": "catalog:",
3030
"drizzle-kit": "1.0.0-rc.5-ab785fc",
31+
"typescript": "catalog:",
3132
"vite": "catalog:",
3233
"vite-plus": "catalog:"
3334
}

‎patches/[email protected]‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/lib/Test/Vitest.js b/lib/Test/Vitest.js
2+
index 0ecf9ccff01bb6556bf3e471d5a93254d16224a7..c0f1237e6a98e698718b0bbde5de8eb58c859e8e 100644
3+
--- a/lib/Test/Vitest.js
4+
+++ b/lib/Test/Vitest.js
5+
@@ -3,7 +3,7 @@ import { it } from "@effect/vitest";
6+
import * as Effect from "effect/Effect";
7+
import * as Exit from "effect/Exit";
8+
import * as Scope from "effect/Scope";
9+
-import { afterAll as vitestAfterAll, afterEach as vitestAfterEach, beforeAll as vitestBeforeAll, beforeEach as vitestBeforeEach, } from "vitest";
10+
+import { afterAll as vitestAfterAll, afterEach as vitestAfterEach, beforeAll as vitestBeforeAll, beforeEach as vitestBeforeEach, } from "vite-plus/test";
11+
import * as Core from "./Core.js";
12+
export { executeWhenReady, getWhenReady, guardContentType, guardedFetchLayer, rpcClientLayer, WorkerNotReady, } from "./Http.js";
13+
export const defaultStage = Core.defaultStage;
14+
diff --git a/src/Test/Vitest.ts b/src/Test/Vitest.ts
15+
index c321e6d4924d0f6b3ae53292a12af88167692ccb..673929a81d066bdd6a2dd94e9c1d95bb69f3e3cd 100644
16+
--- a/src/Test/Vitest.ts
17+
+++ b/src/Test/Vitest.ts
18+
@@ -8,7 +8,7 @@ import {
19+
afterEach as vitestAfterEach,
20+
beforeAll as vitestBeforeAll,
21+
beforeEach as vitestBeforeEach,
22+
-} from "vitest";
23+
+} from "vite-plus/test";
24+
25+
import type { AlchemyContext } from "../AlchemyContext.ts";
26+
import type { CompiledStack } from "../Stack.ts";

0 commit comments

Comments
 (0)