test-js-with-node: Add check for fully covered files that are not enforced.

This commit is contained in:
Joshua Pan 2017-06-23 03:04:23 -07:00 committed by showell
parent c625a80b90
commit a63fd95b6a
1 changed files with 21 additions and 0 deletions

View File

@ -147,6 +147,27 @@ if options.coverage and ret == 0:
print("=============================================================================") print("=============================================================================")
print() print()
print("=============================================================================")
print("Checking for fully covered files that are not enforced yet...")
ok = True
for path in coverage_json:
if '/static/js/' in path:
relative_path = os.path.relpath(path, ROOT_DIR)
line_coverage = coverage_json[path]['s']
line_mapping = coverage_json[path]['statementMap']
if check_line_coverage(line_coverage, line_mapping, log=False) \
and not (relative_path in enforce_fully_covered):
ok = False
print("ERROR: %s has complete node test coverage and is not enforced." % (relative_path,))
if ok:
print("Success: There are no fully covered files that are not enforced yet!")
else:
print("There are one or more fully covered files that are not enforced.")
print("Add the file(s) to enforce_fully_covered in `tools/test-js-with-node`.")
ret = 1
print("=============================================================================")
print()
if ret == 0: if ret == 0:
if options.coverage: if options.coverage:
print("View coverage reports at http://127.0.0.1:9991/node-coverage/index.html") print("View coverage reports at http://127.0.0.1:9991/node-coverage/index.html")