Files
explore/test/node/progress.test.mjs
b10fba99e6 Initial commit
Co-authored-by: Brent Vatne <[email protected]>
Co-authored-by: Szymon Dziedzic <[email protected]>
2026-10-14 14:10:07 -07:00

16 lines
587 B
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { tsImport } from "tsx/esm/api";
const { stderrProgress } = await tsImport("../../src/shared/progress.ts", import.meta.url);
test("progress lines carry the elapsed time since the first line was possible", () => {
let now = 1_000;
const written = [];
const progress = stderrProgress({ now: () => now, write: text => written.push(text) });
progress("planning");
now += 125_000;
progress("capturing");
assert.deepEqual(written, ["[explore 00:00] planning\n", "[explore 02:05] capturing\n"]);
});