From 0cccc70b9b942e6925c64eae56c3f2e2df7d6a02 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Thu, 26 Mar 2020 16:34:34 +1100 Subject: [PATCH] Fix integration test running on the wrong environment --- app/config.js | 2 +- app/sql_channel.js | 2 +- integration_test/common.js | 3 +-- main.js | 11 +++++------ package.json | 2 +- preload.js | 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/config.js b/app/config.js index d3a97becb..6156d7f41 100644 --- a/app/config.js +++ b/app/config.js @@ -20,7 +20,7 @@ process.env.NODE_CONFIG_DIR = path.join(__dirname, '..', 'config'); if (environment === 'production') { // harden production config against the local env process.env.NODE_CONFIG = ''; - process.env.NODE_CONFIG_STRICT_MODE = true; + process.env.NODE_CONFIG_STRICT_MODE = !isDevelopment; process.env.HOSTNAME = ''; process.env.ALLOW_CONFIG_MUTATIONS = ''; process.env.SUPPRESS_NO_CONFIG_WARNING = ''; diff --git a/app/sql_channel.js b/app/sql_channel.js index f7e3a177e..f4b99ecea 100644 --- a/app/sql_channel.js +++ b/app/sql_channel.js @@ -37,7 +37,7 @@ function initialize() { `sql channel error with call ${callName}: ${errorForDisplay}` ); // FIXME this line cause the test-integration to fail and we probably don't need it during test - if (!process.env.NODE_APP_INSTANCE.includes('test-integration')) { + if (!process.env.NODE_ENV.includes('test-integration')) { event.sender.send(`${SQL_CHANNEL_KEY}-done`, jobId, errorForDisplay); } } diff --git a/integration_test/common.js b/integration_test/common.js index 35e2067ec..53f3aef25 100644 --- a/integration_test/common.js +++ b/integration_test/common.js @@ -55,8 +55,7 @@ module.exports = { path: path.join(__dirname, '..', 'node_modules', '.bin', 'electron'), args: ['.'], env: { - NODE_APP_INSTANCE: env, - NODE_ENV: 'production', + NODE_ENV: env, USE_STUBBED_NETWORK: true, ELECTRON_ENABLE_LOGGING: true, ELECTRON_ENABLE_STACK_DUMPING: true, diff --git a/main.js b/main.js index c32457be9..092fd52a4 100644 --- a/main.js +++ b/main.js @@ -899,7 +899,7 @@ app.on('window-all-closed', () => { config.environment === 'test' || config.environment === 'test-lib' || config.environment === 'test-loki' || - config.environmen.includes('test-integration') + config.environment.includes('test-integration') ) { app.quit(); } @@ -950,11 +950,10 @@ ipc.on('add-setup-menu-items', () => { }); ipc.on('draw-attention', () => { - if (process.platform === 'darwin') { - app.dock.bounce(); - } else if (process.platform === 'win32') { - mainWindow.flashFrame(true); - } else if (process.platform === 'linux') { + if (!mainWindow) { + return; + } + if (process.platform === 'win32' || process.platform === 'linux') { mainWindow.flashFrame(true); } }); diff --git a/package.json b/package.json index 6cc5f7249..ae9fe41d0 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test-lib-view": "NODE_ENV=test-lib yarn run start", "test-loki-view": "NODE_ENV=test-loki yarn run start", "test-electron": "yarn grunt test", - "test-integration-session": "ELECTRON_DISABLE_SANDBOX=1 mocha --exit --timeout 5000 integration_test/integration_test.js", + "test-integration": "ELECTRON_DISABLE_SANDBOX=1 mocha --exit --timeout 5000 integration_test/integration_test.js", "test-node": "mocha --recursive --exit test/app test/modules ts/test libloki/test/node", "eslint": "eslint --cache .", "eslint-fix": "eslint --fix .", diff --git a/preload.js b/preload.js index 6232c2cd5..c61462fc0 100644 --- a/preload.js +++ b/preload.js @@ -52,8 +52,8 @@ window.getDefaultFileServer = () => config.defaultFileServer; window.initialisedAPI = false; if ( - typeof process.env.NODE_APP_INSTANCE === 'string' && - process.env.NODE_APP_INSTANCE.includes('test-integration') + typeof process.env.NODE_ENV === 'string' && + process.env.NODE_ENV.includes('test-integration') ) { window.electronRequire = require; }