René's URL Explorer Experiment


Title: @angular/build:unit-test vitest executor hangs indefinitely — uses close() instead of exit() · Issue #32832 · angular/angular-cli · GitHub

Open Graph Title: @angular/build:unit-test vitest executor hangs indefinitely — uses close() instead of exit() · Issue #32832 · angular/angular-cli

X Title: @angular/build:unit-test vitest executor hangs indefinitely — uses close() instead of exit() · Issue #32832 · angular/angular-cli

Description: Which @angular/* package(s) are the source of the bug? @angular/build Is this a regression? No — the vitest runner has always used close() since it was introduced. Description When running tests with the @angular/build:unit-test builder ...

Open Graph Description: Which @angular/* package(s) are the source of the bug? @angular/build Is this a regression? No — the vitest runner has always used close() since it was introduced. Description When running tests wi...

X Description: Which @angular/* package(s) are the source of the bug? @angular/build Is this a regression? No — the vitest runner has always used close() since it was introduced. Description When running tests wi...

Opengraph URL: https://github.com/angular/angular-cli/issues/32832

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@angular/build:unit-test vitest executor hangs indefinitely — uses close() instead of exit()","articleBody":"## Which @angular/* package(s) are the source of the bug?\n\n@angular/build\n\n## Is this a regression?\n\nNo — the vitest runner has always used `close()` since it was introduced.\n\n## Description\n\nWhen running tests with the `@angular/build:unit-test` builder using the vitest runner in non-watch mode, the process hangs indefinitely after all tests complete and results are printed. This happens because the builder calls `vitest.close()` which has no teardown timeout, while the vitest CLI calls `vitest.exit()` which has a safety-net `setTimeout → process.exit()`.\n\n### Root Cause\n\nThe vitest CLI (`vitest run`) handles shutdown like this (`node_modules/vitest/dist/chunks/cac.CWGDZnXT.js:2317`):\n\n```js\nconst ctx = await startVitest(mode, cliFilters, options);\nif (!ctx.shouldKeepServer()) await ctx.exit(); // ← has teardownTimeout safety net\n```\n\n`ctx.exit()` sets an unref'd `setTimeout(() =\u003e process.exit(), config.teardownTimeout)` before calling `close()`. If pool workers fail to shut down, `process.exit()` fires after 10s (default `teardownTimeout`).\n\nThe Angular builder's `VitestExecutor` (`executor.js:189`) uses `close()` directly:\n\n```js\nasync [Symbol.asyncDispose]() {\n    await this.vitest?.close();\n}\n```\n\nAdditionally, `startVitest()` itself calls `ctx.close()` in its `finally` block (`cli-api.DuT9iuvY.js:14400-14402`):\n\n```js\nfinally {\n    if (!ctx?.shouldKeepServer()) {\n        await ctx.close();  // hangs here — no timeout\n    }\n}\n```\n\n`close()` awaits `pool.close()` with no timeout. If any vitest pool worker doesn't respond to the \"stop\" message within 60s (`STOP_TIMEOUT`, hardcoded in vitest), `PoolRunner.stop()` throws but **never calls `this.worker.stop()`** to kill the process. The zombie workers' IPC channels (`ref=true`) keep the Node.js event loop alive indefinitely.\n\nThis is a known class of bugs in Vitest 4's pool implementation (vitest-dev/vitest#8766, vitest-dev/vitest#9494, vitest-dev/vitest#8861).\n\n### Suggested Fix\n\nAfter `startVitest()` returns, call `ctx.exit()` for non-watch mode, matching what the vitest CLI does:\n\n```js\nconst ctx = await startVitest('test', undefined, vitestConfig, vitestServerConfig);\nif (!ctx?.config?.watch) {\n    await ctx.exit();\n}\n```\n\nOr add an equivalent teardown timeout in the `[Symbol.asyncDispose]()` method.\n\n## Please provide a link to a minimal reproduction of the bug\n\nNo external reproduction — the issue is observable from source code analysis:\n- `executor.js:189` calls `this.vitest?.close()` (no timeout)\n- `executor.js:314` calls `startVitest()` which calls `ctx.close()` in its finally block (no timeout)\n- Vitest CLI (`cac.CWGDZnXT.js:2317`) calls `ctx.exit()` (has `teardownTimeout` safety net)\n\nReproducible with any large Angular project (232+ test files) on Windows using `@angular/build:unit-test` with vitest runner and `--no-watch`.\n\n## Please provide the exception or error you saw\n\nNo error. The process completes all tests, prints the summary, then hangs indefinitely. `process._getActiveHandles()` shows 4 `ChildProcess` + 12 `Socket` handles from vitest forks pool workers that were never killed.\n\n## Please provide the environment you discovered this bug in\n\n```\n@angular/build: 21.2.2\nvitest: 4.1.0\nNode.js: 22.14.0\nOS: Windows 11 Pro 10.0.26200\n```\n\n## Anything else?\n\n**Workaround:** Add a `globalSetup` teardown in `vitest-base.config.ts` that mirrors `ctx.exit()`'s safety net:\n\n```ts\n// vitest-global-teardown.ts\nexport async function teardown() {\n  setTimeout(() =\u003e process.exit(process.exitCode ?? 0), 10_000).unref();\n}\n```\n\nThe `_teardownGlobalSetup()` runs inside `Vitest.close()` before `pool.close()`, so the timer fires during the pool hang.","author":{"url":"https://github.com/scottcurrie","@type":"Person","name":"scottcurrie"},"datePublished":"2026-03-25T06:28:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/32832/angular-cli/issues/32832"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e57d423e-fe5e-7677-242a-8ba3ab3d2a32
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE9F0:D62B7:304A41:45D326:6A636A87
html-safe-noncebd51adf12a56ba4edc6beef577517da6977087f03a1cf29765a99d32180cb14e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUYwOkQ2MkI3OjMwNEE0MTo0NUQzMjY6NkE2MzZBODciLCJ2aXNpdG9yX2lkIjoiNzEzMzM3OTEwOTE3MTk4MDkzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac484a22dfec68b431fce053ac0dcb6d59fa787c8bf08a262732ef3d0824e42b9d
hovercard-subject-tagissue:4132947783
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/32832/issue_layout
twitter:imagehttps://opengraph.githubassets.com/07b4a6ce3ae6bbe0a82f919252fc519722eadfbb487a2cfd6ab50d862ea42690/angular/angular-cli/issues/32832
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/07b4a6ce3ae6bbe0a82f919252fc519722eadfbb487a2cfd6ab50d862ea42690/angular/angular-cli/issues/32832
og:image:altWhich @angular/* package(s) are the source of the bug? @angular/build Is this a regression? No — the vitest runner has always used close() since it was introduced. Description When running tests wi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamescottcurrie
hostnamegithub.com
expected-hostnamegithub.com
Nonee7b5617850fbcd6d10fe2b7c56398444bccb5f3a58a4a18c6d363971295bcd03
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseaa341b3f432dc63fa9633042725aec601722a352
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/32832#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F32832
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F32832
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/32832
Reloadhttps://github.com/angular/angular-cli/issues/32832
Reloadhttps://github.com/angular/angular-cli/issues/32832
Please reload this pagehttps://github.com/angular/angular-cli/issues/32832
angular https://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Notifications https://github.com/login?return_to=%2Fangular%2Fangular-cli
Fork 11.9k https://github.com/login?return_to=%2Fangular%2Fangular-cli
Star 27k https://github.com/login?return_to=%2Fangular%2Fangular-cli
Code https://github.com/angular/angular-cli
Issues 269 https://github.com/angular/angular-cli/issues
Pull requests 32 https://github.com/angular/angular-cli/pulls
Actions https://github.com/angular/angular-cli/actions
Security and quality 5 https://github.com/angular/angular-cli/security
Insights https://github.com/angular/angular-cli/pulse
Code https://github.com/angular/angular-cli
Issues https://github.com/angular/angular-cli/issues
Pull requests https://github.com/angular/angular-cli/pulls
Actions https://github.com/angular/angular-cli/actions
Security and quality https://github.com/angular/angular-cli/security
Insights https://github.com/angular/angular-cli/pulse
#33620https://github.com/angular/angular-cli/pull/33620
@angular/build:unit-test vitest executor hangs indefinitely — uses close() instead of exit()https://github.com/angular/angular-cli/issues/32832#top
#33620https://github.com/angular/angular-cli/pull/33620
angular/build:unit-testhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22angular%2Fbuild%3Aunit-test%22
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
https://github.com/scottcurrie
scottcurriehttps://github.com/scottcurrie
on Mar 25, 2026https://github.com/angular/angular-cli/issues/32832#issue-4132947783
vitest-dev/vitest#8766https://github.com/vitest-dev/vitest/issues/8766
vitest-dev/vitest#9494https://github.com/vitest-dev/vitest/issues/9494
vitest-dev/vitest#8861https://github.com/vitest-dev/vitest/issues/8861
angular/build:unit-testhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22angular%2Fbuild%3Aunit-test%22
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.