Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code coverage report for a library should include only library specific files #11331

Closed
vimalraj-a opened this issue Jun 21, 2018 · 5 comments
Closed
Labels
Milestone

Comments

@vimalraj-a
Copy link

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Area

- [x] devkit
- [ ] schematics

Versions

Node: v8.11.1
Npm: 6.1.0
Windows 10

Repro steps

  1. create library (name = foo)
  2. create shared library (name = shared-util)
  3. Library foo depends on library shared-utils
  4. Generate coverage report for library foo.

Coverage report contains some files from shared utils with wrong coverage percent because it didn't pick the shared-utils's spec file but included in instrumentation.

The log given by the failure

NA

Desired functionality

Need option to include only project specific files for code coverage report. Though we have option for excluding folder or files from coverage report, not helping in bigger mono repositories.
Every time I have to update angular.json to exclude every internal library reference I have.

Mention any other details that might be useful

 "root": "libs/admin/acl/feature-acl",
 "sourceRoot": "libs/admin/acl/feature-acl/src",
 "projectType": "library",
 "architect": {
     "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "libs/admin/acl/feature-acl/src/test.ts",
            "tsConfig": "libs/admin/acl/feature-acl/src/tsconfig.spec.json",
            "karmaConfig": "libs/admin/acl/feature-acl/karma.conf.js",
            codeCoverageInclude: ["libs/admin/acl/feature-acl"] 
          }
      }
 }

codeCoverageInclude-> will help a lot or allow us use ! in codeCoverageExclude

@filipesilva
Copy link
Contributor

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please? This can happen depending how how you do your step 3 (Library foo depends on library shared-utils) but it's not clear how you're doing that.

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

@filipesilva filipesilva added the needs: repro steps We cannot reproduce the issue with the information given label Aug 10, 2018
@vimalraj-a
Copy link
Author

@filipesilva I created a separate library (example: foo) project through cli and using the foo's service in main project. Anyway, I will create the repo and update the link here

@vimalraj-a
Copy link
Author

@filipesilva Here is a github repo https://github.com/vimalraj-a/ng-code-coverage-app. Please remove below line from angular.json to simulate the issue

Line #74
"codeCoverageExclude": ["projects/**/*"],

Note:
In larger module code base its very hard to exclude each and every folder which is not part of the current module

@filipesilva filipesilva added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient and removed needs: repro steps We cannot reproduce the issue with the information given labels Aug 16, 2018
@ngbot ngbot bot modified the milestone: Backlog Aug 16, 2018
@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases (Should be fixed by #11974). Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants