Skip to content

Runner and environment

Override Auto Config Manual Config

Wallaby.js supports different environments including Google Chrome, node.js, Chromium/V8 via Electron and PhantomJs.

By default, your system’s PATH node.js version is used as the test runner environment for testing frameworks running in node (such as Jest or Vitest), unless the node’s version has been overridden in your configuration. Google Chrome (headless) is used by default as the test runner environment for testing frameworks running in browser (such as Angular CLI Karma with jasmine or mocha).

You may use the env configuration property to specify a path to a specific node or Chrome version, a different test runner or change the runner’s settings.

module.exports = function () {
return {
env: {
runner: '/path/to/node/or/chrome/',
type: 'browser|node',
kind: 'chrome|electron|phantomjs',
params: {
runner: 'space separated runner flags',
env: 'semicolon separated environment variables',
},
},
};
};

env.runner

Override Auto Config Manual Config

env.runner should be set to your local node/chrome/electron path, or just node/chrome (or any other command) that is mapped to your test runner binary. If it is not set, Wallaby will attempt to set it automatically:

When env.type is browser, Wallaby will use the system’s PATH version of chrome.

When env.type is node (or when using automatic configuration for a node project), Wallaby will automatically detect and select the appropriate Node.js version for your project based on configuration files like .nvmrc, .node-version, package.json (engines.node field), .n-node-version, .naverc, and .nodeenvrc. Wallaby intelligently chooses the best (either exact or closest major.minor) version of node that matches your project’s requirements using your existing version manager (e.g. nvm, volta, fnm, asdf, etc.). If no project configuration is found or a matching node version is not detected, Wallaby will use the system’s PATH version of node.

env.params.runner

Override Auto Config Manual Config

env.params.runner allows you to set space-separated spawned runner process flags.

env.params.env

Override Auto Config Manual Config

env.params.env allows you to set semicolon-separated spawned runner process environment variables.

env.type

Manual Config

env.type should be set to 'node' to use node.js, or set to 'browser' to use a browser environment (PhantomJs or Electron). The default value is 'browser'.

env.kind

Override Auto Config Manual Config

env.kind should be set to 'chrome' to use locally installed Google Chrome as a test runner, or to 'electron' to use Electron test runner, or set to 'phantomjs' to use PhantomJs. The default value is 'chrome'.

env.options

Override Auto Config Manual Config

env.options allows you to pass an object of Electron BrowserWindow options.

env.viewportSize

Override Auto Config Manual Config

env.viewportSize allows you to set PhantomJs/Electron page viewport size; the default value is {width: 800, height: 600}.

env.report404AsError

Override Auto Config Manual Config

The env.report404AsError boolean property allows you to report any 404 server hits as errors to Wallaby Console; the default value is false. It can be useful if you’d like to be alerted when your tests are requesting some missing resources or accessing missing server API, etc.