这个问题以前已经问过了,但是所有的答案似乎都过时了,并且不会导致完整的代码覆盖,包括没有规范文件的文件的覆盖范围。
当我运行命令ng-test --code-coverage时,我的结果显示的源代码比实际检查的要少得多,因为它跳过了没有匹配的规范文件的文件。我试图通过几种方法来解决这个问题,包括创建一个app.module.spec文件并将app.module导入其中,这增加了所报告的测试代码行数,但是在向深度嵌套模块添加了一个没有测试的新组件之后,数字并没有改变。
这是我的业力配置:
// Karma configuration file, see link for more informa
当我运行ng test --code-coverage时,覆盖率报告有时不会生成,有时会生成,因此在执行测试套件后,我无法验证覆盖率语句。
我的Karma配置
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
framework
我有一个karma配置,用于我的单元测试和代码覆盖。我的项目目录如下所示
RootFOlder
-karma.config.js
-webpack.test.config.js
-src/
--test.ts
--components
---ButonComponent
----Buttoncomponent.spec.ts
我的karma.config在下面
// Karma configuration
module.exports = function (config) {
config.set({
// base path that will be used to res
我对Karma和Jasmine (业力4.4.1,茉莉花核心3.6.0和业力-茉莉花4.0.1)在角10应用程序中的一些测试有错误。我运行测试,输出如下:
MyModalComponent
✗ Should create component
Unhandled promise rejection: Error: Could not load "util".
Error: Could not load "util".
at HTMLScriptElement.__zone_symbol__ON_PROPERTYerror (
我正试图通过Github操作将角(v11)库的代码覆盖发布到Codecov.io。
我已经在市场上设置了Codecov github的官方行动
name: tests
on:
pull_request:
branches: [ master ]
jobs:
build:
# Machine environment:
# We specify the Node.js version manually below, and use versioned Chrome from Puppeteer.
runs-on: ubuntu-latest
st
当我使用ng test --code-coverage运行测试时,我得到了未知的代码覆盖率,不知道可能出了什么问题。这里的任何帮助都是非常感谢的。
> ng test --code-coverage
10% building modules 1/1 modules 0 active26 06 2018 11:00:51.088:WARN [karma]: No captured browser, open http://localhost:9876/
26 06 2018 11:00:51.095:INFO [karma]: Karma v2.0.0 server sta