Title: zone.js vitest-patch breaks all describe/it modifiers: describe.skip runs the suite, it.skip/it.todo silently vanish, .each is miswired · Issue #69748 · angular/angular · GitHub
Open Graph Title: zone.js vitest-patch breaks all describe/it modifiers: describe.skip runs the suite, it.skip/it.todo silently vanish, .each is miswired · Issue #69748 · angular/angular
X Title: zone.js vitest-patch breaks all describe/it modifiers: describe.skip runs the suite, it.skip/it.todo silently vanish, .each is miswired · Issue #69748 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? No — the bug is present in the initial vitest support (zone.js/plugins/vitest-patch) and is still present in 0.16.2. Description zone.js/plugins/vitest-...
Open Graph Description: Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? No — the bug is present in the initial vitest support (zone.js/plugins/vitest-patch) and is still present in 0.1...
X Description: Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? No — the bug is present in the initial vitest support (zone.js/plugins/vitest-patch) and is still present in 0.1...
Opengraph URL: https://github.com/angular/angular/issues/69748
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"zone.js vitest-patch breaks all describe/it modifiers: describe.skip runs the suite, it.skip/it.todo silently vanish, .each is miswired","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nzone.js\n\n### Is this a regression?\n\nNo — the bug is present in the initial vitest support (`zone.js/plugins/vitest-patch`) and is still present in 0.16.2.\n\n### Description\n\n`zone.js/plugins/vitest-patch` re-wraps `describe`/`suite`/`it`/`test` for zone support and also replaces all of their modifiers (`skip`, `only`, `todo`, `each`, `for`, `skipIf`, `runIf`, `concurrent`, `sequential`, `shuffle`). The replacement treats **every** modifier as an `.each`-style curried factory **and** calls the plain base function instead of the modifier, which breaks all of them:\n\n```js\n// packages/zone.js/lib/vitest/vitest.ts (fesm2015/vitest-patch.js in the dist)\n\n// describe modifiers:\nfor (const factoryName of DESCRIBE_FACTORY_NAMES) {\n context[methodName][factoryName] = function (...factoryArgs) {\n const originalDescribeFn = originalVitestFn.apply(this, factoryArgs); // (1)\n return function (...args) { // (2)\n args[1] = wrapDescribeInZone(args[1]);\n return originalDescribeFn.apply(this, args);\n };\n };\n}\n\n// it/test modifiers:\nfor (const factoryName of TEST_FACTORY_NAMES) {\n context[methodName][factoryName] = function (...factoryArgs) {\n return function (...args) { // (3)\n args[1] = wrapTestInZone(args[1]);\n return originalVitestFn.apply(this, factoryArgs).apply(this, args);\n };\n };\n}\n```\n\nConcrete consequences:\n\n- **`describe.skip('name', fn)` registers a NORMAL suite — the skip is silently dropped and the tests run** (and can fail). At (1), `originalVitestFn.apply(this, ['name', fn])` is just `describe('name', fn)`, executed immediately; the function returned at (2) is never called by user code, and the suite body registered at (1) is also not zone-wrapped.\n- **`it.skip(...)`, `it.todo(...)`, `it.only(...)`, etc. silently vanish from the run.** The modifier returns the inner function at (3), which user code never invokes, so nothing is registered at all. Skip/todo counts read 0 and the tests disappear from the report without a trace.\n- **Even the genuinely curried modifiers (`each`, `for`) are broken**, because (1)/(3) call `originalVitestFn` (plain `describe`/`it`) instead of `originalVitestFn[factoryName]`. `describe.each(table)('name %s', fn)` executes `describe(table)` — the table object as the suite name.\n- Chained modifiers (`it.skip.each(...)`) and props like `describe.todo` are likewise broken.\n\nThe unpatched originals are stashed under `Zone.__symbol__('describe')` / `('suite')` / `('it')` / `('test')`, which is what makes the workaround below possible.\n\nThe fix shape: non-curried modifiers (`skip`, `only`, `todo`, `concurrent`, `sequential`, `shuffle`) need the same wrapping as the base function but delegating to `originalVitestFn[factoryName]`; curried ones (`each`, `for`, `skipIf`, `runIf`) need `originalVitestFn[factoryName](...factoryArgs)` first, then arg-wrapping in the returned registrar. (`skipIf`/`runIf` are condition-curried: `it.skipIf(cond)(name, fn)`.)\n\n### Please provide a link to a minimal reproduction of the bug\n\nInline reproduction — any zone-based Angular CLI v21 app using the `unit-test` builder with `runner: \"vitest\"` (which auto-loads `zone.js/plugins/vitest-patch`), or any Vitest setup that imports `zone.js`, `zone.js/testing`'s Proxy/SyncTest zone specs, and `zone.js/plugins/vitest-patch`:\n\n```ts\n// repro.spec.ts\ndescribe.skip('skipped suite', () => {\n it('must not run', () => {\n throw new Error('describe.skip ran anyway');\n });\n});\n\ndescribe('modifiers', () => {\n it.skip('skipped test', () => {\n throw new Error('never');\n });\n it.todo('todo test');\n it('control', () => {\n expect(true).toBe(true);\n });\n});\n```\n\nExpected (plain Vitest): `1 passed | 2 skipped | 1 todo`, no failures.\n\nActual with `vitest-patch`: the `describe.skip` suite runs and fails with `describe.skip ran anyway`; `it.skip` and `it.todo` are absent from the report entirely — `1 failed | 1 passed`, skipped/todo counts are 0.\n\n### Please provide the exception or error you saw\n\nNo exception from zone.js itself — that's the dangerous part. Suites the author explicitly skipped (e.g. because they're known-broken) execute and fail, and `it.skip`/`it.todo` tests silently disappear, so a migrated suite under-reports its own size with no signal.\n\nObserved while migrating a 433-file / 735-test Angular 21 suite from Karma to the `@angular/build:unit-test` Vitest runner: every `describe.skip` suite began executing (NG0201 failures etc.), and the run's skip count read 0 while the total test count dropped versus Karma.\n\n### Workaround\n\nRestore the original modifiers from the stashed unpatched functions in a `setupFiles` entry (safe as long as the suite doesn't rely on zone wrapping inside `.only`/`.each` bodies — skipped/todo bodies never execute anyway):\n\n```ts\nconst g = globalThis as any;\nconst zoneSymbol = g.Zone.__symbol__;\nconst MODIFIERS = [\n 'skip', 'skipIf', 'runIf', 'only', 'concurrent',\n 'sequential', 'shuffle', 'todo', 'each', 'for'\n];\nfor (const name of ['describe', 'suite', 'it', 'test']) {\n const original = g[zoneSymbol(name)];\n const patched = g[name];\n if (!original || !patched || original === patched) continue;\n for (const mod of MODIFIERS) {\n if (typeof original[mod] === 'function') {\n patched[mod] = original[mod].bind(original);\n }\n }\n}\n```\n\n### Please provide the environment you discovered this bug in\n\n- zone.js: 0.16.2\n- vitest: 4.1.10 (browser mode, `@vitest/browser-playwright` 4.1.10, headless Chromium)\n- @angular/build: 21.2.9 (`unit-test` builder, `runner: \"vitest\"`)\n- @angular/core: 21.2.10\n- OS: Windows 11, Node 20.19\n\n### Anything else?\n\nThe `beforeEach`/`afterEach`/`beforeAll`/`afterAll` patching in the same file is fine — only the modifier/factory loops are affected.\n","author":{"url":"https://github.com/janiis-scott","@type":"Person","name":"janiis-scott"},"datePublished":"2026-07-12T04:36:01Z","url":"https://github.com/angular/angular/issues/69748"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6ada24c6-517f-e4d4-88a7-c9aa63289a01 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D94C:1DCB8C:12897B3:188227D:6B011872 |
| html-safe-nonce | 8083c0e53f575af251d751bb7b9d0b2102cd40ddfcaffce8f5d0e2504b828d4a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTRDOjFEQ0I4QzoxMjg5N0IzOjE4ODIyN0Q6NkIwMTE4NzIiLCJ2aXNpdG9yX2lkIjoiNTQ3OTU3Nzg3NzU0MzA1NjUwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | baa54899147e4be8b81d6b4aa61f83453f9a4d057afdf7da3a233759a4a4809e |
| hovercard-subject-tag | issue:4865418532 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/69748/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e01157a4f8dffa2837d056647592b985d5e8d1d78be11f2a2c0bbf845d2e8b0f/angular/angular/issues/69748 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e01157a4f8dffa2837d056647592b985d5e8d1d78be11f2a2c0bbf845d2e8b0f/angular/angular/issues/69748 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? No — the bug is present in the initial vitest support (zone.js/plugins/vitest-patch) and is still present in 0.1... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | janiis-scott |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width