Fix double navigation when showing test results #1626
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
tns test <platform>
is called and results are shown, the results page is refreshed as there's another navigation.The problem is that CLI sets karma's
singleRun
option to true and also when browser is registered,karma-nativescript-launcher
schedules execution of tests on the new browser.In fact karma itself starts the tests on
browser register
event when thesingleRun
option is true. In our case we have double execution, so we receive theexecute
event two times (it's handled innativescript-unit-test-runner
).We've handled the second execution to prevent tests running, but in fact, we should receive single
execute
event.Fix this by passing watch option to
karma-nativescript-launcher
, where we'll not schedule new execution in case watch option is false. This way karma itself will start the tests assingleRun
option is true.This will fix the double navigation when showing test results.
Releated PR: NativeScript/karma-nativescript-launcher#24
Fixes #1625