@@ -28,14 +28,13 @@ describe('amplify pull with uibuilder', () => {
28
28
let appId : string ;
29
29
30
30
const envName = 'integtest' ;
31
+ // fixes recent esm module changes by removing require('cypress'), while still disabling supportFile
31
32
const cypressConfig = `
32
- const { defineConfig } = require('cypress')
33
-
34
- module.exports = defineConfig({
33
+ module.exports = {
35
34
e2e: {
36
35
supportFile: false
37
36
}
38
- })
37
+ }
39
38
` ;
40
39
beforeEach ( async ( ) => {
41
40
projRoot = await createNewProjectDir ( 'pull-uibuilder' ) ;
@@ -98,7 +97,9 @@ describe('amplify pull with uibuilder', () => {
98
97
spawnSync (
99
98
getNpmPath ( ) ,
100
99
// 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' ] ,
102
103
{ cwd : reactDir } ,
103
104
) ;
104
105
@@ -110,11 +111,13 @@ describe('amplify pull with uibuilder', () => {
110
111
`${ reactDir } /cypress/e2e/sample_spec.cy.js` ,
111
112
fs . readFileSync ( path . join ( __dirname , '..' , 'cypress' , 'uibuilder' , 'uibuilder-spec.js' ) ) ,
112
113
) ;
113
-
114
114
const npmStartProcess = spawn ( getNpmPath ( ) , [ 'start' ] , { cwd : reactDir , timeout : 300000 } ) ;
115
115
// Give react server time to start
116
116
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
+ } ) ;
118
121
// kill the react server process
119
122
spawnSync ( 'kill' , [ `${ npmStartProcess . pid } ` ] , { encoding : 'utf8' } ) ;
120
123
await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ;
0 commit comments