Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
6 tasks done
unional opened this issue Oct 18, 2024 · 2 comments · Fixed by #6859
Closed
6 tasks done

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

unional opened this issue Oct 18, 2024 · 2 comments · Fixed by #6859
Labels
feat: browser Issues and PRs related to the browser runner p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@unional
Copy link

unional commented Oct 18, 2024

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/@[email protected]_@[email protected][email protected][email protected][email protected]_@[email protected][email protected]/node_modules/@vitest/browser/dist/index.js:577:17
 ❯ Timeout._onTimeout node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]_@[email protected][email protected]/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

@sheremet-va
Copy link
Member

The problem is not that it doesn't kill the runner, because it does kill it. The problem is with the RPC - we don't stop it. Until recently, there was no way to do it, but with antfu/birpc#21 we might be able to fix this. This would require an additional try/catch in the pool though.

@sheremet-va sheremet-va added feat: browser Issues and PRs related to the browser runner p2-edge-case Bug, but has workaround or limited in scope (priority) and removed pending triage labels Oct 21, 2024
@sheremet-va sheremet-va moved this to P2 - 2 in Team Board Oct 29, 2024
@xenobytezero
Copy link

I have just hit something similar, where when running Vitest in watch mode and Browser Mode, I can re-run tests multiple times with no issue, but as soon as I attach a debugger and re-run the tests I get the above Timeout calling "createTesters" error.

Is this a similar issue? Has something changed recently, as I have been successfully doing this with 2.1.2 for a while now, and suddenly it has stopped working. Updating to 2.1.4 makes no difference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: browser Issues and PRs related to the browser runner p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants