Test Runners

FlakeMonster auto-detects your test runner and parses output to identify individual test results. You can also specify the runner explicitly.

Auto-Detection

FlakeMonster examines the test command string you provide (via --cmd or the testCommand config field) and matches it against known runner patterns. The first match wins:

Command contains Detected runner Output format
jest or react-scripts test Jest JSON
node --test node:test (TAP) TAP
playwright Playwright JSON
(anything else) TAP (fallback) TAP

Auto-detection works for the vast majority of projects. If your command string does not contain one of the expected keywords (for example, you wrap your test runner in a shell script), use the --runner flag to tell FlakeMonster which parser to use:

$ flake-monster test --runner jest --cmd "./scripts/run-tests.sh"

Jest

Jest is the most widely used JavaScript test runner, commonly found in React and Node.js projects.

How it works

Example

# Auto-detected (command contains "jest")
$ flake-monster test --cmd "npx jest"

# Explicit runner selection
$ flake-monster test --runner jest --cmd "npx jest"

# With Create React App
$ flake-monster test --cmd "npx react-scripts test --watchAll=false"

Jest configuration tips

Tip: If your Jest config uses --forceExit, keep it. FlakeMonster does not interfere with Jest lifecycle flags.

If you use a custom Jest config path, include it in the command:

$ flake-monster test --cmd "npx jest --config jest.integration.config.js"

Node.js Native Test Runner

Node.js 18+ ships with a built-in test runner (node:test). FlakeMonster parses its TAP output to track individual test results.

How it works

Example

# Auto-detected (command contains "node --test")
$ flake-monster test --cmd "node --test test/**/*.test.js"

# Explicit runner selection
$ flake-monster test --runner node-test --cmd "node --test test/**/*.test.js"

# With a specific file pattern
$ flake-monster test --cmd "node --test 'src/**/*.spec.js'"

Important — Node 20 JSON reporter crash: Node 20 does not have a built-in json test reporter. Using --test-reporter json causes an exit code 7 crash. FlakeMonster handles this by always using the tap reporter, which is stable across Node 18, 20, and 22.

Reporter behavior

The Node.js test runner has a few output quirks that FlakeMonster accounts for:

Reporter Output stream FlakeMonster support
spec (default) stderr Not used (outputs to stderr, not stdout)
tap stdout Used by FlakeMonster
dot stdout Not supported (no per-test detail)
json N/A Crashes on Node 20 — do not use

FlakeMonster captures both stdout and stderr, but parses TAP output from stdout. If you have explicitly set --test-reporter spec, FlakeMonster will override it to tap so that test results can be parsed correctly.

Playwright

Playwright is a popular browser automation framework used for end-to-end testing. FlakeMonster parses Playwright's JSON reporter output.

How it works

Example

# Auto-detected (command contains "playwright")
$ flake-monster test --cmd "npx playwright test"

# Explicit runner selection
$ flake-monster test --runner playwright --cmd "npx playwright test"

# Run a specific test file
$ flake-monster test --cmd "npx playwright test tests/checkout.spec.ts"

Playwright configuration tips

FlakeMonster injects delays into your source files, not the Playwright test files. The injected await delays execute in the browser context when Playwright drives tests against the modified code.

Tip: For Playwright projects, consider using mode: "hardcore" and higher maxDelayMs values (100-200ms). Browser-based tests are more sensitive to timing differences than unit tests.

If your project uses a custom Playwright config, include it in the command:

$ flake-monster test --cmd "npx playwright test --config=playwright.ci.config.ts"

TAP

TAP (Test Anything Protocol) is FlakeMonster's default fallback parser. It works with any runner that produces TAP-formatted output.

How it works

Compatible runners

The TAP parser works with any test runner that outputs standard TAP. Common runners with TAP support:

Runner TAP flag Example command
Mocha --reporter tap npx mocha --reporter tap
AVA --tap npx ava --tap
tape (native TAP output) npx tape 'test/**/*.js'
node:test --test-reporter tap node --test --test-reporter tap
tap (native TAP output) npx tap

Example

# Falls back to TAP parser automatically
$ flake-monster test --cmd "npx mocha --reporter tap"

# Explicit runner selection
$ flake-monster test --runner tap --cmd "npm test"

# With tape (natively outputs TAP)
$ flake-monster test --cmd "npx tape 'test/**/*.js'"

# With AVA
$ flake-monster test --cmd "npx ava --tap"

Tip: If your test runner does not produce TAP output by default, check if it has a TAP reporter option. Most popular runners do. The TAP parser is the most universal fallback.

Browser-Based Testing

FlakeMonster's source-to-source injection approach works naturally with browser test runners. The injected await statements are plain JavaScript — they survive bundling, transpilation, and execute correctly in the browser.

Why it works

FlakeMonster modifies your source files, not test files. When a browser test runner builds and serves your code, the injected delays are included in the bundle. This means:

Playwright

Playwright drives a real browser against your application. FlakeMonster injects delays into source files before Playwright compiles and serves them:

# Inject delays, then run Playwright tests
$ flake-monster test --cmd "npx playwright test"

# With higher delays for browser-sensitive timing
$ flake-monster test --cmd "npx playwright test" --maxDelayMs 200 --mode "hardcore"

Cypress

Cypress runs tests in a browser and serves your source code through its dev server. FlakeMonster injects delays before Cypress picks up the files:

# Run Cypress in headless mode with TAP output
$ flake-monster test --runner tap --cmd "npx cypress run"

# With a specific spec file
$ flake-monster test --runner tap --cmd "npx cypress run --spec 'cypress/e2e/checkout.cy.js'"

Vitest (browser mode)

Vitest's browser mode runs tests in a real browser. FlakeMonster injects delays into source files before Vitest bundles them:

# Vitest with browser mode
$ flake-monster test --runner tap --cmd "npx vitest run --reporter=tap"

# Vitest with JSON reporter
$ flake-monster test --runner tap --cmd "npx vitest run --reporter=tap-flat"

Browser testing configuration

Browser tests are typically more sensitive to timing than unit tests. Recommended config for browser-based test suites:

// .flakemonsterrc.json
{
  "include": ["src/**/*.js", "src/**/*.ts"],
  "exclude": [
    "**/node_modules/**",
    "**/dist/**",
    "**/build/**",
    "**/playwright-report/**",
    "**/cypress/fixtures/**",
    "**/test-results/**"
  ],
  "mode": "hardcore",
  "minDelayMs": 5,
  "maxDelayMs": 200,
  "skipTryCatch": true,
  "runs": 20
}

The higher maxDelayMs of 200ms exaggerates timing differences that browser rendering is sensitive to. Setting skipTryCatch to true avoids interfering with framework error boundaries and retry logic. Running 20 iterations increases the chance of catching intermittent failures.

Explicit Runner Selection

Use the --runner flag to override auto-detection. This is useful when:

Available runner values

Value Parser Auto-injected flags
jest Jest JSON parser --json
node-test TAP parser --test-reporter tap
playwright Playwright JSON parser --reporter=json
tap TAP parser (none)

Examples

# Explicit Jest
$ flake-monster test --runner jest --cmd "npx jest"

# Explicit Playwright
$ flake-monster test --runner playwright --cmd "npx playwright test"

# Explicit node:test
$ flake-monster test --runner node-test --cmd "node --test"

# Explicit TAP (for any TAP-compatible runner)
$ flake-monster test --runner tap --cmd "npm test"

# Wrapped script — auto-detection cannot see "jest" in the command
$ flake-monster test --runner jest --cmd "./scripts/run-tests.sh"

# npm script alias — "npm test" does not reveal the underlying runner
$ flake-monster test --runner jest --cmd "npm test"