-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat: add cypress/angular-zoneless testing harness for Angular 21 (also supports Angular 20)
#33025
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
base: feat/support_angular_21
Are you sure you want to change the base?
feat: add cypress/angular-zoneless testing harness for Angular 21 (also supports Angular 20)
#33025
Conversation
…ritable signals to an observable
5700a7b to
b3a6a49
Compare
6b71efe to
a1b2377
Compare
…se zoneless support FIRST before we can have the schematic support angular 21
a1b2377 to
15f446b
Compare
| }).subscribe((value) => { | ||
| component[expectedChangeKey]?.emit(value) | ||
| }) | ||
| activeInternalSubscriptions.push( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing a bug here? don't think we need a changelog because nothing was reported but cursorbot did detect a possible memory leak here
| const cypressSchematicPackagePath = path.join(__dirname, '..') | ||
|
|
||
| const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-20', 'angular-21'] | ||
| const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-19', 'angular-20'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to downgrade the test because the zoneless handler isn't supported within the binary yet (see the PR description)
| "jsdom": "^27.1.0", | ||
| "typescript": "~5.9.2", | ||
| "vitest": "^4.0.8", | ||
| "zone.js": "~0.15.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removes the zone.js dependency as promised
| }, | ||
| } | ||
|
|
||
| cy.mount(ProductComponent, { providers: [{ provider: Cart, useValue: cartFake }] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test uses wrong property name for Angular DI
The test "should verify a faked service" uses provider: Cart instead of the correct Angular DI property provide: Cart. Angular's dependency injection requires provide as the property key - using provider causes Angular to ignore the configuration entirely. The test still passes because both the fake and real Cart implementations have identical behavior, but this test doesn't actually verify provider overrides work as intended.
10e9b77 to
70ce43b
Compare
Additional details
Adds a zoneless component testing harness for Angular 20 (experimental) and Angular 21. Angular 21 ships with zoneless and Cypress will scaffold
cypress/angular-zonelessfor Angular 21+ projects.Because this is likely going to be the
nexttarget forcypress/angularand the recommended pattern for data-binding is now signals, this testing harness will be removeautoDetectChangesas this happens naturally andautoSpyOutputsas@Outputdecorators are legacy and can be created manually viacreateSpyOutputs.Additionally, with the addition of the
zonelessmount handler, theangular-21system test project needs it's own set of fixtures, which will eventually be moved into the main fixture directory (as a replacement) once Angular 18 and 19 support are officially dropped from Cypress.After this releases, we need to update
@cypress/schematicto support Angular 21 as the scaffolded files via the schematic CLI are not correct. I have a WIP of this on #33027 and it must be done AFTER this feature is releasedSteps to test
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?Note
Introduces a new zoneless Angular component testing harness and integrates it across CLI, CI, scaffolding, and system tests (including Angular 21).
@cypress/angular-zonelesswithmountAPI usingprovideZonelessChangeDetection, signal syncing, and cleanup.cypress/angular-zoneless(exports, files, post-build copy, ignores).@cypress/angular-zonelessto rootCHANGELOG.md; CLI changelog notes zoneless support.npm-angular-zonelessjob and include in main and PR workflows; update branch filters; bump cache key.cypress/angular-zonelessfor Angular>=21; support file generation tests updated.system-tests/projects/angular-21(zoneless setup, specs, config without zone.js) and include in system test matrix; adjust webpack-dev-server Angular 21 expectations.Written by Cursor Bugbot for commit 70ce43b. This will update automatically on new commits. Configure here.