Skip to content

Commit e3ee135

Browse files
authored
feat: support keeping app open after run via --env.stayOpen (#48)
1 parent 719a7e1 commit e3ee135

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

app/main-view-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { TestExecutionService } from './services/test-execution-service';
66
import { killProcess } from "./stop-process";
77

88
declare var global: any;
9+
declare const __TEST_RUNNER_STAY_OPEN__: boolean;
910

1011
function enableSocketIoDebugging() {
1112
console.log('enabling socket.io debugging');
@@ -171,7 +172,9 @@ export class TestBrokerViewModel extends Observable {
171172
acknowledged = true;
172173
console.log('NSUTR: completeAck');
173174
this.emitToSocket('disconnect');
174-
setTimeout(() => killProcess(), 500);
175+
if (typeof __TEST_RUNNER_STAY_OPEN__ === 'undefined' || !__TEST_RUNNER_STAY_OPEN__) {
176+
setTimeout(() => killProcess(), 500);
177+
}
175178
};
176179
this.emitToSocket('complete', data || {}, ackFn);
177180
setTimeout(ackFn, 1000); // acknowledge is no longer sent by the karma server, so we use a timeout to ensure it runs

nativescript.webpack.js

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ function setupKarmaBuild(config, env, webpack) {
5353
config.module.rules.delete('angular');
5454
}
5555
// config.plugins.delete('CleanWebpackPlugin')
56+
config.plugin('DefinePlugin').tap((args) => {
57+
args[0] = merge(args[0], {
58+
__TEST_RUNNER_STAY_OPEN__: !!env.stayOpen,
59+
});
60+
61+
return args;
62+
});
63+
5664

5765

5866
config.output.delete('path'); // use temp path

0 commit comments

Comments
 (0)