import { test, type TestContext, type TestOptions } from "avril:test"; const options: TestOptions = { name: "options", timeout: Infinity, only: false, ignore: false, async fn(t) { const name: string = t.name; const passed: boolean = await t.step("nested", async (child) => { const result: boolean = await child.step({ name: "ignored", ignore: true }); }); await t.step({ name: "options", fn: (child) => { const name: string = child.name; }, }); }, }; const registered: void = test(options); test("named", (t) => { const context: TestContext = t; }); test.only(options); test.only("named", (t) => { const name: string = t.name; }); test.ignore(options); test.ignore("ignored"); test.ignore("ignored", (t) => { const name: string = t.name; }); const only: typeof test.only = test.only; only("detached", () => {}); // @ts-expect-error The name form requires a callback. test("missing"); // @ts-expect-error The focused name form requires a callback. test.only("missing"); // @ts-expect-error Registration needs a name or options. test(); // @ts-expect-error Callbacks cannot return arbitrary promises. test("wrong result", async () => 42); // @ts-expect-error Options retain their numeric timeout. test({ name: "wrong timeout", timeout: "100" }); // @ts-expect-error Registration is not asynchronous. const promise: Promise = test("synchronous registration", () => {}); // @ts-expect-error The internal runner is not a public export. import { runTests } from "avril:test"; // @ts-expect-error Private extension modules are absent from the public graph. import { op_test_event } from "ext:core/ops"; test("steps", async (t) => { // @ts-expect-error Context names are readonly. t.name = "changed"; // @ts-expect-error The name form requires a callback. t.step("missing"); // @ts-expect-error Steps do not accept test timeouts. t.step({ name: "timeout", timeout: 10 }); // @ts-expect-error Steps cannot be focused. t.step({ name: "focused", only: true }); // @ts-expect-error Steps resolve a boolean, not a string. const result: string = await t.step("result", () => {}); await t.step("nested", (child) => { // @ts-expect-error Nested step contexts have the same readonly name. child.name = "changed"; }); });