function armJSCoverage
armJSCoverage(
page: Page,
config: Config,
log?: (...args: unknown[]) => void
): Promise<boolean>

Arms V8 line coverage on the page before navigation, returning whether it started. resetOnNavigation: false keeps the data across the goto below, so the bundle's execution is captured. Chromium-only — run.ts already disables coverage for firefox/webkit, and page.coverage exists only on chromium pages.

A failure is announced rather than swallowed. Without arming, the run still finishes and still prints a coverage section — an empty one, with exit 0 — which reads as "your code is uncovered" when the truth is "coverage never started". That silence turned a functional break into what looked like a flake once already.

log is injectable so tests can assert on the warning without patching global stdout — console.log bypasses process.stdout.write under Deno, so capturing it is not portable.

import type { Page } from 'playwright-core';
import type { Config } from '../../types.ts';
// Defined, not invoked: starts V8 coverage on a live chromium page.
async function arm(page: Page, config: Config) {
  return await armJSCoverage(page, config); // false unless --coverage on chromium
}

Parameters

page: Page
config: Config
optional
log: (...args: unknown[]) => void = [console.log]

Return Type

Promise<boolean>

Usage

import { armJSCoverage } from "lib/commands/test/tests-in-browser.ts";