Files
scriptc/packages/compiler/src/native/task.test.ts
Chris Tate ee9f0d64eb feat: ship the self-hosted native scriptc CLI (#585)
* 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.
2026-09-30 02:17:56 -05:00

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);
});