mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
SDA-3833 (Update isDevEnv check) (#2070)
* SDA-3833 - Update isDevEnv check * SDA-3833 - Update isDevEnv for unit tests
This commit is contained in:
parent
d5647f0170
commit
b862bd5561
@ -1,7 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Demo (Build & Run)" type="NodeJSConfigurationType" application-parameters=". --url=file://$PROJECT_DIR$/src/demo/index.html" path-to-node="$PROJECT_DIR$/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron" working-dir="$PROJECT_DIR$">
|
||||
<envs>
|
||||
<env name="ELECTRON_DEV" value="true" />
|
||||
<env name="ELECTRON_FORCE_IS_PACKAGED" value="true" />
|
||||
<env name="ELECTRON_DEBUGGING" value="true" />
|
||||
</envs>
|
||||
<method v="2">
|
||||
|
@ -31,7 +31,7 @@
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"start": "run-s compile browserify && cross-env ELECTRON_DEV=true electron .",
|
||||
"test": "run-s lint test:unit",
|
||||
"test:unit": "cross-env ELECTRON_QA=true jest --config jest-config.json --runInBand --detectOpenHandles",
|
||||
"test:unit": "cross-env ELECTRON_FORCE_IS_PACKAGED=false ELECTRON_QA=true jest --config jest-config.json --runInBand --detectOpenHandles",
|
||||
"unpacked-mac": "npm run prebuild && npm run test && ./node_modules/.bin/electron-builder build --mac",
|
||||
"unpacked-win": "npm run prebuild && npm run test && node_modules\\.bin\\electron-builder build --win --x64"
|
||||
},
|
||||
|
@ -7,6 +7,24 @@ jest.mock('electron-log');
|
||||
jest.mock('../src/app/auto-update-handler', () => {
|
||||
return {};
|
||||
});
|
||||
jest.mock('../src/common/env', () => {
|
||||
return {
|
||||
isWindowsOS: true,
|
||||
isLinux: false,
|
||||
isMac: false,
|
||||
isDevEnv: true,
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('../src/common/logger', () => {
|
||||
return {
|
||||
logger: {
|
||||
setLoggerWindow: jest.fn(),
|
||||
error: jest.fn(),
|
||||
info: jest.fn(),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
describe('config', () => {
|
||||
const configFileName: string = 'Symphony.config';
|
||||
|
@ -1,6 +1,5 @@
|
||||
export const isDevEnv = process.env.ELECTRON_DEV
|
||||
? process.env.ELECTRON_DEV.trim().toLowerCase() === 'true'
|
||||
: false;
|
||||
import { app } from 'electron';
|
||||
export const isDevEnv = !app?.isPackaged;
|
||||
export const isElectronQA = !!process.env.ELECTRON_QA;
|
||||
|
||||
export const isMac = process.platform === 'darwin';
|
||||
|
Loading…
Reference in New Issue
Block a user