Unified · Split
| @@ -7,9 +7,12 @@ import * as Logger from "effect/Logger"; · 6 unmodified lines | ||
| 7 | 7 | import * as Option from "effect/Option"; |
| 8 | 8 | import * as PlatformError from "effect/PlatformError"; |
| 9 | 9 | import * as References from "effect/References"; |
| 10 | +import * as Schema from "effect/Schema"; | |
| 10 | 11 | |
| 11 | 12 | import * as TraceDiagnostics from "./TraceDiagnostics.ts"; |
| 12 | 13 | |
| 14 | +const encodeUnknownJsonString = Schema.encodeUnknownSync(Schema.UnknownFromJsonString); | |
| 15 | + | |
| 13 | 16 | function ns(ms: number): string { |
| 14 | 17 | return String(BigInt(ms) * 1_000_000n); |
| 15 | 18 | } |
| @@ -23,7 +26,7 @@ function record(input: { · 7 unmodified lines | ||
| 23 | 26 | readonly exit?: { readonly _tag: "Success" | "Failure" | "Interrupted"; readonly cause?: string }; |
| 24 | 27 | readonly events?: ReadonlyArray<unknown>; |
| 25 | 28 | }) { |
| 26 | − return JSON.stringify({ | |
| 29 | + return encodeUnknownJsonString({ | |
| 27 | 30 | type: "effect-span", |
| 28 | 31 | name: input.name, |
| 29 | 32 | traceId: input.traceId, |
| @@ -159,7 +162,7 @@ describe("TraceDiagnostics", () => { · 129 unmodified lines | ||
| 159 | 162 | files: [ |
| 160 | 163 | { |
| 161 | 164 | path: "/tmp/server.trace.ndjson", |
| 162 | − text: JSON.stringify({ | |
| 165 | + text: encodeUnknownJsonString({ | |
| 163 | 166 | name: "server.noStart", |
| 164 | 167 | traceId: "trace-no-start", |
| 165 | 168 | spanId: "span-no-start", |