WebExt Core
Fake Browser

Installation

Vitest Jest Bun Mocha

Overview

An in-memory implementation of the web extension APIs for testing. Supports all test frameworks (Vitest, Jest, etc) and any wrapper that respects the chrome or browser globals when present (webextension-polyfill, @wxt-dev/browser).

pnpm i -D @webext-core/fake-browser
This package only really works with projects using node, so only the NPM install steps are shown.

See Testing Frameworks to setup mocks for your testing framework of choice.

Examples

See Implemented APIs for example tests and details on how to use each API.