NativeScript / NativeScript/nativescript-cli

ns 9 running test after running the app starts the app not the test runner.

オープン
#6,015 コメント 0 件 リアクション 1 件 担当者 1 名 GitHub で見る

@NathanWalker がすでに取り組んでいます。

2026年5月1日 から。

in progress
主要言語
JavaScript
スター
1.1k
フォーク
204
平均マージ
1日 9時間
マージ済み PR(30日)
8

説明

Issue Description

When I create a new NativeScript 9 Angular App using ns create and I add tests using ns test init then I run the app using (e.g.) ns run android, stop it and run the tests with (e.g.) ns test android the App is launched on my emulator instead of the test runner.

The issue happens on both Android and iOS. The tests run correctly if a clean is run before them.

The issue also happens on a NativeScript Angular App upgraded from 8 to 9, which worked correctly before the upgrade to 9.

The issue is reproduced with an Angular App that uses Jasmine as its test framework, it does not appear that test framework should make a difference but other test frameworks have not been checked.

There are historical issues with this happening on NativeScript apps before version 9. I have checked for the issues that caused this in the past and none of the fixes or work arounds apply as far as I can tell.

Reproduction
  1. Install or update to NativeScript 9. I was using 9.0.6 CLI, but I have also seen the problem on older versions of 9.
  2. Create a new NativeScript App with:

ns create myNewNSAngularApp

  1. Choose Angular as the Framework and "HelloWorld" as the example you want to use.
  2. Once created cd into the app cd myNewNSAngularApp
  3. Add tests with:

ns test init --framework jasmine

  1. Once created, prepare, in my case for android, with:

ns prepare android

  1. Run the app with:

ns run android

  1. After checking the app runs, terminate it on the emulator and in the console.
  2. Run the tests with:

ns test android

  1. Notice that instead of the test running, the app has restarted.
  2. Clean with:

ns clean

  1. Run the tests again with:

ns test android

  1. Note that the test runs as expected.
Relevant log output (if applicable)

Environment
OS: Windows 11 10.0.26200
CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
Shell: Not Found
node: 20.19.6
npm: 10.8.2
nativescript: Not Found

# android
java: 17.0.18
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: Not Found
cocoapods: Not Found
python: Not Found
python3: Not Found
ruby: Not Found
platforms: Not Found
Dependencies
"dependencies": {
  "@angular/animations": "~20.2.0",
  "@angular/common": "~20.2.0",
  "@angular/compiler": "~20.2.0",
  "@angular/core": "~20.2.0",
  "@angular/forms": "~20.2.0",
  "@angular/platform-browser": "~20.2.0",
  "@angular/platform-browser-dynamic": "~20.2.0",
  "@angular/router": "~20.2.0",
  "@nativescript/angular": "^20.0.0",
  "@nativescript/core": "~9.0.0",
  "@nativescript/unit-test-runner": "^4.0.1",
  "rxjs": "~7.8.0",
  "zone.js": "~0.15.0"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~20.2.0",
  "@angular/compiler-cli": "~20.2.0",
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
  "@nativescript/android": "9.0.4",
  "@nativescript/tailwind": "^2.1.0",
  "@nativescript/types": "~9.0.0",
  "@nativescript/webpack": "~5.0.25",
  "@ngtools/webpack": "~20.2.0",
  "@types/jasmine": "6.0.0",
  "karma": "6.4.4",
  "karma-coverage": "2.2.1",
  "karma-jasmine": "4.0.2",
  "karma-nativescript-launcher": "1.0.0",
  "nyc": "18.0.0",
  "tailwindcss": "~3.4.0",
  "typescript": "~5.8.0"
}
Please accept these terms

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。