-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[BUG] After executing the electron test, the error "Cannot read properties of undefined (reading 'require')" is reported #28048
[BUG] After executing the electron test, the error "Cannot read properties of undefined (reading 'require')" is reported #28048
Comments
Full stack:
Good npm install [email protected] RANGE: electron/electron@v28.0.0-nightly.20230828...v28.0.0-nightly.20230831 Repro: diff --git a/package.json b/package.json
index d489bedaa..aa41f0434 100644
--- a/package.json
+++ b/package.json
@@ -82,6 +82,7 @@
"cross-env": "^7.0.3",
"dotenv": "^16.0.0",
"electron": "19.0.11",
+ "electron-nightly": "^29.0.0-nightly.20231115",
"electron-to-chromium": "^1.4.212",
"enquirer": "^2.3.6",
"esbuild": "^0.18.11",
diff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.ts
index eeb27552a..3a4849036 100644
--- a/packages/playwright-core/src/server/electron/electron.ts
+++ b/packages/playwright-core/src/server/electron/electron.ts
@@ -150,7 +150,7 @@ export class Electron extends SdkObject {
try {
// By default we fallback to the Electron App executable path.
// 'electron/index.js' resolves to the actual Electron App.
- command = require('electron/index.js');
+ command = require('electron-nightly/index.js');
} catch (error: any) {
if ((error as NodeJS.ErrnoException)?.code === 'MODULE_NOT_FOUND') {
throw new Error('\n' + wrapInASCIIBox([ |
From the bisect range, electron/electron#37535 looks most likely. |
Turns out
or
is undefined after this version. And we need this in order get access to the electron object inside our code as per
|
- downgrade electron until Playwright issue is fixed: microsoft/playwright#28048 Signed-off-by: Maxim Stykow <[email protected]>
- downgrade electron until Playwright issue is fixed: microsoft/playwright#28048 Signed-off-by: Maxim Stykow <[email protected]>
Electron 27 is still used, because Electron 28 doesn't work well with Playwright yet. See Playwright issue #28048 microsoft/playwright#28048 markdown-it-emoji did a breaking change which makes it necessary to change the "require" call. Formatting via Prettier was changed slightly, which caused a change in the "aboutDialog" module.
**User-Facing Changes** N/A **Description** Update Electron version to the latest version 33 Also, Playwright had to be updated, as the versions after Electron v28 have a small incompatibility. An extra step on pipeline was created to install the new browsers needed from the new Playwright version: microsoft/playwright#28048 Also, it was changed the react-virtualized package to react-virtualized-auto-sizer, as it is an stand alone package resulting in a smaller bundle. **Checklist** - [N/A] The web version was tested and it is running ok - [x] The desktop version was tested and it is running ok - [N/A] This change is covered by unit tests - [N/A] Files constants.ts, types.ts and *.style.ts have been checked and relevant code snippets have been relocated
System info
After I upgraded the project's Electron version to v28, if I execute the test, I get an error:
Versions less than 28 do not have this error:
Source code
Link to the GitHub repository with the repro
https://github.com/duan602728596/electron-v28-bug-demo
Steps
Expected
Run test success.
Actual
Run test failed.
The text was updated successfully, but these errors were encountered: