function trapQUnitHooks
trapQUnitHooks(): void

The page-side hook, as one self-contained function.

Handed to addInitScript, so — like lib/setup/qunit-harness.ts — it runs before any of the page's own scripts and may reference nothing outside itself.

It cannot simply call QUnit.on(...): on a page we did not write, QUnit does not exist yet. So window.QUnit is trapped, and the reporters are attached in the setter, the moment the page's own <script src="qunit.js"> assigns it.

What crosses back is trimmed hard. A testEnd carries every assertion, and an assertion carries actual and expected — whole object graphs on a page like ObjectModel's. Sending them unabridged through one binding call per test took 60 seconds to deliver 33 of 90 tests; trimmed, the same suite arrives complete in 649ms.

import { trapQUnitHooks } from './remote-page.ts';

// Defined, not invoked: it runs in the page, before the page's own scripts.
function example() {
  return trapQUnitHooks.length; // 0 — it takes nothing, so `addInitScript` can hand it straight over
}

Return Type

void

Usage

import { trapQUnitHooks } from "lib/setup/remote-page.ts";