Skip to content

Commit

Permalink
fix xunit reporter crash when used with parallel mode
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisman authored and juergba committed Aug 24, 2021
1 parent 014e47a commit cbbcc0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
14 changes: 5 additions & 9 deletions lib/hook.js
Expand Up @@ -62,22 +62,18 @@ Hook.prototype.error = function(err) {
*/
Hook.prototype.serialize = function serialize() {
return {
$$isPending: this.isPending(),
$$isPending: !!this.isPending(),
$$titlePath: this.titlePath(),
ctx:
this.ctx && this.ctx.currentTest
? {
currentTest: {
title: this.ctx.currentTest.title,
[MOCHA_ID_PROP_NAME]: this.ctx.currentTest.id
}
currentTest: this.ctx.currentTest.serialize()
}
: {},
parent: {
[MOCHA_ID_PROP_NAME]: this.parent.id
},
parent: this.parent.serialize(),
state: this.state,
title: this.title,
type: this.type,
[MOCHA_ID_PROP_NAME]: this.id
[MOCHA_ID_PROP_NAME]: this[MOCHA_ID_PROP_NAME]
};
};
6 changes: 3 additions & 3 deletions lib/suite.js
Expand Up @@ -594,11 +594,11 @@ Suite.prototype.serialize = function serialize() {
return {
_bail: this._bail,
$$fullTitle: this.fullTitle(),
$$isPending: this.isPending(),
$$isPending: !!this.isPending(),
root: this.root,
title: this.title,
id: this.id,
parent: this.parent ? {[MOCHA_ID_PROP_NAME]: this.parent.id} : null
parent: this.parent ? this.parent.serialize() : null,
[MOCHA_ID_PROP_NAME]: this[MOCHA_ID_PROP_NAME]
};
};

Expand Down
9 changes: 3 additions & 6 deletions lib/test.js
Expand Up @@ -92,22 +92,19 @@ Test.prototype.serialize = function serialize() {
return {
$$currentRetry: this._currentRetry,
$$fullTitle: this.fullTitle(),
$$isPending: this.pending,
$$isPending: !!this.pending,
$$retriedTest: this._retriedTest || null,
$$slow: this._slow,
$$titlePath: this.titlePath(),
body: this.body,
duration: this.duration,
err: this.err,
parent: {
$$fullTitle: this.parent.fullTitle(),
[MOCHA_ID_PROP_NAME]: this.parent.id
},
parent: this.parent.serialize(),
speed: this.speed,
state: this.state,
title: this.title,
type: this.type,
file: this.file,
[MOCHA_ID_PROP_NAME]: this.id
[MOCHA_ID_PROP_NAME]: this[MOCHA_ID_PROP_NAME]
};
};

0 comments on commit cbbcc0f

Please sign in to comment.