{"library":"nativescript-unit-test-runner","title":"NativeScript Unit Test Runner","description":"The `nativescript-unit-test-runner` package provides the core infrastructure for executing unit tests within NativeScript applications. It is primarily consumed by the NativeScript CLI (`tns test`) and integrates with standard JavaScript testing frameworks like Karma, Jasmine, and Mocha. The current stable version is `4.0.1`, which includes support for NativeScript 9 and improved ES Module syntax handling. This package acts as the bridge between your test code, the NativeScript runtime, and the underlying test runner environment, facilitating the execution of tests directly on emulators, simulators, or physical devices. It addresses the complexities of running tests in a device-native context, a key differentiator from web-based test runners, and has an active release cadence with major version updates supporting new NativeScript versions.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install nativescript-unit-test-runner"],"cli":null},"imports":["import { NativeScriptTestEnvironment } from 'nativescript-unit-test-runner';","import { configureNativeScriptTests } from 'nativescript-unit-test-runner';","import * as NativeScriptRunner from 'nativescript-unit-test-runner';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"npx create-nativescript-app my-test-app --template @nativescript/template-blank-typescript\ncd my-test-app\ntns test init\n\n# The 'tns test init' command will guide you through setting up Jasmine or Mocha.\n# For example, select Jasmine during the interactive prompt.\n\n# Now, create a simple test file. For instance, add `app/tests/example.ts` with the following content:\n/*\ndescribe('Example Test Suite', () => {\n  it('should verify true is true', () => {\n    expect(true).toBe(true);\n  });\n\n  it('should correctly concatenate strings', () => {\n    const greeting = 'Hello';\n    const name = 'NativeScript';\n    expect(`${greeting} ${name}`).toBe('Hello NativeScript');\n  });\n});\n*/\n\n# To run tests on an Android emulator or connected device:\ntns test android\n\n# To run tests on an iOS simulator or connected device (requires Xcode):\ntns test ios\n\n# For continuous testing that watches for file changes:\ntns test android --watch","lang":"typescript","description":"Demonstrates initializing a new NativeScript project, setting up the unit test runner with `tns test init`, and executing example tests on Android or iOS devices/simulators.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}