The best way to control Claude Code, Codex and more from any computer or phone

main
ts 45 lines 1.58 KB
Raw
1 import { expect, layer } from "@alchemy.run/test";
2 import * as NodeServices from "@effect/platform-node/NodeServices";
3 import * as Effect from "effect/Effect";
4 import * as Path from "effect/Path";
5
6 const describe = layer(NodeServices.layer);
7
8 describe("Prisma optional peers", (it) => {
9 it.effect(
10 "keeps provider and schema entrypoints independent of ORM runtime packages",
11 () =>
12 Effect.gen(function* () {
13 const path = yield* Path.Path;
14 const entries = yield* Effect.forEach(
15 [
16 "../../../../prisma/src/index.ts",
17 "../../../../prisma/src/ORM/Schema.ts",
18 "../../../../prisma/src/ORM/generator.ts",
19 "./fixtures/psl/generated/schemas.ts",
20 ],
21 (entry) => path.fromFileUrl(new URL(entry, import.meta.url)),
22 );
23 const result = yield* Effect.promise(() =>
24 Bun.build({
25 entrypoints: entries,
26 target: "bun",
27 packages: "external",
28 plugins: [
29 {
30 name: "reject-optional-prisma-runtime",
31 setup(build) {
32 build.onResolve({ filter: /^(@prisma\/orm-|arktype(?:\/|$))/ }, (args) => {
33 throw new Error(`Unexpected optional runtime import: ${args.path}`);
34 });
35 },
36 },
37 ],
38 }),
39 );
40 expect(result.success).toBe(true);
41 expect(result.logs.filter((log) => log.level === "error")).toEqual([]);
42 }),
43 { tags: ["unit", "provider:prisma", "provider:prisma:orm", "local"] },
44 );
45 });