首页 > 解决方案 > ng 测试的包含选项不起作用

问题描述

我正在尝试使用 ng 测试使用 Karma 和 Jasmine 运行单元测试。当我发出以下命令时:

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

知道这里发生了什么吗?我尝试了很多变体,但看起来 include 选项根本不起作用。

标签: angulartypescriptjasminekarma-jasminekarma-runner

解决方案


以下是在特定文件夹及其所有子文件夹/子目录下运行测试文件的命令

ng test --include='src/app/modulefolder/**/*.spec.ts'

推荐阅读