The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Cause from "effect/Cause"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { findErrorTraceId } from "./errorTrace.ts"; |
| 5 | |
| 6 | describe("findErrorTraceId", () => { |
| 7 | it("terminates for cyclic causes", () => { |
| 8 | const error: { cause?: unknown } = {}; |
| 9 | error.cause = error; |
| 10 | |
| 11 | expect(findErrorTraceId(error)).toBeNull(); |
| 12 | }); |
| 13 | |
| 14 | it("finds trace metadata in Effect cause branches", () => { |
| 15 | const cause = Cause.fromReasons<unknown>([ |
| 16 | Cause.makeFailReason(new Error("first failure")), |
| 17 | Cause.makeFailReason({ traceId: "trace-secondary" }), |
| 18 | ]); |
| 19 | |
| 20 | expect(findErrorTraceId(cause)).toBe("trace-secondary"); |
| 21 | }); |
| 22 | }); |