The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 07:15 UTC
| 1 | import * as Test from "@alchemy.run/test/Bun"; |
| 2 | // Run by `bun test ./<path>` from Bun.test.ts — the `.fixture.ts` suffix |
| 3 | // keeps alchemy-test from collecting it. Exercises `@alchemy.run/test/Bun`'s |
| 4 | // teardown guard: bun:test stops running later `afterAll` hooks once one |
| 5 | // throws, so the adapter must run its fallback cleanup (closing the shared |
| 6 | // scope and sidecar) itself before rethrowing — otherwise a failing |
| 7 | // teardown assertion leaks them for the rest of the process. |
| 8 | import * as Effect from "effect/Effect"; |
| 9 | import * as Layer from "effect/Layer"; |
| 10 | |
| 11 | const { test, beforeAll, afterAll } = Test.make({ |
| 12 | providers: Layer.empty as never, |
| 13 | }); |
| 14 | |
| 15 | // Attaches to the adapter's shared scope (provided to every hook/test by |
| 16 | // `Core.toEffect`), so this line printing proves the fallback cleanup ran. |
| 17 | beforeAll( |
| 18 | Effect.addFinalizer(() => Effect.sync(() => console.log("BUN_GUARD:shared-scope-finalizer-ran"))), |
| 19 | ); |
| 20 | |
| 21 | afterAll( |
| 22 | Effect.sync(() => { |
| 23 | console.log("BUN_GUARD:user-afterAll-throws"); |
| 24 | }).pipe(Effect.andThen(Effect.fail(new Error("teardown-assertion-failed")))), |
| 25 | ); |
| 26 | |
| 27 | test("body", Effect.void); |