function test
test(
testName: string,
testContent: (
assert: Assert,
meta: { testName: string; options: unknown; }
) => void | Promise<void>
): void

Defines an individual test within a module for Deno's BDD test runner.

Wraps it() from @std/testing/bdd and handles the full QUnit lifecycle: beforeEach/afterEach hooks, async assertion waiting, and step verification.

Must be called inside a module() callback.

Examples

Example 1

import { module, test } from "qunitx";

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

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

Parameters

testName: string

Name of the test

testContent: (
assert: Assert,
meta: { testName: string; options: unknown; }
) => void | Promise<void>

Test callback receiving (assert, { testName, options })

Return Type

void
test(
testName: string,
runtimeOptions: object,
testContent: (
assert: Assert,
meta: { testName: string; options: unknown; }
) => void | Promise<void>
): void

Defines an individual test with optional Deno BDD runtime options forwarded to it().

Parameters

testName: string
runtimeOptions: object
testContent: (
assert: Assert,
meta: { testName: string; options: unknown; }
) => void | Promise<void>

Return Type

void