Search code examples
angularkarma-jasminenativescripttns

Can the NativeScript CLI also generate spec files?


I started looking at NativeScript today and noticed right off that the app generated from the tabbed template lacked spec files, like those included with apps generated from the Angular CLI.

Is there a way to include Karma and Jasmine in the generated app, along with all the relevant spec files?

I know there is a library for adding spec files in post, but you also have to go back and make sure you install all your Karma and Jasmine dependencies. I'm hoping there's an easier way.

The documentation doesn't even mention automated testing, so I am guessing the answer is going to be a little bit of a work-around. https://www.npmjs.com/package/nativescript


Solution

  • As of this current time, browsing the docs indicated by @Manoj, it looks like the answer to my initial Q is NO, given the expectation that spec files are generated with the scaffolded application.

    TNS is about writing Angular with Android/ iOS devices as targets, less so a web browser, so the tests have to be packaged and executed differently.

    It seems like an opportunity for a feature enhancement to me, but maybe I'm missing some details. Thus far it looks like testing is supported but doesn't follow the same TDD / BDD opinionated approach of the Angular CLI.