Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double navigation when showing test results #1626

Merged
merged 1 commit into from
Mar 21, 2016

Conversation

rosen-vladimirov
Copy link
Contributor

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 the singleRun option is true. In our case we have double execution, so we receive the execute event two times (it's handled in nativescript-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 as singleRun option is true.
This will fix the double navigation when showing test results.

Releated PR: NativeScript/karma-nativescript-launcher#24
Fixes #1625

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 the `singleRun` option is true. In our case we have double execution, so we receive the `execute` event two times (it's handled in `nativescript-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 as `singleRun` option is true.
This will fix the double navigation when showing test results.
@rosen-vladimirov rosen-vladimirov self-assigned this Mar 20, 2016
@rosen-vladimirov rosen-vladimirov added this to the 1.7.1 milestone Mar 20, 2016
@teobugslayer
Copy link
Contributor

👍

rosen-vladimirov added a commit that referenced this pull request Mar 21, 2016
…e-restart

Fix double navigation when showing test results
@rosen-vladimirov rosen-vladimirov merged commit e532589 into release Mar 21, 2016
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-tests-double-restart branch March 21, 2016 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants