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

Aperta
#6,015 0 commenti 1 reazione 1 assegnatario Vedi su GitHub

@NathanWalker ci sta già lavorando.

Dal 1/5/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

in progress
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
Lingua principale
JavaScript
Stelle
1.1k
Fork
204
Merge medio
1g 9h
PR unite (30g)
8

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NativeScript/nativescript-cli

Tutte le issue di NativeScript/nativescript-cli

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.