function module
module(
moduleName: string,
moduleContent: (
hooks: HooksObject<Assert>,
meta: { moduleName: string; options: unknown; }
) => void
): void

Defines a test module (suite) for Deno's BDD test runner.

Wraps describe() from @std/testing/bdd and sets up the QUnit lifecycle (before/beforeEach/afterEach/after hooks, assertion counting, steps tracking).

Examples

Example 1

import { module, test } from "qunitx";

module("Math", (hooks) => {
  hooks.before((assert) => {
    assert.step("before hook ran");
  });

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

Parameters

moduleName: string

Name of the test suite

moduleContent: (
hooks: HooksObject<Assert>,
meta: { moduleName: string; options: unknown; }
) => void

Callback that defines tests and hooks via hooks.before, hooks.beforeEach, hooks.afterEach, hooks.after

Return Type

void
module(
moduleName: string,
runtimeOptions: object,
moduleContent: (
hooks: HooksObject<Assert>,
meta: { moduleName: string; options: unknown; }
) => void
): void

Defines a test module (suite) with optional Deno BDD runtime options forwarded to describe().

Parameters

moduleName: string
runtimeOptions: object
moduleContent: (
hooks: HooksObject<Assert>,
meta: { moduleName: string; options: unknown; }
) => void

Return Type

void