Skip to content

feat: add support for ts unit tests #36

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 1 commit into from
Apr 4, 2019
Merged

feat: add support for ts unit tests #36

merged 1 commit into from
Apr 4, 2019

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Apr 3, 2019

Currently karma server serves .js files when --bundle option is not provided and .ts files when --bundle option is provided. This leads to the problem that when a brand new project (ts or ng) is created and --bundle option is not provided, the tests are not executed. This happens because when karma server is started, .js files are still not produced as the typescript compilation is still not triggered (it is started before prepare the project e.g when livesync is started which is executed after starting karma server). If the tns test command is executed again and the project has no changes, everything works as expected as the .js files are produced. If the project has changes, this changes are not respected from the tns test command as the .js files are produced after starting karma server. The proposed solution relies on the followings:

  • Karma server serves always .ts files
  • NativeScript unit test runner requires local .js file when .ts file is served from karma. This way we're sure that the typescript compilation is triggered and at runtime are executed only .js files

Rel to: NativeScript/nativescript-cli#4482

@cla-bot cla-bot bot added the cla: yes label Apr 3, 2019
@ghost ghost assigned Fatme Apr 3, 2019
@ghost ghost added the new PR label Apr 3, 2019
@Fatme Fatme force-pushed the fatme/ts-unit-tests branch from 6b9e303 to 662d1b9 Compare April 4, 2019 09:04
@Fatme Fatme merged commit af5461c into master Apr 4, 2019
@Fatme Fatme deleted the fatme/ts-unit-tests branch April 4, 2019 10:51
@ghost ghost removed the new PR label Apr 4, 2019
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