ng test does not run tests from new test files when watching
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 14 giờ 23 phút
- Pull request đã merge (30 ngày)
- 162
Mô tả
### 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
```
2. Three tests are run.
3. In a second terminal, run:
```
ng g component widget
```
4. A new component is created with a test file that contains one test.
5. The new test file is detected and the tests recompile.
6. **Only three tests are run.**
7. Add another test to the new component's test file.
8. The change is detected and the tests recompile.
9. **Only three tests are run.**
10. Kill the `ng test` process.
11. Run `ng test` again.
12. **Five tests are run.**
### Exception or Error
_No response_
### Your Environment
```text
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
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.

Hướng dẫn đóng góp
Hướng nghiên cứu
Tái hiện hành vi bằng các lệnh `ng new`, `ng test` và `ng g component widget` được liệt kê, sau đó truy vết luồng watch của `ng test` để phát hiện và biên dịch lại tệp kiểm thử mới. So sánh lần chạy kiểm thử ban đầu và lần chạy sau khi khởi động lại; được xem là hoàn thành khi các kiểm thử trong những tệp mới được thêm được thực thi trong lúc watch mà không cần khởi động lại tiến trình.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- cli, testing
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100