mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-24 06:14:01 +08:00
* feat: ship the self-hosted native scriptc CLI - Run the shared compiler and CLI natively, including library builds and compile-time evaluation. - Install native platform packages and ship relocatable standalone distributions. - Preserve program semantics and reuse validated build artifacts for fast rebuilds. * fix: complete native CLI integration and validation - Preserve library diagnostics and run recursive compiler work on the main stack. - Restore packaged helper permissions and exercise native npm and Wasm library builds. - Recover interrupted Sandbox status probes within the original command deadline.
19 lines
785 B
TypeScript
19 lines
785 B
TypeScript
import { expect, test } from "vitest";
|
|
import { runCompilerTask } from "./task.js";
|
|
|
|
test("compiler work starts after the caller can suspend and preserves its result", async () => {
|
|
const events: string[] = [];
|
|
const result = { ok: true, diagnostics: [] };
|
|
const pending = runCompilerTask(() => { events.push("compile"); return result; });
|
|
events.push("caller");
|
|
expect(events).toEqual(["caller"]);
|
|
expect(await pending).toBe(result);
|
|
expect(events).toEqual(["caller", "compile"]);
|
|
});
|
|
|
|
test("synchronous compiler failures reject the task without escaping its microtask", async () => {
|
|
const failure = new Error("compiler failed");
|
|
await expect(runCompilerTask(() => { throw failure; })).rejects.toBe(failure);
|
|
expect(await runCompilerTask(() => 42)).toBe(42);
|
|
});
|