René's URL Explorer Experiment


Title: `unit-test` builder with `vitest` runner does not support `vi.mock()` · Issue #31609 · angular/angular-cli · GitHub

Open Graph Title: `unit-test` builder with `vitest` runner does not support `vi.mock()` · Issue #31609 · angular/angular-cli

X Title: `unit-test` builder with `vitest` runner does not support `vi.mock()` · Issue #31609 · angular/angular-cli

Description: Command test Description When using the new unit-test builder with Vitest runner, some Vitest features such as the module graph or module "mocking" with vi.mock() (https://vitest.dev/guide/mocking/modules.html) do not work. This is due t...

Open Graph Description: Command test Description When using the new unit-test builder with Vitest runner, some Vitest features such as the module graph or module "mocking" with vi.mock() (https://vitest.dev/guide/mocking/...

X Description: Command test Description When using the new unit-test builder with Vitest runner, some Vitest features such as the module graph or module "mocking" with vi.mock() (https://vitest.dev/guid...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`unit-test` builder with `vitest` runner does not support `vi.mock()`","articleBody":"### Command\n\ntest\n\n### Description\n\nWhen using the new `unit-test` builder with Vitest runner, some Vitest features such as the module graph or module \"mocking\" with `vi.mock()` (https://vitest.dev/guide/mocking/modules.html) do not work.\n\nThis is due to the fact that the builder is building the tests and then providing the built chunks to Vitest so Vitest is not aware of the real module graph.\n\nLuckily, Angular developers have the luxury of dependency injection that avoids relying on test framework for replacing things with test doubles.\nThat said, there are some use cases, specially when relying on 3rd party libraries that might require module \"mocking\".\nFor instance, AFAIK, the main approach to achieve Shallow testing in AOT without altering production code is to use this feature (cf. https://marmicode.io/blog/angular-template-code-coverage-and-future-proof-testing#:~:text=Shallow%20Testing%20is%20More%20Challenging)\n\n### Describe the solution you'd like\n\nLet vitest resolve modules 😇\n\n### Describe alternatives you've considered\n\nIn the mean time, it would be nice to monkey patch `vi.mock` and make it throw an error indicating that the feature is not supported.","author":{"url":"https://github.com/yjaaidi","@type":"Person","name":"yjaaidi"},"datePublished":"2025-10-27T13:05:21Z","url":"https://github.com/angular/angular-cli/issues/31609"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fab08127-a3e4-a8e0-2473-2ccc2a9e55c7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDE9E:3A8E64:111C784:16B443E:6B01E531
html-safe-nonceb7a8ea5afeb11c1a775f5720afb90cad23f498ede774bf9dc1f09ae782995bd5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTlFOjNBOEU2NDoxMTFDNzg0OjE2QjQ0M0U6NkIwMUU1MzEiLCJ2aXNpdG9yX2lkIjoiMTA4MDE0NjQ1MDk2MjMxMDQ1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2e3f3e6bcd2fbdf4dec41c28ec8cc5b5398603731fef3f776afafd9412b25225
hovercard-subject-tagissue:3556695455
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/31609/issue_layout
twitter:imagehttps://opengraph.githubassets.com/62907e5b4c9c0b3f0ea01240f2937961a41e415e88b42cd2b22e3c133f1536a1/angular/angular-cli/issues/31609
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/62907e5b4c9c0b3f0ea01240f2937961a41e415e88b42cd2b22e3c133f1536a1/angular/angular-cli/issues/31609
og:image:altCommand test Description When using the new unit-test builder with Vitest runner, some Vitest features such as the module graph or module "mocking" with vi.mock() (https://vitest.dev/guide/mocking/...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyjaaidi
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/31609#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F31609
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F31609
Sign uphttps://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/31609
Reloadhttps://github.com/angular/angular-cli/issues/31609
Reloadhttps://github.com/angular/angular-cli/issues/31609
angularhttps://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Codehttps://github.com/angular/angular-cli
Issues198 (198)https://github.com/angular/angular-cli/issues
Pull requests23 (23)https://github.com/angular/angular-cli/pulls
Actionshttps://github.com/angular/angular-cli/actions
Security and quality8 (8)https://github.com/angular/angular-cli/security
Insightshttps://github.com/angular/angular-cli/insights
https://github.com/angular/angular-cli
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/31609
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/31609
Enhancementhttps://github.com/angular/angular-cli/issues?q=type:"Enhancement"
#32443https://github.com/angular/angular-cli/pull/32443
unit-test builder with vitest runner does not support vi.mock()https://github.com/angular/angular-cli/issues/31609#top
#32443https://github.com/angular/angular-cli/pull/32443
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
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
feature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%3A%20insufficient%20votes%22
https://github.com/yjaaidi
yjaaidihttps://github.com/yjaaidi
on Oct 27, 2025https://github.com/angular/angular-cli/issues/31609#issue-3556695455
https://vitest.dev/guide/mocking/modules.htmlhttps://vitest.dev/guide/mocking/modules.html
https://marmicode.io/blog/angular-template-code-coverage-and-future-proof-testing#:~:text=Shallow%20Testing%20is%20More%20Challenginghttps://marmicode.io/blog/angular-template-code-coverage-and-future-proof-testing#:~:text=Shallow%20Testing%20is%20More%20Challenging
yjaaidihttps://github.com/yjaaidi
on Oct 27, 2025https://github.com/angular/angular-cli/issues/31609#event-20524913588
alan-agius4https://github.com/alan-agius4
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
angular/build:unit-testhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22angular%2Fbuild%3Aunit-test%22
on Oct 30, 2025https://github.com/angular/angular-cli/issues/31609#event-20605483696
alan-agius4https://github.com/alan-agius4
Enhancementhttps://github.com/angular/angular-cli/issues?q=type:"Enhancement"
on Oct 31, 2025https://github.com/angular/angular-cli/issues/31609#event-20639711289
alan-agius4https://github.com/alan-agius4
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
on Oct 31, 2025https://github.com/angular/angular-cli/issues/31609#event-20639715211
angular-robothttps://github.com/apps/angular-robot
feature: votes requiredFeature request which is currently still in the voting phasehttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%3A%20votes%20required%22
on Oct 31, 2025https://github.com/angular/angular-cli/issues/31609#event-20639798699
https://github.com/apps/angular-robot
angular-robothttps://github.com/apps/angular-robot
on Oct 31, 2025https://github.com/angular/angular-cli/issues/31609#issuecomment-3474139972
Angular Robothttps://angular.io
documentationhttps://github.com/angular/angular/blob/e29eb8abfbfdfb793e08ac88e14b7ba6d2ff2136/docs/GITHUB_PROCESS.md#feature-request-process
https://github.com/apps/angular-robot
angular-robothttps://github.com/apps/angular-robot
on Dec 10, 2025https://github.com/angular/angular-cli/issues/31609#issuecomment-3637048360
Angular Robothttps://angular.io
documentationhttps://github.com/angular/angular/blob/e29eb8abfbfdfb793e08ac88e14b7ba6d2ff2136/docs/GITHUB_PROCESS.md#feature-request-process
https://github.com/apps/angular-robot
angular-robothttps://github.com/apps/angular-robot
on Dec 29, 2025https://github.com/angular/angular-cli/issues/31609#issuecomment-3696495630
Angular Robothttps://angular.io
communityhttps://angular.io/resources?category=community
packagehttps://angular.io/guide/creating-libraries
documentationhttps://github.com/angular/angular/blob/e29eb8abfbfdfb793e08ac88e14b7ba6d2ff2136/docs/GITHUB_PROCESS.md#feature-request-process
angular-robothttps://github.com/apps/angular-robot
feature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%3A%20insufficient%20votes%22
feature: votes requiredFeature request which is currently still in the voting phasehttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%3A%20votes%20required%22
on Dec 29, 2025https://github.com/angular/angular-cli/issues/31609#event-21778801583
clydinhttps://github.com/clydin
Vitest module mocking doesn't work in Angular 21 #32212https://github.com/angular/angular-cli/issues/32212
on Dec 31, 2025https://github.com/angular/angular-cli/issues/31609#event-21802712195
https://github.com/Kludgy4
Kludgy4https://github.com/Kludgy4
on Dec 31, 2025https://github.com/angular/angular-cli/issues/31609#issuecomment-3701304867
clydinhttps://github.com/clydin
on Feb 5, 2026https://github.com/angular/angular-cli/issues/31609#event-22568303653
feat(@angular/build): explicitly fail when using Vitest runtime mockinghttps://github.com/clydin/angular-cli/commit/1d9cc7dffdc89e1b9b3111db87cf1220340b18b1
1d9cc7dhttps://github.com/clydin/angular-cli/commit/1d9cc7dffdc89e1b9b3111db87cf1220340b18b1
fix(@angular/build): explicitly fail when using Vitest runtime mockinghttps://github.com/clydin/angular-cli/commit/3508b03131db94483212ebc116e5049d9f2f657c
3508b03https://github.com/clydin/angular-cli/commit/3508b03131db94483212ebc116e5049d9f2f657c
fix(@angular/build): explicitly fail when using Vitest runtime mockinghttps://github.com/clydin/angular-cli/commit/faf32af2b7ecaf716cc9b7ae6c46104abe493a23
faf32afhttps://github.com/clydin/angular-cli/commit/faf32af2b7ecaf716cc9b7ae6c46104abe493a23
clydinhttps://github.com/clydin
completedhttps://github.com/angular/angular-cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
fd5cb28https://github.com/angular/angular-cli/commit/fd5cb28c8082417288a896b89bde659bb0dc92e2
on Feb 9, 2026https://github.com/angular/angular-cli/issues/31609#event-22643022234
angular-robothttps://github.com/angular-robot
on Feb 9, 2026https://github.com/angular/angular-cli/issues/31609#event-22643081086
fix(@angular/build): explicitly fail when using Vitest runtime mockinghttps://github.com/angular-robot/angular-cli/commit/fd5cb28c8082417288a896b89bde659bb0dc92e2
https://docs.github.com/articles/closing-issues-via-commit-messages
fd5cb28https://github.com/angular-robot/angular-cli/commit/fd5cb28c8082417288a896b89bde659bb0dc92e2
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Mar 12, 2026https://github.com/angular/angular-cli/issues/31609#issuecomment-4043042659
automatic conversation locking policyhttps://github.com/angular/angular/blob/f0fbced1c55bc8b8ed9df01cea99df42f3e7eae3/contributing-docs/auto-issue-locking.md
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Mar 12, 2026https://github.com/angular/angular-cli/issues/31609#event-23489314429
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/31609
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/31609
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
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
feature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%3A%20insufficient%20votes%22
Enhancementhttps://github.com/angular/angular-cli/issues?q=type:"Enhancement"
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.