Skip to content

Commit

Permalink
fix: return always the same error contract from simplifyTest (#3168)
Browse files Browse the repository at this point in the history
Co-authored-by: André Mota <andre.mota@glintt.com>
  • Loading branch information
andremoah and cockpit-glintt committed Jan 8, 2022
1 parent 441d872 commit ad14258
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions lib/command/workers/runTests.js
Expand Up @@ -73,6 +73,27 @@ function filterTests() {
}

function initializeListeners() {
function simplifyError(error) {
if (error) {
const {
stack,
uncaught,
message,
actual,
expected,
} = error;

return {
stack,
uncaught,
message,
actual,
expected,
};
}

return null;
}
function simplifyTest(test, err = null) {
test = { ...test };

Expand All @@ -82,13 +103,10 @@ function initializeListeners() {
}

if (test.err) {
err = {
stack: test.err.stack,
uncaught: test.err.uncaught,
message: test.err.message,
actual: test.err.actual,
expected: test.err.expected,
};
err = simplifyError(test.err);
test.status = 'failed';
} else if (err) {
err = simplifyError(err);
test.status = 'failed';
}
const parent = {};
Expand Down

0 comments on commit ad14258

Please sign in to comment.