Skip to content

[BUG] Files missing in unit-test coverage (just like in #664) #1272

Closed

Description

@msaf9
Overview of the issue

Just like in #664, I am not able to view the unit test coverage table content. I tried to replace the \\ with /, but this didn't help me.

Operating System, Node.js, npm, compodoc version(s)

Operating System: Windows 10
Node.js: v16.15.1
npm: 8.12.0
compodoc: 1.1.19

Angular configuration, a package.json file in the root folder
{
  "name": "portfolio",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "mocha",
    "coverage": "nyc npm run test",
    "lint": "ng lint",
    "compodoc": "npx compodoc -p tsconfig.app.json --unitTestCoverage coverage/portfolio/coverage-summary.json"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.3.0",
    "@angular/common": "~13.3.0",
    "@angular/compiler": "~13.3.0",
    "@angular/core": "~13.3.0",
    "@angular/forms": "~13.3.0",
    "@angular/platform-browser": "~13.3.0",
    "@angular/platform-browser-dynamic": "~13.3.0",
    "@angular/router": "~13.3.0",
    "lint-staged": "^13.0.1",
    "mocha": "^10.0.0",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.3.1",
    "@angular-eslint/builder": "13.2.1",
    "@angular-eslint/eslint-plugin": "13.2.1",
    "@angular-eslint/eslint-plugin-template": "13.2.1",
    "@angular-eslint/schematics": "13.2.1",
    "@angular-eslint/template-parser": "13.2.1",
    "@angular/cli": "~13.3.1",
    "@angular/compiler-cli": "~13.3.0",
    "@types/jasmine": "~3.10.0",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.17.0",
    "@typescript-eslint/parser": "5.17.0",
    "coveralls": "^3.1.1",
    "eslint": "^8.12.0",
    "grunt-istanbul-coverage": "^0.1.4",
    "jasmine-core": "~4.0.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.1.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "nyc": "^15.1.0",
    "typescript": "~4.6.2"
  },
  "lint-staged": {
    "linters": {
      "*.ts": [
        "compodoc --coverageMinimumPerFile 25"
      ]
    }
  },
  "extends": "@istanbuljs/nyc-config-typescript",
  "all": true,
  "check-coverage": true
}

Compodoc installed globally or locally ?

globally

If possible sourcecode of the file where it breaks

I just ran npm run compodoc, I will provide my coverage-summary.json file which can help to resolve my issue.

{"total": {"lines":{"total":25,"covered":17,"skipped":0,"pct":68},"statements":{"total":35,"covered":26,"skipped":0,"pct":74.28},"functions":{"total":23,"covered":18,"skipped":0,"pct":78.26},"branches":{"total":2,"covered":0,"skipped":0,"pct":0},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\app.component.ts": {"lines":{"total":13,"covered":5,"skipped":0,"pct":38.46},"functions":{"total":6,"covered":1,"skipped":0,"pct":16.66},"statements":{"total":15,"covered":6,"skipped":0,"pct":40},"branches":{"total":2,"covered":0,"skipped":0,"pct":0}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\bookshelf\\bookshelf.component.ts": {"lines":{"total":5,"covered":5,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":6,"covered":6,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\hobbies\\hobbies.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\home\\home.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\navbar\\navbar.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\page-not-found\\page-not-found.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\portfolio\\portfolio.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\sitemap\\sitemap.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"G:\\GitHubCleanup\\SoftwareEngineeringPortfolio\\Portfolio\\src\\app\\writings\\writings.component.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
}
If possible your terminal logs before the error

No error logs.

Motivation for or Use Case

Uhh! I am not able to see the full unit code coverage table other than headers.

Reproduce the error
Related issues

#664

Suggest a Fix

I believe is it all about my coverage-summary.json file. I even tried to replace all \\ with '/', this change doesn't helped me much and the issue is still persistent.

Activity

  1. msaf9 commented on Jul 8, 2022

    @msaf9
    Author

    @vogloblinsky
    Can you please help me on this?

  2. bstrob commented on Sep 2, 2022

    @bstrob

    I just ran into the same issue. Did you find a solution @msaf9 ?

  3. msaf9 commented on Sep 3, 2022

    @msaf9
    Author

    Nope @bstrob, I didn’t find any resolution for this. Waiting since very long, I have tried to tweak the path by providing absolute and relative, and then by replacing \ with /. Still no luck.
    Let me know if you got it by any means.

  4. bstrob commented on Sep 4, 2022

    @bstrob

    @vogloblinsky I saw that you committed a possible solution to #664 and this one. But it seems the problem still exists. Can you have another look into it? Let me know if you need any further information on it. Thank you very much.

  5. stale commented on Nov 13, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  6. bstrob commented on Nov 13, 2022

    @bstrob

    Problem still exists.

  7. bampakoa commented on Jan 10, 2023

    @bampakoa

    I have the same problem too. It would be great to see a PR fixing it or a temporary workaround 🙂

  8. iklimis commented on Jan 11, 2023

    @iklimis

    I am facing this exact issue.

  9. stale commented on Jun 18, 2023

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  10. msaf9 commented on Jun 27, 2023

    @msaf9
    Author

    Need a fix.

  11. kfvenkatasama commented on Jan 4, 2024

    @kfvenkatasama

    is it working for anybody. Need this badly.

    @vogloblinsky , @msaf9

  12. msaf9 commented on Feb 23, 2024

    @msaf9
    Author

    @kfvenkatasama, this is fyi it's not working for me.

  13. smart4energy commented on Jun 12, 2024

    @smart4energy

    fyi i managed it to work:

    with compodoc version 1.1.25

    My original path was:
    C:\\Users\\username\\Documents\\AzureGit\\MyService\\src\\common\\validation.pipe.ts

    I have to change it to:

    src\\common\\validation.pipe.ts

    image

  14. ractoc commented on Jan 6, 2025

    @ractoc

    I just checked the spec for what is actually required in the coverage json format:
    https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md
    Here is clearly states that an absolute path is required. So the current implementation in compodoc does not adhere to the spec and would need te be changed in such a way that it follows the spec..

  15. ractoc commented on Jan 6, 2025

    @ractoc

    Ok, it turns out that compodoc is not following the istanbul spec here. THe istanbull spec states that an absolute path is required in de coverage.json files.

    https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md

    I have been tinkering with som eadditional commands to pre-parse the coverage json file to remove the absolute path. This is the package.json script I endedn up with. This works when running the command on a windows environment.

    "compodoc-windows": "powershell -Command "(Get-Content ./coverage/coverage-summary.json) | foreach { $_ -replace 'C:\\\\ws\\\\git\\\\pvb_core_fe\\\\','' } | Set-Content ./coverage/coverage-summary.json" && npx compodoc -p tsconfig.doc.json --name pvb-core-fe --unitTestCoverage ./coverage/coverage-summary.json",

    The large numer of \ are requred because o fthe various systems which the script goes through which all require that one to be escaped. You would off course need to adjust the inicial folder with the one in your coverage.json file.

    For Linux you can use a SED command, this is the same, but translated to a SESD command:

    "compodoc-linux": "sed -e "s/C:\\\\\\\\ws\\\\\\\\git\\\\\\\\pvb_core_fe\\\\\\\\//g" -i ./coverage/coverage-summary.json && npx compodoc -p tsconfig.doc.json --name pvb-core-fe --unitTestCoverage ./coverage/coverage-summary.json",

  16. added a commit that references this issue on May 25, 2026
    d303e4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions