-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
globalSetup executed twice with --ui #679
Comments
it looks like vite patches httpServer.listen https://github.com/vitejs/vite/blob/3311686bbcc12481495374c58cd1bc054d2429b8/packages/vite/src/node/server/index.ts#L579 to call buildStart, and vitest calls buildStart explicitly here https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/create.ts#L26 and then if --ui is set httpServer.listen is called by https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/create.ts#L29 i'm not really sure why vitest is calling buildStart manually, my gut feeling is that this should be handled by vite internally. cc @antfu |
I think we should avoid the manual call to |
Describe the bug
If you add a globalSetup file and run
vitest --ui
the setup function is executed twiceReproduction
https://stackblitz.com/edit/node-arkh2h?devtoolsheight=33&file=globalSetup.ts
run
npm run test
observe 'globalSetup' is logged twiceSystem Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: