我正在尝试使用Karma和Jasmine运行使用ng测试的单元测试。当我发出以下命令时:
ng test --watch=false --code-coverage --main ./src/main/resources/public/scripts/xyz/workspace/commons/interceptors/mgr.ng.spec.ts它工作起来没有任何问题。
当我尝试使用以下命令运行该目录中的所有脚本时:
ng test --watch=false --code-coverage --include=src/main/resources/public/scripts/xyz/workspace/commons/interceptors/*.ng.spec.ts我得到以下错误:
Specified patterns: "src/main/resources/public/scripts/xyz/workspace/commons/interceptors/*.ng.spec.ts" did not match any spec files知道这里发生了什么吗?我尝试了许多变体,但看起来包含选项根本不起作用。
发布于 2020-09-17 17:46:09
试试ng test --watch=false --code-coverage --include="src/main/resources/public/scripts/xyz/workspace/commons/interceptors/*.ng.spec.ts"
如果你愿意发布你的项目结构,这也将是有益的。
发布于 2021-06-29 12:43:07
以下是在特定文件夹及其所有子文件夹/子目录下运行测试文件的命令
ng test --include='src/app/modulefolder/**/*.spec.ts'发布于 2020-03-27 23:01:51
我还不确定这是否被支持。
这里有一个解决方案:https://github.com/angular/angular-cli/issues/3603#issuecomment-523794137
https://stackoverflow.com/questions/60888237
复制相似问题