LiveModeRunner Object

An object that configures and launches test tasks in live mode. In this mode, TestCafe watches the test files, and restarts the tests when you make changes.

Use the testCafe.createLiveModeRunner function to create a LiveModeRunner.

Example

const createTestCafe = require('testcafe');

const testcafe   = await createTestCafe('localhost', 1337, 1338);
const liveRunner = testcafe.createLiveModeRunner();

await liveRunner
    .src('tests/test.js')
    .browsers('chrome')
    .run();

await testcafe.close();

LiveModeRunner is a Runner class descendant and provides the same API (with certain limitations).

Methods

Limitations

A TestCafe server can create only one file system watcher that tracks changes to test files.

This implies the following limitations:

  • You cannot create multiple live mode runners for a single TestCafe server instance.
  • You cannot call the runner.run method more than once for a single LiveModeRunner.

In rare cases when you need multiple live mode sessions running in parallel, you can create several TestCafe server instances.