Skip to content

Commit

Permalink
Recognize uncaught exceptions in our own tests
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed May 9, 2020
1 parent 9ec7b69 commit 684379a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions test/helpers/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,30 @@ exports.fixture = async (...args) => {
AVA_EMIT_RUN_STATUS_OVER_IPC: 'I\'ll find a payphone baby / Take some time to talk to you'
},
cwd,
reject: false,
serialization,
stderr: 'inherit'
});

const stats = {
passed: []
passed: [],
uncaughtExceptions: []
};

running.on('message', message => {
running.on('message', statusEvent => {
if (serialization === 'json') {
message = v8.deserialize(Uint8Array.from(message));
statusEvent = v8.deserialize(Uint8Array.from(statusEvent));
}

switch (message.type) {
switch (statusEvent.type) {
case 'uncaught-exception': {
const {message, name, stack} = statusEvent.err;
stats.uncaughtExceptions.push({message, name, stack});
break;
}

case 'test-passed': {
const {title, testFile} = message;
const {title, testFile} = statusEvent;
stats.passed.push({title, file: path.posix.relative(cwd, testFile)});
break;
}
Expand Down

0 comments on commit 684379a

Please sign in to comment.