Skip to content

workspace + browser mode + watch leave server behind when root config changes #6738

@unional

Description

@unional

Describe the bug

Running vitest worspace (in watch mode) with a project is using browser mode.

When a root config is changed vitest detects the change and try to restart.
But it doesn't first kill the previous browser runner, causing eventual failure:

Restarting due to config changes...

 DEV  v2.1.3 /home/unional/code/repobuddy/storybook
      [sb] Browser runner started by playwright at http://localhost:5173/

Port 5173 is in use, trying another one...

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: [vitest-api]: Timeout calling "createTesters"
 ❯ Object.onTimeoutError node_modules/.pnpm/@vitest+browser@2.1.3_@vitest+spy@2.1.3_playwright@1.48.1_typescript@5.6.3_vite@5.4.9_@types+node@22.7.5__vitest@2.1.3/node_modules/@vitest/browser/dist/index.js:577:17
 ❯ Timeout._onTimeout node_modules/.pnpm/@vitest+browser@2.1.3_@vitest+spy@2.1.3_playwright@1.48.1_typescript@5.6.3_vite@5.4.9_@types+node@22.7.5__vitest@2.1.3/node_modules/@vitest/browser/dist/index.js:240:41
 ❯ listOnTimeout node:internal/timers:573:17
 ❯ process.processTimers node:internal/timers:514:7

 ELIFECYCLE  Command failed with exit code 1.

Reproduction

TBD, I have a repro but need to clean it up.

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 28.36 GB / 31.31 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.10.0 - /run/user/1000/fnm_multishells/621_1729231040440/bin/node
    npm: 10.2.3 - /run/user/1000/fnm_multishells/621_1729231040440/bin/npm
    pnpm: 9.12.1 - /run/user/1000/fnm_multishells/621_1729231040440/bin/pnpm
    bun: 1.0.22 - ~/.bun/bin/bun
  npmPackages:
    @vitejs/plugin-react: ^4.3.2 => 4.3.2 
    @vitest/browser: ^2.1.3 => 2.1.3 
    vite: ^5.4.9 => 5.4.9 
    vitest: ^2.1.3 => 2.1.3

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    No type

    Projects

    Status

    P2 - 2

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions