Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Sorted the results in the json coverage reporter on their filename.

Simon Gaeremynck0741ac44f3e9
diff --git a/lib/reporters/json-cov.js b/lib/reporters/json-cov.js
index 7eeab30e..73d00093 100644
--- a/lib/reporters/json-cov.js
+++ b/lib/reporters/json-cov.js
@@ -80,6 +80,10 @@ function map(cov) {
ret.sloc += data.sloc;
}
+ ret.files.sort(function(a, b) {
+ return a.filename.localeCompare(b.filename);
+ });
+
if (ret.sloc > 0) {
ret.coverage = (ret.hits / ret.sloc) * 100;
}