From e9a6ca2d925116da7c9424682dd884100971c285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 16 Apr 2025 10:05:29 +0200 Subject: [PATCH 1/6] fix: e2e test --- __e2e__/__snapshots__/config.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__e2e__/__snapshots__/config.test.ts.snap b/__e2e__/__snapshots__/config.test.ts.snap index da5f4d7d1..63c270c7a 100644 --- a/__e2e__/__snapshots__/config.test.ts.snap +++ b/__e2e__/__snapshots__/config.test.ts.snap @@ -4,7 +4,7 @@ exports[`shows up current config without unnecessary output 1`] = ` { "root": "<>/TestProject", "reactNativePath": "<>/TestProject/node_modules/react-native", - "reactNativeVersion": "0.78", + "reactNativeVersion": "0.79", "dependencies": {}, "commands": [ { From 1a6c17076e68e1aefca559fc6ceccab3a2ca091c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 17 Apr 2025 11:10:25 +0200 Subject: [PATCH 2/6] update expectation to reflect error change --- __e2e__/config.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/__e2e__/config.test.ts b/__e2e__/config.test.ts index 322b63829..b128e9e41 100644 --- a/__e2e__/config.test.ts +++ b/__e2e__/config.test.ts @@ -196,9 +196,7 @@ 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', - ); + expect(stdout).toContain('Cannot require() ES Module'); }); test('should fail if using require() in ES module with "type": "module" in package.json', () => { From 230b89f3d5a69c6ef576d46d753ca7b4e4e3841a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 17 Apr 2025 11:37:31 +0200 Subject: [PATCH 3/6] check node --- __e2e__/config.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/__e2e__/config.test.ts b/__e2e__/config.test.ts index b128e9e41..ad85e138d 100644 --- a/__e2e__/config.test.ts +++ b/__e2e__/config.test.ts @@ -196,7 +196,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).toContain('Cannot require() ES Module'); + 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', () => { From 3403eb4d840bd1fcb36d956bfe1af9dcbfe5ce8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 17 Apr 2025 12:23:16 +0200 Subject: [PATCH 4/6] adjust dirname --- __e2e__/config.test.ts | 3 +-- __e2e__/root.test.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/__e2e__/config.test.ts b/__e2e__/config.test.ts index ad85e138d..94ecb9b7a 100644 --- a/__e2e__/config.test.ts +++ b/__e2e__/config.test.ts @@ -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'), }); }); diff --git a/__e2e__/root.test.ts b/__e2e__/root.test.ts index 91265c592..9dd522db8 100644 --- a/__e2e__/root.test.ts +++ b/__e2e__/root.test.ts @@ -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'), }); }); From a596fb8d3e177886cdf4d9dd7d629c630af149ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 17 Apr 2025 12:29:40 +0200 Subject: [PATCH 5/6] empty From 9e5e8e96ffdd6e3cba951bf9343fd4afa0ce3fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 17 Apr 2025 13:34:08 +0200 Subject: [PATCH 6/6] no dirname --- __e2e__/config.test.ts | 2 +- __e2e__/root.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__e2e__/config.test.ts b/__e2e__/config.test.ts index 94ecb9b7a..8dfd3e90b 100644 --- a/__e2e__/config.test.ts +++ b/__e2e__/config.test.ts @@ -50,7 +50,7 @@ beforeEach(() => { // Initialise React Native project runCLI(DIR, ['init', 'TestProject', '--install-pods']); // Link CLI to the project - spawnScript('yarn', ['link', '.', '--all'], { + spawnScript('yarn', ['link', '--all'], { cwd: path.join(DIR, 'TestProject'), }); }); diff --git a/__e2e__/root.test.ts b/__e2e__/root.test.ts index 9dd522db8..8d7c93ae1 100644 --- a/__e2e__/root.test.ts +++ b/__e2e__/root.test.ts @@ -19,7 +19,7 @@ beforeAll(() => { runCLI(DIR, ['init', 'TestProject', `--pm`, 'npm', `--install-pods`]); // Link CLI to the project - spawnScript('yarn', ['link', '.', '--all'], { + spawnScript('yarn', ['link', '--all'], { cwd: path.join(DIR, 'TestProject'), }); });