Skip to content

armgit / mocha

Public Imported from GitHub
0

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

fix(parallel): 'XUNIT' and 'JSON' reporter crash (#4623)

Curtis Man9e0369b03475
diff --git a/lib/hook.js b/lib/hook.js
index 890086fa..a246d053 100644
--- a/lib/hook.js
+++ b/lib/hook.js
@@ -62,7 +62,9 @@ Hook.prototype.error = function(err) {
*/
Hook.prototype.serialize = function serialize() {
return {
- $$isPending: this.isPending(),
+ $$currentRetry: this.currentRetry(),
+ $$fullTitle: this.fullTitle(),
+ $$isPending: Boolean(this.isPending()),
$$titlePath: this.titlePath(),
ctx:
this.ctx && this.ctx.currentTest
@@ -73,9 +75,13 @@ Hook.prototype.serialize = function serialize() {
}
}
: {},
+ duration: this.duration,
+ file: this.file,
parent: {
+ $$fullTitle: this.parent.fullTitle(),
[MOCHA_ID_PROP_NAME]: this.parent.id
},
+ state: this.state,
title: this.title,
type: this.type,
[MOCHA_ID_PROP_NAME]: this.id
diff --git a/lib/suite.js b/lib/suite.js
index 2f16b2f5..e3a63bbb 100644
--- a/lib/suite.js
+++ b/lib/suite.js
@@ -594,10 +594,10 @@ Suite.prototype.serialize = function serialize() {
return {
_bail: this._bail,
$$fullTitle: this.fullTitle(),
- $$isPending: this.isPending(),
+ $$isPending: Boolean(this.isPending()),
root: this.root,
title: this.title,
- id: this.id,
+ [MOCHA_ID_PROP_NAME]: this.id,
parent: this.parent ? {[MOCHA_ID_PROP_NAME]: this.parent.id} : null
};
};
diff --git a/lib/test.js b/lib/test.js
index f2be51b4..fc5f8727 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -92,7 +92,7 @@ Test.prototype.serialize = function serialize() {
return {
$$currentRetry: this._currentRetry,
$$fullTitle: this.fullTitle(),
- $$isPending: this.pending,
+ $$isPending: Boolean(this.pending),
$$retriedTest: this._retriedTest || null,
$$slow: this._slow,
$$titlePath: this.titlePath(),