Skip to content

fix: e2e test #2653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __e2e__/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`shows up current config without unnecessary output 1`] = `
{
"root": "<<REPLACED_ROOT>>/TestProject",
"reactNativePath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native",
"reactNativeVersion": "0.78",
"reactNativeVersion": "0.79",
"dependencies": {},
"commands": [
{
Expand Down
13 changes: 8 additions & 5 deletions __e2e__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ beforeEach(() => {

// Initialise React Native project
runCLI(DIR, ['init', 'TestProject', '--install-pods']);

// Link CLI to the project
spawnScript('yarn', ['link', __dirname, '--all'], {
spawnScript('yarn', ['link', '--all'], {
cwd: path.join(DIR, 'TestProject'),
});
});
Expand Down Expand Up @@ -196,9 +195,13 @@ test('should fail if using require() in ES module in react-native.config.mjs', (
'test-command-esm',
]);
expect(stderr).toMatch('error Failed to load configuration of your project');
expect(stdout).toMatch(
'ReferenceError: require is not defined in ES module scope, you can use import instead',
);
if (process.version.startsWith('v18.')) {
expect(stdout).toMatch(
'ReferenceError: require is not defined in ES module scope, you can use import instead',
);
} else {
expect(stdout).toContain('Cannot require() ES Module');
}
});

test('should fail if using require() in ES module with "type": "module" in package.json', () => {
Expand Down
2 changes: 1 addition & 1 deletion __e2e__/root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ beforeAll(() => {
runCLI(DIR, ['init', 'TestProject', `--pm`, 'npm', `--install-pods`]);

// Link CLI to the project
spawnScript('yarn', ['link', __dirname, '--all'], {
spawnScript('yarn', ['link', '--all'], {
cwd: path.join(DIR, 'TestProject'),
});
});
Expand Down
Loading