Testem is a robust, framework-agnostic JavaScript test runner designed to execute unit, integration, and end-to-end tests across various real desktop browsers (such as Chrome, Firefox, Safari, and Edge) and Node.js environments. It supports popular testing frameworks like Jasmine, QUnit, and Mocha, and offers extensibility for custom test adapters, making it suitable for a wide range of project needs. Currently at version `3.20.0`, Testem is actively maintained with a regular release cadence, featuring recent updates like the switch to `chokidar` for more reliable file watching and dropping support for older Node.js versions. Its key differentiators include running tests directly in actual browser engines for accurate user environment simulation and streamlined workflows for both Test-Driven Development (TDD) and Continuous Integration (CI).
npm install testemVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up Testem with Mocha and Chai, including a basic `testem.js` configuration to run tests in a headless Chrome browser. It shows the `package.json` script for easy execution.
Upgrade Node.js to a supported version (20.19.0, 22.12.0, or 24.0.0+).
If you observe missed change events, try setting the environment variable `CHOKIDAR_USE_POLLING=1` before running Testem (e.g., `CHOKIDAR_USE_POLLING=1 npx testem`).
For new projects, prefer evergreen browsers (Chrome, Firefox, Safari, Edge) or Node.js for testing. Migrate existing tests away from IE and PhantomJS where possible.
Review custom build steps or configurations if you encounter new bundling-related errors after upgrading. Ensure your setup is compatible with `esbuild`'s bundling characteristics.
Upgrade your Node.js installation to version 20.19.0, 22.12.0, 24.0.0, or later.
Run Testem with the `CHOKIDAR_USE_POLLING=1` environment variable, e.g., `CHOKIDAR_USE_POLLING=1 npx testem`.
For ESM projects, rename your configuration file to `testem.cjs` and ensure it uses CommonJS `require()` and `module.exports` syntax. Alternatively, if keeping `testem.js`, ensure it is pure CommonJS.