Skip to content

Commit c1d60c4

Browse files
authored
fix: UIBuilder test (#14047)
* chore: unset node options in ui builder test * chore: try this * chore: try this * chore: fix for react 19 lack of support * chore: fix this
1 parent 0ed65da commit c1d60c4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/amplify-e2e-tests/src/__tests__/uibuilder.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)