Skip to content

Karma coverage exit code depends on the order of the reporters array #471

@mcdenhoed

Description

@mcdenhoed

I'm using karma and karma-coverage in a CI context, failing the CI job when a test fails or coverage is too low. I get this information from the exit code returned by karma.

However, I noticed that karma doesn't return an error for low coverage IF the text-summary reporter is placed before the html reporter.

I've made a small repo showcasing this: https://github.com/mcdenhoed/karma-test

Is this expected? I didn't find any documentation indicating that the order of the reporters array was important. I've fixed my own use-case by just changing my karma.conf.js to have

      reporters: [
        {type: "html"},
        {type: "text-summary"},
      ]

instead of

      reporters: [
        {type: "text-summary"},
        {type: "html"},
      ]

This doesn't seem to me like intended behavior, but if it is, a note in the docs about it would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions