(runDir: string, entries: ReadonlyArray<TraceEntry>)
| 26 | const fileFor = (runDir: string) => join(runDir, "traces.json"); |
| 27 | |
| 28 | export const appendTraces = (runDir: string, entries: ReadonlyArray<TraceEntry>): void => { |
| 29 | if (entries.length === 0) return; |
| 30 | const file = fileFor(runDir); |
| 31 | const existing: TraceEntry[] = existsSync(file) |
| 32 | ? (JSON.parse(readFileSync(file, "utf8")) as TraceEntry[]) |
| 33 | : []; |
| 34 | const merged = [...existing, ...entries].sort((a, b) => a.at - b.at); |
| 35 | writeFileSync(file, JSON.stringify(merged, null, 1)); |
| 36 | }; |
no test coverage detected