function qunitxRuntimePlugin
qunitxRuntimePlugin(cwd?: string): Plugin

esbuild plugin that lets test files import { module, test } from 'qunitx' even when the consumer project has NOT installed the separate qunitx runtime package — the case for JSR/standalone-binary/npx users, who have no node_modules at all.

A consumer-installed qunitx still wins: onResolve runs esbuild's own resolver first and only falls back to the embedded, pre-bundled runtime when that fails. The runtime is read in-process via readTemplate (SEA getAsset / deno-VFS fs) and handed to esbuild as in-memory contents, because the native esbuild sidecar process cannot read SEA-store or deno-VFS files.

Scoped to the bare qunitx specifier only (covers the generated tests + documented usage); qunitx/assert — used by advanced consumers extending asserts — is not yet provided as a fallback (its default export collides with the runtime's, needing a separate bundle).

const plugin = qunitxRuntimePlugin();
plugin.name; // 'qunitx-runtime' — hand it to esbuild's `plugins` alongside the user's own

Parameters

optional
cwd: string

Return Type

Plugin

Usage

import { qunitxRuntimePlugin } from "lib/setup/qunitx-runtime-plugin.ts";