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

Move or deleting a test that uses .only causes a crash in watch mode #1524

Closed
6 tasks done
OmgImAlexis opened this issue Jun 22, 2022 · 2 comments · Fixed by #1553
Closed
6 tasks done

Move or deleting a test that uses .only causes a crash in watch mode #1524

OmgImAlexis opened this issue Jun 22, 2022 · 2 comments · Fixed by #1553

Comments

@OmgImAlexis
Copy link

Describe the bug

If I have a test file like src/__test__/report.test.ts and rename it to src/__test__/report/report.test.ts while in watch mode vitest crashes with an error similar to this. It's not always the exact same error either.

The same goes for if I delete the test file while it's running.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: Cannot read properties of undefined (reading 'mode')
 ❯ getStateSymbol node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:7275:12
 ❯ renderTree node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:8046:24
 ❯ Object.stop node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:8109:37
 ❯ DefaultReporter.onTestRemoved node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:8130:53
 ❯ Vitest.report node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:10557:5

Reproduction

  1. Open this StackBlitz
    and wait for the ui, etc. to load
  2. Drag basic.test.ts out of the test directory and then back in
  3. Crash

System Info

System:
    OS: Windows 10 10.0.25140
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 2.87 GB / 15.92 GB
  Binaries:
    Node: 18.3.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.25140.1000.0), Chromium (102.0.1245.41)
    Internet Explorer: 11.0.25140.1000
  npmPackages:
    vitest: ^0.14.1 => 0.14.1

Used Package Manager

npm

Validations

@DerYeger
Copy link
Member

DerYeger commented Jun 22, 2022

I can have a look at this (though only in a few days).

What would be the expected behaviour in such a case?
My first approach would be simply re-collecting the tests.

I had a look at the issue and it seems to be fixable by adding onTestRemoved to the bi-rpc client and then updating the UI's state accordingly. Since I haven't touched Vitest's new state management yet I'd leave it to someone who has insight.

@OmgImAlexis
Copy link
Author

What would be the expected behaviour in such a case?

I'm good with anything that's not a crash. 👍

@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants