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

The same runtime as bare JavaScript, for a page that injects it rather than serving it.

qunitx run cannot put this in its HTML: it does not know whether the file is a suite until the file has evaluated, and paying for a WebSocket on every plain script would be a cost for nothing. It adds this after the fact instead, which also puts the START of the run under this process's control — the reporters have to print their header before the first testEnd crosses.

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

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

// Defined, not invoked: the same runtime, without the surrounding tag.
function injectable(config: Config) {
  return WebServer.testRuntimeSource(config, 0).includes('<script>'); // false
}

Parameters

config: Config
optional
groupId: number

Return Type

string

Usage

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