tools: Make sure missing lines in node test coverage are correct.

This commit is contained in:
Joshua Pan 2017-06-17 18:33:34 -07:00 committed by showell
parent c4d38c1344
commit d1408125b2
1 changed files with 3 additions and 1 deletions

View File

@ -112,10 +112,12 @@ if options.coverage and ret == 0:
print("ERROR: %s has no node test coverage" % (relative_path,))
continue
line_coverage = coverage_json[path]['s']
line_mapping = coverage_json[path]['statementMap']
missing_lines = []
for line in line_coverage:
if line_coverage[line] == 0:
missing_lines.append(line)
actual_line = line_mapping[line]
missing_lines.append(str(actual_line["start"]["line"]))
if len(missing_lines):
print("ERROR: %s no longer has complete node test coverage" % (relative_path,))
print(" Lines missing coverage: %s" % (", ".join(sorted(missing_lines, key=int)),))