Skip to content

Coverage report fails when there are 0 resources #803

@raemer

Description

@raemer

Hi,

while writing tests for a provider with coverage reports on, I noticed this behavior:
If there are no resources, this is detected correctly as "Total resources: 0, Touched resources: 0", but the resources coverage is NaN%. The code coverage check then fails:

expected: >= 100.0
got:    0.0

As the test doesn't really have a meaning if there are no resources, I implemented a check if the total is zero, setting the coverage to 100% if so and opened pull request #802 .
Though 100% is as wrong as 0%, it seems to be more useful as it does not generate meaningless failed tests.

Best regards,
Jan-Martin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions