diff --git a/app/main-view-model.ts b/app/main-view-model.ts index 3c3558d..528ed52 100644 --- a/app/main-view-model.ts +++ b/app/main-view-model.ts @@ -6,6 +6,7 @@ import { TestExecutionService } from './services/test-execution-service'; import { killProcess } from "./stop-process"; declare var global: any; +declare const __TEST_RUNNER_STAY_OPEN__: boolean; function enableSocketIoDebugging() { console.log('enabling socket.io debugging'); @@ -171,7 +172,9 @@ export class TestBrokerViewModel extends Observable { acknowledged = true; console.log('NSUTR: completeAck'); this.emitToSocket('disconnect'); - setTimeout(() => killProcess(), 500); + if (typeof __TEST_RUNNER_STAY_OPEN__ === 'undefined' || !__TEST_RUNNER_STAY_OPEN__) { + setTimeout(() => killProcess(), 500); + } }; this.emitToSocket('complete', data || {}, ackFn); setTimeout(ackFn, 1000); // acknowledge is no longer sent by the karma server, so we use a timeout to ensure it runs diff --git a/nativescript.webpack.js b/nativescript.webpack.js index 4e910f6..dad4f8d 100644 --- a/nativescript.webpack.js +++ b/nativescript.webpack.js @@ -53,6 +53,14 @@ function setupKarmaBuild(config, env, webpack) { config.module.rules.delete('angular'); } // config.plugins.delete('CleanWebpackPlugin') + config.plugin('DefinePlugin').tap((args) => { + args[0] = merge(args[0], { + __TEST_RUNNER_STAY_OPEN__: !!env.stayOpen, + }); + + return args; + }); + config.output.delete('path'); // use temp path