@@ -28,14 +28,13 @@ describe('amplify pull with uibuilder', () => {
2828 let appId : string ;
2929
3030 const envName = 'integtest' ;
31+ // fixes recent esm module changes by removing require('cypress'), while still disabling supportFile
3132 const cypressConfig = `
32- const { defineConfig } = require('cypress')
33-
34- module.exports = defineConfig({
33+ module.exports = {
3534 e2e: {
3635 supportFile: false
3736 }
38- })
37+ }
3938 ` ;
4039 beforeEach ( async ( ) => {
4140 projRoot = await createNewProjectDir ( 'pull-uibuilder' ) ;
@@ -98,7 +97,9 @@ describe('amplify pull with uibuilder', () => {
9897 spawnSync (
9998 getNpmPath ( ) ,
10099 // in some runs spawnSync/npx will still use an old ver of react-scripts moving it into npm install flow
101- [ 'install' , '-E' , '@types/react' , 'cypress' , '@aws-amplify/ui-react' , 'aws-amplify' , 'react-scripts@5' ] ,
100+ // using '--legacy-peer-deps' here as support for react 19 is not quite ready:
101+ // see: https://github.com/aws-amplify/amplify-ui/issues/6084
102+ [ 'install' , '-E' , '@types/react' , 'cypress' , '@aws-amplify/ui-react' , 'aws-amplify' , 'react-scripts@5' , '--legacy-peer-deps' ] ,
102103 { cwd : reactDir } ,
103104 ) ;
104105
@@ -110,11 +111,13 @@ describe('amplify pull with uibuilder', () => {
110111 `${ reactDir } /cypress/e2e/sample_spec.cy.js` ,
111112 fs . readFileSync ( path . join ( __dirname , '..' , 'cypress' , 'uibuilder' , 'uibuilder-spec.js' ) ) ,
112113 ) ;
113-
114114 const npmStartProcess = spawn ( getNpmPath ( ) , [ 'start' ] , { cwd : reactDir , timeout : 300000 } ) ;
115115 // Give react server time to start
116116 await new Promise ( ( resolve ) => setTimeout ( resolve , 60000 ) ) ;
117- const res = execa . sync ( getNpxPath ( ) , [ 'cypress' , 'run' ] , { cwd : reactDir , encoding : 'utf8' } ) ;
117+ const res = execa . sync ( getNpxPath ( ) , [ 'cypress' , 'run' ] , {
118+ cwd : reactDir ,
119+ encoding : 'utf8' ,
120+ } ) ;
118121 // kill the react server process
119122 spawnSync ( 'kill' , [ `${ npmStartProcess . pid } ` ] , { encoding : 'utf8' } ) ;
120123 await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ;
0 commit comments