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

Restart on configuration change broken since v0.24.4 #2393

Closed
6 tasks done
AriPerkkio opened this issue Nov 29, 2022 · 3 comments · Fixed by #2481
Closed
6 tasks done

Restart on configuration change broken since v0.24.4 #2393

AriPerkkio opened this issue Nov 29, 2022 · 3 comments · Fixed by #2481

Comments

@AriPerkkio
Copy link
Member

Describe the bug

Since #2228 the automatic restart on configuration file change in watch mode broke. vitest@0.24.3 works as expected.

By commenting out this block the crash does not happen.

// if not specified, don't run through spawn,
// because it prints stderr messages in the wrong order compared to stdout
if (retries <= 0) {
await import('./cli')
return
}

Restarting due to config changes...

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: Cannot read properties of undefined (reading 'logger')
 ❯ VerboseReporter.onCollected ../vitest/packages/vitest/dist/chunk-vite-node-externalize.fd4469d3.js:8316:46
 ❯ ../vitest/packages/vitest/dist/chunk-vite-node-externalize.fd4469d3.js:10900:51
 ❯ Vitest.report ../vitest/packages/vitest/dist/chunk-vite-node-externalize.fd4469d3.js:10898:38
 ❯ Proxy.onCollected ../vitest/packages/vitest/dist/chunk-vite-node-externalize.fd4469d3.js:7671:13
 ❯ MessagePort.<anonymous> ../vitest/packages/vitest/dist/chunk-vite-node-client.bea3705d.js:376:42
 ❯ [nodejs.internal.kHybridDispatch] node:internal/event_target:734:20
 ❯ exports.emitMessage node:internal/per_context/messageport:23:28

Reproduction

Stackblitz boilerplate without any changes: https://stackblitz.com/edit/vitest-dev-vitest-vrwfeu?file=vite.config.ts&initialPath=__vitest__

Run vitest and make a whitespace change to the configuration file.

System Info

Stackblitz

Used Package Manager

pnpm

Validations

@LeonardoRick
Copy link

I'm getting the same error!

@AriPerkkio
Copy link
Member Author

This also breaks coverage reporters on restart.

When starting Vitest, the execution order is setServer -> start. On restart it is the opposite. I'm looking into whether reporters and coverage providers could be initialized in setServer or some other handle executed after it instead.

async setServer(options: UserConfig, server: ViteDevServer) {

async start(filters?: string[]) {

@sheremet-va
Copy link
Member

On restart it is the opposite. I'm looking into whether reporters and coverage providers could be initialized

I think it's better to make execution order consistent between start and restart. We can move hook call, or something.

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

Successfully merging a pull request may close this issue.

3 participants