function testRuntimeToInject
testRuntimeToInject(
config: Config,
groupId?: number
): string

The <script> that turns a page into a reporting test page: the QUnit preconfig, the WebSocket client, and the QUnit hooks that forward every event to this process.

Exported because qunitx run injects the very same runtime. Its page is not built here — it serves an ESM bundle so a script can use top-level await, which the iife suite bundle cannot — but the REPORTING half must be identical, or TAP from qunitx run would drift from TAP from the bare verb, which is the one thing it promises not to do.

import * as WebServer from './web-server.ts';

import type { Config } from '../types.ts';

// Defined, not invoked: reads the run's filters and timeout off a resolved config.
function pageScript(config: Config) {
  return WebServer.testRuntimeToInject(config, 0).startsWith('<script>'); // true
}

Parameters

config: Config
optional
groupId: number

Return Type

string

Usage

import { testRuntimeToInject } from "lib/setup/web-server.ts";