@@ -15,11 +15,18 @@ const runCommandInProject = (command: string, projectPath: string) => {
1515// @cypress /angular won't exist in the tmp project. To fix this, we replace the
1616// contents of the <project-path>/node_modules/cypress/angular with the latest
1717// contents of cli/angular
18- const copyAngularMount = async ( projectPath : string ) => {
19- await fs . copy (
20- path . join ( __dirname , '..' , '..' , '..' , 'cli' , 'angular' ) ,
21- path . join ( projectPath , 'node_modules' , 'cypress' , 'angular' ) ,
22- )
18+ const copyAngularMount = async ( projectPath : string , copyZonelessMount : boolean = false ) => {
19+ if ( copyZonelessMount ) {
20+ await fs . copy (
21+ path . join ( __dirname , '..' , '..' , '..' , 'cli' , 'angular-zoneless' ) ,
22+ path . join ( projectPath , 'node_modules' , 'cypress' , 'angular-zoneless' ) ,
23+ )
24+ } else {
25+ await fs . copy (
26+ path . join ( __dirname , '..' , '..' , '..' , 'cli' , 'angular' ) ,
27+ path . join ( projectPath , 'node_modules' , 'cypress' , 'angular' ) ,
28+ )
29+ }
2330}
2431
2532const cypressSchematicPackagePath = path . join ( __dirname , '..' )
@@ -54,8 +61,16 @@ describe('ng add @cypress/schematic / e2e and ct', function () {
5461
5562 it ( 'should generate component alongside component spec' , async ( ) => {
5663 await runCommandInProject ( 'yarn ng add @cypress/schematic --e2e --component' , projectPath )
57- await copyAngularMount ( projectPath )
58- await runCommandInProject ( 'yarn ng generate c foo' , projectPath )
64+ // make sure to copy the zoneless mount function for angular 21+
65+ await copyAngularMount ( projectPath , true )
66+ if ( project === 'angular-21' ) {
67+ // our angular 21 project is a pure standalone project, so we need to pass in the --standalone flag to ignore module generation.
68+ // this may be no longer true if we update the schematic dependencies
69+ await runCommandInProject ( 'yarn ng generate c foo --standalone' , projectPath )
70+ } else {
71+ await runCommandInProject ( 'yarn ng generate c foo ' , projectPath )
72+ }
73+
5974 await runCommandInProject ( 'yarn ng run angular:ct --watch false --spec src/app/foo/foo.component.cy.ts' , projectPath )
6075 } , timeout )
6176 } )
0 commit comments