Configuration

Shell
esdev test --setup=./test/setup.ts   # imported before every test file
esdev test --timeout=5000            # a file that takes longer is stopped
esdev test --reporter=json           # one JSON object per line

Each is also an esdev.json key, because a project's setup files and its per-file budget are properties of the project — a flag repeated in every script is one that gets repeated differently in two of them. A flag beats the file.

JSON
{
  "test": {
    "setup": ["./test/setup.ts"],
    "globalSetup": "./test/database.ts",
    "timeout": 5000,
    "jobs": 4,
    "isolation": "process",
    "reporter": "json"
  }
}
KeyFlag
setup--setupModules imported before every test file
globalSetup--global-setupModules run once for the whole run (Global setup)
timeout--timeoutMilliseconds one file may take before it is stopped
jobs--jobsHow many files run at once
isolation--isolationprocess (default) or none (Sharing one runtime)
reporter--reporterhuman (default), json, junit, tap or dots (Reporters)
browser--browserRun in a real browser (Browser testing)
maxConcurrency--max-concurrencyHow many concurrent cases in one file run at once; 5 by default
coverage--coverageWhat coverage measures and writes (Coverage)
tags, strictTags—The tags tests may carry (Tags)

The project's top-level settings apply to tests: jsx, resolve.alias and plugins. --config=<path> reads another file in place of ./esdev.json.

A setup module is imported before the file under test, so a global it stubs is in place before anything reads it — and it costs no line numbers: a failing assertion still names the line you wrote.

For process-isolated runs, --timeout is enforced by the parent, which ends the process. The case it exists for is a file that wedges, and a budget the file kept for itself is one it never gets round to noticing. There is no default: a suite is not a place to guess how long a machine takes.

In a browser run, --timeout bounds the wait for the page to finish its tests. Browser control commands have a separate, fixed 30-second reply deadline, including setup, navigation and context cleanup. A browser that keeps its connection open but stops replying fails with the command name and the browser did not answer within 30000ms.

Not yet

An include pattern for discovery: test files are found by their *.test.* and *.spec.* names.

Last updated on
Edit this page