See #21174 for context.
We should remove these lines:
|
// We require project-base here, as waiting to require it in |
|
// the Electron process for the first time can cause the process |
|
// to hang during smoke test execution. This occurs with Electron |
|
// version v15.4.0 and after. |
|
// |
|
// TODO: Investigate need/removal of this with future major versions |
|
// of Electron when upgraded: https://github.com/cypress-io/cypress/pull/19090 |
|
require('@packages/server/lib/project-base') |
Because cypress.js should not be slowed down by unused code:
|
// we are not requiring everything up front |
|
// to optimize how quickly electron boots while |
|
// in dev or linux production. the reasoning is |
|
// that we likely may need to spawn a new child process |
|
// and its a huge waste of time (about 1.5secs) of |
|
// synchronous requires the first go around just to |
|
// essentially do it all again when we boot the correct |
|
// mode. |
|
|
Or, remove the need for cypress.js to ever run in node.
Once cypress.js's JIT requires are restored, we can clean up these areas:
- No longer will need to JIT require here, since we will no longer be requiring
makeDataContext outside of electron:
|
}, |
|
showItemInFolder (folder: string) { |
|
require('electron').shell.showItemInFolder(folder) |
|
}, |
|
showOpenDialog (props: OpenDialogOptions) { |
|
return require('electron').dialog.showOpenDialog(props) |
|
}, |
|
showSaveDialog (window: BrowserWindow, props: SaveDialogOptions) { |
|
return require('electron').dialog.showSaveDialog(window, props) |
|
}, |
|
copyTextToClipboard (text: string) { |
|
require('electron').clipboard.writeText(text) |
|
}, |
|
isMainWindowFocused () { |
|
return Windows.isMainWindowFocused() |
|
}, |
|
focusMainWindow () { |
|
return Windows.focusMainWindow() |
|
}, |
- Any other areas where we currently have to JIT require to avoid triggering errors related to
electron not being available.
See #21174 for context.
We should remove these lines:
cypress/packages/server/lib/cypress.js
Lines 3 to 10 in 244c1cc
Because
cypress.jsshould not be slowed down by unused code:cypress/packages/server/lib/cypress.js
Lines 12 to 20 in 244c1cc
Or, remove the need for
cypress.jsto ever run innode.Once
cypress.js's JITrequires are restored, we can clean up these areas:makeDataContextoutside ofelectron:cypress/packages/server/lib/makeDataContext.ts
Lines 150 to 168 in 244c1cc
electronnot being available.