Angular 10.0.13指定defaultProject时如何运行所有项目测试?
Great question! Let's break this down into two key parts: how to run all tests when defaultProject is set, and whether this is a bug or intentional change.
Workaround to run all tests with defaultProject configured
If you need to execute tests for every project in your Angular 10.0.13 workspace while defaultProject is defined, use the explicit --all flag with the test command:
ng test --all
This flag overrides the default project behavior and forces the CLI to run tests across every project in your workspace. You could also list all project names directly (e.g., ng test auth-app dashboard-app shared-lib), but --all is far more efficient for larger workspaces.
Is this a bug or a breaking change?
This is a confirmed bug in Angular 10.0.13, not an intentional breaking change.
The official Angular CLI documentation clearly states that running ng test without specifying a project should execute tests for all projects. This behavior worked reliably in Angular 9.x, but a regression was introduced in the 10.0.x release line that caused the CLI to only run tests for the defaultProject when no project name was provided.
Good news: This issue was fixed in later minor versions of Angular 10 (like 10.1.x and newer). If you upgrade your workspace to the latest available minor version of Angular 10, the original behavior of ng test (running all tests when no project is specified) will be restored, even with defaultProject set in angular.json.
内容的提问来源于stack exchange,提问作者TmTron

