Urgent.News

What's breaking now, across thousands of outlets.

Tech

A Check With a Zero Denominator Reports Clean

Code: Megapixel99/zerocase A suite whose every test was skipped, a lint whose glob matched nothing, and a coverage run over no statements can all exit 0. Every one of them has already written the real number down in a file with a field name on it. zerocase wraps a command, reads the machine-readable report the runner wrote, and refuses the run when nothing in the report actually executed: pip…

The article discusses a package called zerocase that handles test reports. It explains that testsuites with zero or empty reports can exit with a 0 status code and still be considered passing. The key distinction made by zerocase is in the report's total and executed counts, rather than exit codes. A suite with no tests or tests that only skipped is still considered passing as long as the executed count meets the minimum requirement.

The package provides parsers for various report formats like JUnit XML, TAP, LCOV, Cobertura, and ESLint JSON, which return the total and executed counts. If a test case carries both a skip and a failure, it is not counted as having failed. The article also mentions a mutation test suite that applied 13 mutations to the codebase and caught all of them.

It highlights how zerocase's approach avoids common issues like a suite appearing to have failed while actually passing due to a zero exit code or similar discrepancies in reports.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Friday 25 September →