question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Karma exits with code 0 when the coverage threshold is below the configuration

See original GitHub issue

Hi,

I added this configuration to my karma.conf.js

            type: 'html',
            dir: 'test/coverage/',
            check: {
                global: {
                    statements: 85,
                    branches: 70,
                    functions: 85,
                    lines: 85
                }
            }

The logs work fine and if the thresholds are not met, I can see error logs in the terminal but karma always exit wit code 0. That affect my CI process that is not able to detect something is wrong.

The documentation says

If the thresholds are not met, karma will return failure.

and I’ve review the code and I’ve seen the plugin is setting the exit code to 1 so I’m not sure if it is a issue in karma-coverage or in karma itself.

I’m using : karma@5.1.1 karma-coverage@2.0.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
matz3commented, Sep 1, 2020

Solved with karma v5.2.0 (in combination with karma-coverage v2.0.3)

1reaction
jesusbarcenillacommented, Aug 19, 2020

@matz3 It looks like your PR was already merged in master. I’ve tested it and it works fine. Looking forward for the next karma release. I’ll keep this issue open until then.

Thank you very much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sapui5 - Karma-coverage exit code is always 0 even when test ...
Karma coverage reports the files that do not meet coverage threshold but the exit code is always 0, thus the pipeline does not...
Read more >
Coverage - Karma test runner
Coverage. Karma can generate code coverage using awesome Istanbul. If you want to generate the coverage, you need to configure up to three...
Read more >
karma-coverage-istanbul-reporter - npm package - Snyk
A karma reporter that uses the latest istanbul 1.x APIs (with full sourcemap support) to report coverage. For more information about how to...
Read more >
Combined Unit & E2E Code Coverage: case study on a real ...
Evaluate the combined coverage from the unit test and parallel e2e jobs, fail the CI job if the coverage is below a defined...
Read more >
karma-coverage-istanbul-reporter - npm
Start using karma-coverage-istanbul-reporter in your project by running ... with an exit code of 1 if not running in watch mode thresholds: ...
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