Running and stopping tests
Purpose: understand what happens when you select Run or Stop Run, and how a Watcher-managed run relates to running the script yourself.
Execution modes
Watcher runs each package script in one of two modes. The mode is shown as Mode in Current Run.
| Playwright (Playwright-aware) | Generic | |
|---|---|---|
| Used for | Straightforward playwright test scripts | Every other script, or when you choose Run as Generic package script |
| How it starts | Runs the project-local Playwright CLI directly with node, without a shell | Runs the script through npm, like npm run <script> |
| Run options | Projects, browser mode, workers, retries | Not available |
| Planned test count | Yes | No |
| Structured progress | On Playwright 1.63+ (Enhanced) | No |
| Live logs, duration, exit code, Stop Run | Yes | Yes |
Watcher decides the mode from the current script content when you start the run. See Script compatibility.
One run at a time
Watcher manages one active run. While a run is starting, running or stopping, you cannot start another. Playwright UI Mode also cannot open during a managed run; see Playwright Tools.
Stopping a run
Select Stop Run in the Current Run panel. Watcher terminates the whole process tree it started, including browsers and helper processes:
- Windows: the process tree is forcibly terminated.
- Linux: the process group receives
SIGTERM, followed bySIGKILLif needed.
Expected result: the status changes to Stopping and then Stopped. The stopped run is saved to run history.
If Watcher cannot confirm that the process exited, the run stays in Stopping until it does. Watcher does not report a stop it could not confirm.
Pressing Ctrl+C in the terminal where Watcher runs also stops any active run before Watcher exits.
Playwright outputs
Watcher does not redirect or replace your reporters. Playwright writes its configured outputs, such as playwright-report/, test-results/ or JSON and JUnit files, exactly as it would without Watcher.
Watcher sets PLAYWRIGHT_HTML_OPEN=never for the runs it starts, so the HTML reporter does not open a report server or browser at the end of a failed run. The HTML report is still generated.
Differences from npm run
Playwright-aware runs start the Playwright CLI directly so that Watcher can add its reporter without editing your configuration. As a result, they are not identical to npm run <script>:
- Your environment variables are inherited.
- npm-specific variables such as
npm_lifecycle_eventandnpm_package_*are not set. node_modules/.binis not added toPATH.
If your Playwright webServer command or helper scripts depend on these npm details, either run the script with Run as Generic package script, or set the required environment explicitly.
Scripts with npm pre or post hooks always run in Generic mode, so their hooks still run.
Environment and secrets
Watcher-started processes inherit the environment of the terminal where you ran npx watcher start. Set any environment your tests need before starting Watcher. Watcher does not store environment variables in history.