Fix React Developer Tools for some users (#2783)

* Fix react dev tools test

* Fix test
This commit is contained in:
Devin Binnie
2023-07-11 11:32:49 -04:00
committed by GitHub
parent e4e38dc000
commit adf4b40836
4 changed files with 737 additions and 121 deletions

View File

@@ -79,7 +79,7 @@ jest.mock('main/i18nManager', () => ({
setLocale: jest.fn(),
}));
jest.mock('electron-devtools-installer', () => {
jest.mock('electron-extension-installer', () => {
return () => ({
REACT_DEVELOPER_TOOLS: 'react-developer-tools',
});

View File

@@ -4,7 +4,7 @@
import path from 'path';
import {app, ipcMain, nativeTheme, session} from 'electron';
import installExtension, {REACT_DEVELOPER_TOOLS} from 'electron-devtools-installer';
import installExtension, {REACT_DEVELOPER_TOOLS} from 'electron-extension-installer';
import isDev from 'electron-is-dev';
import {
@@ -335,7 +335,11 @@ async function initializeAfterAppReady() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (global.isDev || __IS_NIGHTLY_BUILD__) {
installExtension(REACT_DEVELOPER_TOOLS).
installExtension(REACT_DEVELOPER_TOOLS, {
loadExtensionOptions: {
allowFileAccess: true,
},
}).
then((name) => log.info(`Added Extension: ${name}`)).
catch((err) => log.error('An error occurred: ', err));
}