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.
Fix the following issues in unit test runner:
tns test <platform> --watchis not working for TypeScript projectstns test <platform> --debug-brkdoes not debug.Implementation details
Change the way unit-tests are started. The current code was:
karma-nativescript-launcheris called, it spawns new CLI process (callstns dev-testcommand with some arguments).node_modules/nativescript-unit-test-runner--watchoption is used, karma launcher will listen forfile_list_modifiedevent and spawn new CLI process to run the tests.Problems were in all the steps. New way:
tns test <platform>is called, first step is to prepare the project.karma-nativescript-launcher's start method is called in the forked process, it will send required information to current CLI process.node_modules/nativescript-unit-test-runner.file-list-modifiedevent. CLI is alreday doing this (livesync logic).nativescript-unit-test-runnervia after-prepare hook.The new behavior depends on the livesync - when app is not installed on the device, it will be installed. In case
--watchis used, livesync will detect changes, prepare the project and restart the app - this will start the tests again.Problem
With this change
tns dev-testcommand will stop working. As I consider it not usable, I've decided to skip its fixing for later.Related PRs:
NativeScript/nativescript-unit-test-runner#2
NativeScript/karma-nativescript-launcher#23
Fixes #1513