NativeScript / NativeScript/nativescript-cli

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

未關閉
#6,015 0 則留言 1 個 reaction 已指派 1 人 在 GitHub 檢視

@NathanWalker 已經在處理了。

開始於 2026年5月1日。

in progress
主要語言
JavaScript
星號
1.1k
分支
204
平均合併
1 天 9 小時
30 天內合併 PR
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. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。