function test
test(options?: UserRunOptions): Task<RunResult, RunFailure>

Runs the suite once in a real browser and resolves with everything it produced.

Silent by default: with no reporter, nothing reaches stdout and the RunResult is the entire output. Pass reporter: 'tap' (or 'spec', 'dot', 'github', or your own object) to get the CLI's text as well — the result comes back either way.

Lazy, because it is a Task: no browser starts until you await it. await test(…) resolves the result or throws a RunFailure; test(…).result() hands back the bare union instead, for code that would rather branch than catch.

Named test because its sibling run executes ONE file as a plain script. This is the verb that runs a suite; it was called run until the script verb needed that name.

import { test } from './test.ts';

// Defined, not invoked: launches a browser and runs the project's tests.
async function checkCart() {
  const result = await test({ inputs: ['test/'], filter: 'Cart' });
  return result.ok ? 'green' : result.failures.map((one) => one.fullName);
}

Parameters

optional
options: UserRunOptions

Return Type

test(
target: string | string[],
options?: UserRunOptions
): Task<RunResult, RunFailure>

The same run, with the target named positionally: test('test/', { filter: 'Cart' }).

The shape run(file, options) has always had, offered here so the two verbs read alike. The positional target wins over any inputs in the options object.

Parameters

target: string | string[]
optional
options: UserRunOptions

Return Type

Usage

import { test } from "lib/api/test.ts";