Skip to content

Fix unit test runner on Windows #1207

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

Merged
merged 3 commits into from
Nov 18, 2015

Conversation

rosen-vladimirov
Copy link
Contributor

Use fork instead of spawn for startTestRunner

In karma-nativescript-launcher we call startTestRunner through spawn.
Communication between karma launcher and tns is through stdin.
This is causing exception in buildMetadata step when gradle wrapper is used.
For some reason it throws error in java code.
So, replace the spawn with fork in the launcher. Modify startTestRunner to wait for message from parent process and send "ready" state to the parent.
After that the parent (karma-nativescript-launcher) sends configuration data and the startTestRunner will execute the actions.

Fixes #1199

Add help for dev-test-* commands

As the current workflow of unit-testing is:

  1. user calls tns test android
  2. CLI starts a new process in which tns dev-test android is called
  3. In case the dev-test command fails, the error is caught in the child process and command help is printed on the terminal directly in it.
  4. User receives message: Unable to find command dev-test|android (from the child process) as we do not have help for this commands.

Copy-paste the help fo test-android and test-ios commands and change the filenames so when the child process fails, it will print correct help.
Parent process will not fail as the error is caught inside the child, so there's no way to print the help twice.

Update common-lib to search dev-commands as well when searching for help pages.

Make sure all dependencies are installed before starting karma

In case node_modules dir is deleted, tns test <platform> command will fail.
So ensure all dependencies are installed before starting karma server.

Should be merged after:

In `karma-nativescript-launcher` we call startTestRunner through spawn.
Communication between karma launcher and tns is through stdin.
This is causing exception in buildMetadata step when gradle wrapper is used.
For some reason it throws error in java code.
So, replace the spawn with fork in the launcher. Modify `startTestRunner` to wait for message from parent process and send "ready" state to the parent.
After that the parent (karma-nativescript-launcher) sends configuration data and the `startTestRunner` will execute the actions.

Fixes #1199
@rosen-vladimirov rosen-vladimirov self-assigned this Nov 17, 2015
@rosen-vladimirov rosen-vladimirov added this to the 1.5.0 milestone Nov 17, 2015
@ns-bot
Copy link

ns-bot commented Nov 17, 2015

Test PASSed.

1 similar comment
@ns-bot
Copy link

ns-bot commented Nov 18, 2015

Test PASSed.

@Fatme
Copy link
Contributor

Fatme commented Nov 18, 2015

👍

As the current workflow of unit-testing is:
1) user calls `tns test android`
2) CLI starts a new process in which `tns dev-test android` is called
3) In case the dev-test command fails, the error is caught in the child process and command help is printed on the terminal directly in it.
4) User receives message: `Unable to find command dev-test|android` (from the child process) as we do not have help for this commands.

Copy-paste the help fo test-android and test-ios commands and change the filenames so when the child process fails, it will print correct help.
Parent process will not fail as the error is caught inside the child, so there's no way to print the help twice.

Update common-lib to search dev-commands as well when searching for help pages.
In case node_modules dir is deleted, `tns test <platform>` command will fail.
So ensure all dependencies are installed before starting karma server.
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/fix-unit-test-runner branch from 3b5762e to 6925a14 Compare November 18, 2015 08:59
@ns-bot
Copy link

ns-bot commented Nov 18, 2015

Test PASSed.

}
};

let notInstalledAppOnDeviceAction = (device: Mobile.IDevice): IFuture<void> => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move these callbacks outside the body of startTestRunner.

rosen-vladimirov added a commit that referenced this pull request Nov 18, 2015
@rosen-vladimirov rosen-vladimirov merged commit 35446fc into release Nov 18, 2015
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-unit-test-runner branch November 18, 2015 09:17
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.

4 participants