Skip to content

Commit f94725e

Browse files
committed
fix: update Cypress config and support files to use proper ES module syntax
1 parent 7121a44 commit f94725e

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

cypress.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { defineConfig } from 'cypress';
22

33
export default defineConfig({
4+
// Add this to ensure proper ES module handling
5+
experimentalWebKitSupport: true,
6+
experimentalMemoryManagement: true,
47
component: {
58
devServer: {
69
framework: 'react',

cypress/e2e/mainPage.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import MainPage from '../../src/components/MainPage';
2+
13
describe('MainPage Component', () => {
24
const testUsername = 'testuser123';
35

cypress/support/component.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import { mount } from 'cypress/react18';
22
import '../../src/index.css';
33

4-
// Augment the Cypress namespace to include type definitions for
5-
// your custom command.
6-
declare global {
7-
namespace Cypress {
8-
interface Chainable {
9-
mount: typeof mount;
4+
// Add proper ES module exports
5+
export const setupMount = () => {
6+
// Augment the Cypress namespace to include type definitions for
7+
// your custom command.
8+
declare global {
9+
namespace Cypress {
10+
interface Chainable {
11+
mount: typeof mount;
12+
}
1013
}
1114
}
12-
}
1315

14-
Cypress.Commands.add('mount', mount);
16+
Cypress.Commands.add('mount', mount);
17+
};
18+
19+
// Initialize the mount command
20+
setupMount();

cypress/support/e2e.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import './commands';
22

3-
// Handle WSL2 specific configurations
4-
if (Cypress.platform === 'linux') {
3+
// Export the setup function
4+
export const setupWSL2Config = () => {
5+
// Handle WSL2 specific configurations
6+
if (Cypress.platform === 'linux') {
57
Cypress.config('chromeWebSecurity', false);
68
Cypress.config('baseUrl', 'http://localhost:3000');
79

@@ -36,4 +38,7 @@ if (Cypress.platform === 'linux') {
3638

3739
return originalFn(subject, expectation, ...args).catch(tryAgain);
3840
});
39-
}
41+
};
42+
43+
// Initialize the WSL2 configuration
44+
setupWSL2Config();

0 commit comments

Comments
 (0)