Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

ng test does not run tests from new test files when watching

Offen
#26,470 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
angular, typescript
Bereich
cli, testing

Rechercherichtung

Reproduziere das Verhalten mit den aufgelisteten Befehlen ng new, ng test und ng g component widget, und verfolge anschließend den Watch-Ablauf von ng test, der die neue Testdatei erkennt und neu kompiliert. Vergleiche die initialen und die neu gestarteten Testläufe; als erledigt gilt die Aufgabe, wenn Tests in neu hinzugefügten Dateien während des Watchens ausgeführt werden, ohne den Prozess neu zu starten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area: @angular-devkit/build-angular devkit/build-angular:karma freq1: low severity3: broken type: bug/fix
Command

test

Is this a regression?
  • Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was

No response

Description

While ng test is running and watching for changes, if you add a new test file, that file is detected and causes the tests to run again, but the tests in that new file are not included in the test run. To include the tests from the new file, you need to restart the ng test process.

Minimal Reproduction
  1. In a terminal, run:
ng new watch --skip-git --style css --ssr=false 
ng test
  1. Three tests are run.
  2. In a second terminal, run:
ng g component widget
  1. A new component is created with a test file that contains one test.
  2. The new test file is detected and the tests recompile.
  3. Only three tests are run.
  4. Add another test to the new component's test file.
  5. The change is detected and the tests recompile.
  6. Only three tests are run.
  7. Kill the ng test process.
  8. Run ng test again.
  9. Five tests are run.
Exception or Error

No response

Your Environment
_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 17.0.3
Node: 20.9.0
Package Manager: npm 10.1.0
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1700.3 (cli-only)
@angular-devkit/core         17.0.3 (cli-only)
@angular-devkit/schematics   17.0.3 (cli-only)
@schematics/angular          17.0.3 (cli-only)
Anything else relevant?

Here's a screen recording to help explain what I'm seeing.
ng-test-watch

Vorherrschende Sprache
TypeScript
Sterne
27k
Forks
11.8k
Ø Merge
16 Std. 35 Min.
Gemergte PRs (30 T.)
176

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus angular/angular-cli

Alle Issues in angular/angular-cli

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.