Skip to content

armgit / mocha

Public Imported from GitHub
0

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

[reporter] Add `pending` field for json reporter

Quanlong Heb385deab1a6f
diff --git a/lib/reporters/json.js b/lib/reporters/json.js
index dcf89e06..4ec9e12d 100644
--- a/lib/reporters/json.js
+++ b/lib/reporters/json.js
@@ -25,6 +25,7 @@ function JSONReporter(runner) {
Base.call(this, runner);
var tests = []
+ , pending = []
, failures = []
, passes = [];
@@ -40,10 +41,15 @@ function JSONReporter(runner) {
failures.push(test);
});
+ runner.on('pending', function(test){
+ pending.push(test);
+ });
+
runner.on('end', function(){
var obj = {
stats: self.stats,
tests: tests.map(clean),
+ pending: pending.map(clean),
failures: failures.map(clean),
passes: passes.map(clean)
};