Skip to content

fix: stop hanging project typechecks - #11064

Open
christopher-buss wants to merge 3 commits into
vitest-dev:mainfrom
christopher-buss:fix/typechecker-watch-9494
Open

fix: stop hanging project typechecks#11064
christopher-buss wants to merge 3 commits into
vitest-dev:mainfrom
christopher-buss:fix/typechecker-watch-9494

Conversation

@christopher-buss

@christopher-buss christopher-buss commented Aug 25, 2026

Copy link
Copy Markdown

Description

Closes #9494 - vitest run hanging after successful project typechecking and leaving an orphaned tsc or tsgo --watch process.

Project configs previously resolved watch from configDefaults instead of inheriting the root configuration. In an interactive terminal, this produced watch: false at the root but watch: true in the project, causing the typechecker to start in watch mode during vitest run.

This PR:

  • propagates the root watch value to project configs
  • destroys the typechecker output streams during shutdown
  • terminates the complete process tree on Windows
  • uses a detached process group for tree termination on other platforms
  • adds regression coverage for project configuration and process cleanup

The terminal-specific behavior was also verified using a forced interactive-terminal reproduction. After the fix, both root and project resolve watch: false, Vitest exits normally, and no watched typechecker process remains.

AI-assisted by Codex and reviewed using Claude Opus + a human (myself)!

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

christopher-buss and others added 2 commits August 25, 2026 20:01
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 39cfff5
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a8e28ba75f0370008f88c70
😎 Deploy Preview https://deploy-preview-11064--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.


let treeKill: Result | undefined
try {
if (process.platform === 'win32' && child.pid != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain in the comment why do we need this branching?

If the issue is with tinyexec, can we use child_process directly? Or should the fix be in tinyexec?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened a feature request for this on tinyexec to see if they're interested. Execa has just implemented a version of this (despite an issue for this being open for 6 years) - but they may accept a contribution. Node doesn't offer this natively, so it's less an "issue" I'd say and more an API that doesn't exist. Depends if you'd want to wait for something in the library here (that may / may not be accepted or not)! I've pushed a change for now to make the code a bit easier to read, let me know if you want me to draft this PR in the meantime while we wait to see if tinyexec will support this.

@christopher-buss christopher-buss Aug 27, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW execa https://github.com/sindresorhus/execa/pull/1256/changes#diff-5af77adef0297f94becc96dd37c6dcf70dc340b32b2657dd167b215db6e95e15 also does the branching due to the different process handling by each OS

Comment thread packages/vitest/src/typecheck/typechecker.ts Outdated
Comment thread test/typescript/test/typechecker.test.ts
Comment thread test/typescript/test/typechecker.test.ts Outdated
@christopher-buss
christopher-buss force-pushed the fix/typechecker-watch-9494 branch from acbed1e to f599d69 Compare August 27, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hanging process in test project with typecheck enabled on windows

2 participants