test("trivial case", async () => { incr.reset(); const file1 = tmpFile("example.txt"); file1.write("one"); async function compilation() { const first = incr.work({ label: "first compute", async run (io) { await setTimeout(1000); const contents = await io.readFile(file1.path); return [contents, Math.random()] as const; } }); const second = incr.work({ label: "second compute", wait: first, async run (io) { await setTimeout(1000); return io.readWork(first)[0].toUpperCase(); } }); const third = incr.work({ label: "third compute", wait: first, async run (io) { await setTimeout(1000); return io.readWork(first)[1] * 1000; } }); return incr.work({ label: "last compute", wait: [second, third], async run (io) { await setTimeout(1000); return { second: io.readWork(second), third: io.readWork(third), } } }); } const { value: first } = await incr.compile(compilation); const { value: second } = await incr.compile(compilation); ASSERT(first === second); incr.forceInvalidate(file1.path); const { value: third } = await incr.compile(compilation); ASSERT(first !== third); ASSERT(first[0] === third[0]); }); import * as incr from "./incremental2.ts"; import { beforeEach, test } from "node:test"; import { tmpFile } from "#sitegen/testing";import { setTimeout } from "node:timers/promises";