Runs Mocha tests in Chromium via Playwright, bundling test files with esbuild. Current stable version is 2.6.1, released quarterly with dependency upgrades and bug fixes. Unlike alternatives like karma or jest-electron, it integrates directly with esbuild for fast bundling and esbuild config support, and supports both ESM and CJS tests. Requires Mocha, Playwright Chromium, and esbuild as peer dependencies. Node >=20 required.
npm install mocha-webNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Installs mocha-web with required peer deps, runs a basic Mocha test in Chromium via CLI.
Upgrade Node.js to v20 or higher.
Use a separate esbuild config file if bundling options are needed.
Use shell commands or child_process to invoke mocha-web programmatically.
Run npm install --save-dev mocha esbuild @playwright/browser-chromium alongside mocha-web.
Set format: 'esm' in your esbuild config file if you want ESM output.
Replace '--devtools' with '--open-devtools' in CLI arguments.
npm install --save-dev mocha
npm install --save-dev esbuild
npm install --save-dev @playwright/browser-chromium
Use --open-devtools instead of --devtools.