feat: add support for ts unit tests #36
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.
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
orng
) 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 thetypescript
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 thetns 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 thetns test
command as the.js
files are produced after starting karma server. The proposed solution relies on the followings:.ts
files.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
filesRel to: NativeScript/nativescript-cli#4482