default

QUnitX — universal test library that runs the same test file in Node.js, Deno, and browser.

Examples

Example 1

import { module, test } from "qunitx";

module("Math", (hooks) => {
  hooks.before((assert) => assert.step("setup"));

  test("addition", (assert) => {
    assert.equal(1 + 1, 2);
  });

  test("async", async (assert) => {
    const n = await Promise.resolve(42);
    assert.strictEqual(n, 42);
  });
});

Classes

c
Assert(
module: ModuleState | null,
test?: TestState
)

The assertion object passed to every test callback and lifecycle hook.

c
AssertionError(object: AssertionErrorOptions)

Thrown when an assertion fails. Extends Deno's built-in AssertionError so it integrates cleanly with Deno's test runner output.

Functions

f
module.skipModule(
moduleName: string,
_moduleContent?: unknown
): void

Skips all tests inside a module. Equivalent to QUnit.module.skip. The module is registered as ignored by Deno's runner; no test bodies run.

f
module.skipModule(
moduleName: string,
_moduleContent?: unknown
): void

Skips all tests inside a module. Equivalent to QUnit.module.skip. The module is registered as ignored by Deno's runner; no test bodies run.

f
module.skipModule(
moduleName: string,
_moduleContent?: unknown
): void

Skips all tests inside a module. Equivalent to QUnit.module.skip. The module is registered as ignored by Deno's runner; no test bodies run.

f
module.todoModule(
moduleName: string,
_moduleContent?: unknown
): void

Marks all tests inside a module as todo. Equivalent to QUnit.module.todo. The module is registered as ignored by Deno's runner; no test bodies run. Deno has no native "todo module" concept, so this maps to ignore.

f
module.todoModule(
moduleName: string,
_moduleContent?: unknown
): void

Marks all tests inside a module as todo. Equivalent to QUnit.module.todo. The module is registered as ignored by Deno's runner; no test bodies run. Deno has no native "todo module" concept, so this maps to ignore.

f
module.todoModule(
moduleName: string,
_moduleContent?: unknown
): void

Marks all tests inside a module as todo. Equivalent to QUnit.module.todo. The module is registered as ignored by Deno's runner; no test bodies run. Deno has no native "todo module" concept, so this maps to ignore.

f
test.skipTest(
testName: string,
_testContent?: unknown
): void

Registers a skipped test. Equivalent to QUnit.test.skip. The test body is never executed; the test is reported as ignored by Deno's runner.

f
test.skipTest(
testName: string,
_testContent?: unknown
): void

Registers a skipped test. Equivalent to QUnit.test.skip. The test body is never executed; the test is reported as ignored by Deno's runner.

f
test.skipTest(
testName: string,
_testContent?: unknown
): void

Registers a skipped test. Equivalent to QUnit.test.skip. The test body is never executed; the test is reported as ignored by Deno's runner.

f
test.todoTest(
testName: string,
_testContent?: unknown
): void

Registers a todo test. Equivalent to QUnit.test.todo. The test body is never executed; the test is reported as ignored by Deno's runner (Deno has no native todo concept).

f
test.todoTest(
testName: string,
_testContent?: unknown
): void

Registers a todo test. Equivalent to QUnit.test.todo. The test body is never executed; the test is reported as ignored by Deno's runner (Deno has no native todo concept).

f
test.todoTest(
testName: string,
_testContent?: unknown
): void

Registers a todo test. Equivalent to QUnit.test.todo. The test body is never executed; the test is reported as ignored by Deno's runner (Deno has no native todo concept).

Variables

v
default: { AssertionError; module; test; config; }

The default export provides the full QUnitX API as a single object.

v
skip

Registers a skipped test. Equivalent to test.skip. The test body is never executed and the test is reported as ignored by Deno's runner.