NOTE! You are browsing legacy documentation. For latest visit docs.nativescript.org.

NativeScript Angular

tns test

Description

Runs unit tests on the selected mobile platform. Your project must already be configured for unit testing by running $ tns test init.

How file changes are handled

  • Changes in .js, .ts, .less, .sass and other file types will cause a restart of the native application.
  • Changes in App_Resources will cause a rebuild of the application.
  • Changes in any package.json file inside the project will cause a rebuild of the application.
  • Changes in node_modules/somePlugin will cause a restart of the native application.
  • Changes in node_modules/somePlugin/platforms will cause a rebuild of the application.
  • Changes in node_modules/somePlugin/package.json file will cause a rebuild of the application.

Commands

Usage Synopsis
General $ tns test <Platform>General

Arguments

<Platform> is the target mobile platform on which you want to run the tests. You can set the following target platforms.

  • android - Runs the tests in your project on connected Android devices or Android emulators.
  • ios - Runs the tests in your project on connected iOS devices.

Prerequisites

Command Description
test init Configures your project for unit testing with a selected framework.
test android Runs the tests in your project on Android devices or native emulators.
test ios Runs the tests in your project on iOS devices or the iOS Simulator.