tests: Clean up test-js-with-node output on success.

This commit is contained in:
Joshua Pan 2018-03-24 23:53:40 -07:00 committed by showell
parent ed9eb3bdb5
commit 0f58f20ad8
1 changed files with 4 additions and 14 deletions

View File

@ -150,9 +150,6 @@ if options.coverage and ret == 0:
except IOError: except IOError:
print(NODE_COVERAGE_PATH + " doesn't exist. Cannot enforce fully covered files.") print(NODE_COVERAGE_PATH + " doesn't exist. Cannot enforce fully covered files.")
raise raise
print()
print("=============================================================================")
print("Checking enforced fully covered files...")
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):
@ -163,17 +160,12 @@ if options.coverage and ret == 0:
if not check_line_coverage(line_coverage, line_mapping): if not check_line_coverage(line_coverage, line_mapping):
ret = 1 ret = 1
if ret: if ret:
print()
print("It looks like your changes lost 100% test coverage in one or more files.") print("It looks like your changes lost 100% test coverage in one or more files.")
print("Usually, the right fix for this is to add some tests.") print("Usually, the right fix for this is to add some tests.")
print("But also check out the include/exclude lists in `tools/test-js-with-node`.") print("But also check out the include/exclude lists in `tools/test-js-with-node`.")
print("To run this check locally, use `test-js-with-node --coverage`.") print("To run this check locally, use `test-js-with-node --coverage`.")
else:
print("Success: All enforced fully covered files still have 100% test coverage!")
print("=============================================================================")
print()
print("=============================================================================")
print("Checking for fully covered files that are not enforced yet...")
ok = True ok = True
for path in coverage_json: for path in coverage_json:
if '/static/js/' in path: if '/static/js/' in path:
@ -184,15 +176,13 @@ if options.coverage and ret == 0:
and not (relative_path in enforce_fully_covered): and not (relative_path in enforce_fully_covered):
ok = False ok = False
print("ERROR: %s has complete node test coverage and is not enforced." % (relative_path,)) print("ERROR: %s has complete node test coverage and is not enforced." % (relative_path,))
if ok: if not ok:
print("Success: There are no fully covered files that are not enforced yet!") print()
else:
print("There are one or more fully covered files that are not enforced.") 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`.") print("Add the file(s) to enforce_fully_covered in `tools/test-js-with-node`.")
ret = 1 ret = 1
print("=============================================================================")
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")