From fe48ede9cf5414d9809c4c175d3d7f5a71c7917b Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sun, 9 Feb 2020 14:11:49 +0000 Subject: [PATCH] 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. --- tools/test-js-with-node | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index a34a61803a..9d2ca449b7 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -195,6 +195,7 @@ def enforce_proper_coverage(coverage_json: Any) -> bool: for relative_path in enforce_fully_covered: path = ROOT_DIR + "/" + relative_path if not (path in coverage_json): + coverage_lost = True print("ERROR: %s has no node test coverage" % (relative_path,)) continue line_coverage = coverage_json[path]['s']