Skip to content

[BUG] Files missing in unit-test coverage #664

Closed

Description

@JohanBeekers
Overview of the issue

When passing the "--unitTestCoverage" flag with my json code coverage summary, it correctly creates a "Unit test coverage" page and shows the statements, branches, functions and lines percentages. Below that i see the headers of the table, but no table rows.

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

Windows 10
Nodejs 8.9.4
npm 5.6.0
Compodoc 1.1.5

Angular configuration, a package.json file in the root folder
{
    "name": "cortx",
    "version": "0.0.1",
    "license": "T.B.D.",
    "scripts": {
        "ng": "ng",
        "start": "npm run lint && ng serve --open",
        "build": "npm run lint && ng build --prod",
        "test": "npm run lint && ng test --code-coverage --watch=false ",
        "devtest": "npm run lint && ng test --source-map=false",
        "lint": "ng lint --type-check --force",
        "docs": "compodoc -p src/tsconfig.app.json -n CorTx --unitTestCoverage test/results/unit/coverage/coverage-summary.json"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "6.1.0",
        "@angular/common": "6.1.0",
        "@angular/compiler": "6.1.0",
        "@angular/core": "6.1.0",
        "@angular/forms": "6.1.0",
        "@angular/http": "6.1.0",
        "@angular/platform-browser": "6.1.0",
        "@angular/platform-browser-dynamic": "6.1.0",
        "@angular/router": "6.1.0",
        "@fortawesome/fontawesome-free": "5.3.1",
        "core-js": "2.5.4",
        "moment": "2.22.2",
        "normalize.css": "8.0.0",
        "primeicons": "1.0.0-beta.10",
        "primeng": "6.1.4",
        "rxjs": "6.2.0",
        "zone.js": "0.8.26"
    },
    "devDependencies": {
        "@angular-devkit/build-angular": "0.8.0",
        "@angular/cli": "6.2.3",
        "@angular/compiler-cli": "6.1.0",
        "@angular/language-service": "6.1.0",
        "@compodoc/compodoc": "1.1.5",
        "@types/jasmine": "2.8.8",
        "@types/jasminewd2": "2.0.3",
        "@types/node": "8.9.4",
        "codelyzer": "4.3.0",
        "jasmine-core": "2.99.1",
        "jasmine-spec-reporter": "4.2.1",
        "karma": "3.0.0",
        "karma-chrome-launcher": "2.2.0",
        "karma-coverage-istanbul-reporter": "2.0.1",
        "karma-html-reporter": "0.2.7",
        "karma-jasmine": "1.1.2",
        "karma-jasmine-html-reporter": "0.2.2",
        "karma-junit-reporter": "1.2.0",
        "ts-node": "7.0.0",
        "tslint": "5.11.0",
        "typescript": "2.9.2"
    }
}
Compodoc installed globally or locally ?

locally

If possible your terminal logs before the error

No errors appear.

Reproduce the error

I just ran the 'npm run docs' command as it appears in the package.json above. I could give my full summary json if that helps.

Suggest a Fix

I think it might have something to do with how the file names in my json summary are generated. For me it looks like this:

{"total": {"lines":{"total":2091,"covered":1989,"skipped":0,"pct":95.12},"statements":{"total":2374,"covered":2222,"skipped":0,"pct":93.6},"functions":{"total":544,"covered":518,"skipped":0,"pct":95.22},"branches":{"total":1869,"covered":1349,"skipped":0,"pct":72.18}}
,"C:\\Users\\johan.beekers\\Git\\CorTx\\Source\\Frontend\\src\\app\\app.component.ts": {"lines":{"total":17,"covered":17,"skipped":0,"pct":100},"functions":{"total":6,"covered":6,"skipped":0,"pct":100},"statements":{"total":23,"covered":22,"skipped":0,"pct":95.65},"branches":{"total":32,"covered":21,"skipped":0,"pct":65.63}}
,"C:\\Users\\johan.beekers\\Git\\CorTx\\Source\\Frontend\\src\\app\\auth\\components\\login\\login.component.ts": {"lines":{"total":36,"covered":35,"skipped":0,"pct":97.22},"functions":{"total":9,"covered":9,"skipped":0,"pct":100},"statements":{"total":41,"covered":39,"skipped":0,"pct":95.12},"branches":{"total":33,"covered":20,"skipped":0,"pct":60.61}}

But if i look at one of your test files (https://github.com/compodoc/compodoc/blob/0a1e248babd65581446408f3ae876e531a43ea7f/test/src/todomvc-ng2/coverage-summary.json)
file paths are formatted like this:

"test/src/todomvc-ng2/src/app/app.component.ts"

One forward slash instead of two backslashes.
I don't see any other differences.

Update:
That seems to be exactly the issue. I just tried replacing all the backslashes with forward slashes and now it generates correctly.

Activity

  1. added this to the 1.1.6 milestone on Oct 10, 2018
  2. vogloblinsky commented on Oct 15, 2018

    @vogloblinsky
    Contributor

    @bhofmei can you watch this issue please ?

  3. modified the milestones: 1.1.6, 1.1.7 on Oct 15, 2018
  4. bhofmei commented on Oct 15, 2018

    @bhofmei
    Contributor

    I'm glad you were able to figure it out. I'm guessing no rows were generated originally because the paths/files in your coverage file don't match the paths created/used in compodoc. When creating the unit test coverage table, it aims to match the coverage summary file names to compodoc file names so the file names can be linked like in the documentation coverage page.

    If the file names in compodoc also follow \\ instead of / then I'm at a loss.

  5. modified the milestones: 1.1.7, 1.1.9 on Jan 29, 2019
  6. modified the milestones: 1.1.9, 1.2.0 on Mar 1, 2019
  7. stale commented on Sep 30, 2019

    @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.

  8. stale commented on Oct 7, 2019

    @stale

    This issue has been automatically closed because it has not had recent activity. Please file a new issue if you are encountering a similar or related problem. Thank you for your contributions.

  9. lock commented on Dec 6, 2019

    @lock

    This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

  10. locked as resolved and limited conversation to collaborators on Dec 6, 2019
  11. removed this from the 1.2.0 milestone on Jul 16, 2021
  12. added a commit that references this issue on Jul 19, 2021
    43bbc3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions