Ignore files/folders from code coverage report

See original GitHub issue

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10

Versions.

Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.19-3 node: 5.10.1 os: win32 x64

Repro steps.

Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. N/A

The log given by the failure.

Normally this include a stack trace and some more information. N/A

Mention any other details that might be useful.

Is there any way to exclude files/folders from test coverage (other than naming them .spec.ts)? For example if I wanted to put some reusable bits of test code in src/app/common/testing/* I wouldn’t want files included in this directory to be reported on.

Thanks!


Thanks! We’ll be in touch soon.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
gregbowncommented, May 14, 2018

With the latest CLI 6+ add excluded files or paths to angular.json -> test -> options like so:

        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "./karma.conf.js",
            "codeCoverageExclude": ["src/testing/**/*"],

I should add, this addition was found by going through the schema

"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
9reactions
delastevecommented, Feb 23, 2017

When RC is released you will be able to configure the following section in the .angular-cli.json file:

"test": {
  "codeCoverage": {
    "exclude": ["glob/to/ignore"]
  },
  ...
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible exclude test directories from coverage.py reports?
After accepting defeat, I began to wonder if maybe the test files are supposed to be included in the report. Can anyone shed...
Read more >
Excluding code from coverage.py - Read the Docs
You can tell coverage.py to exclude this code during reporting so that it doesn't clutter your reports with noise about code that you...
Read more >
Excluding files/folder from code coverage · Issue #193 - GitHub
Is there any argument to exclude files or folders from code coverage? The command im running is python -m pytest --cov=src.
Read more >
How to Use a File to Exclude Files From Code Coverage
How to Use a File to Exclude Files From Code Coverage · You can set coverage exclusions in the SonarCloud UI. · You...
Read more >
Ignoring Paths - Codecov
You can use the top-level ignore: key to tell Codecov to ignore certain paths. Add a list of paths (folders or file names)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found