Skip to content

Commit 7f08fd1

Browse files
Do not schedule execution in case --watch is not set
In case `--watch` is not set, CLI will set `singleRun` option of karma config to true. This way on browser register event, karma will automatically run the tests. In case `--watch` is set, any change in code should start new tests, so when browser is registered, schedule new execution and karma will add the test execution to the queue and execute them when available.
1 parent 71d762b commit 7f08fd1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ function NativeScriptLauncher(baseBrowserDecorator, logger, config, args, emitte
3838

3939
self.markCaptured();
4040

41-
executor.schedule();
41+
// In case --watch is passed to CLI, each change in file should restart the tests.
42+
// When a new browser is registered, in case `singleRun` is false (that's when --watch is not passed)
43+
// tests should be scheduled.
44+
// When `singleRun` is true, karma automatically runs the tests when browser is registered,
45+
// so do not schedule them in this case.
46+
if(launcherConfig.options.watch) {
47+
executor.schedule();
48+
}
4249
});
4350

4451
function logDebugOutput(data) {

0 commit comments

Comments
 (0)