node tests: Fix bug with zero-coverage case.

If a file that had 100% coverage somehow regressed
to 0% coverage, we would report an error to the
console, but we weren't treating it as an actual
failure.

We've probably always had this bug, but it probably
rarely was an issue, since devs might have seen
the error locally, or hopefully whatever crazy
thing you did to totally remove coverage would
have had other symptoms.

If this was intentional, I suspect it might have
had something to do with wanting to get coverage
reports when you just run individual tests.  But
a while back we changed it so that when you run
individual tests, we don't do the line coverage
enforcement.
This commit is contained in:
Steve Howell 2020-02-09 14:11:49 +00:00 committed by Tim Abbott
parent 2ff41bf9e5
commit fe48ede9cf
1 changed files with 1 additions and 0 deletions

View File

@ -195,6 +195,7 @@ def enforce_proper_coverage(coverage_json: Any) -> bool:
for relative_path in enforce_fully_covered: for relative_path in enforce_fully_covered:
path = ROOT_DIR + "/" + relative_path path = ROOT_DIR + "/" + relative_path
if not (path in coverage_json): if not (path in coverage_json):
coverage_lost = True
print("ERROR: %s has no node test coverage" % (relative_path,)) print("ERROR: %s has no node test coverage" % (relative_path,))
continue continue
line_coverage = coverage_json[path]['s'] line_coverage = coverage_json[path]['s']