Skip to content

Commit

Permalink
test: better error rejection hadling
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Jan 13, 2025
1 parent 884ec22 commit 81762a0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/test_sandboxed_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,16 +520,20 @@ function sandboxProcessTests(
},
);

await new Promise<void>(resolve => {
await new Promise<void>((resolve, reject) => {
worker.on(
'failed',
after(2, (job: Job, error) => {
const elapse = Date.now() - start;
expect(error.name).to.be.eql('UnrecoverableError');
expect(error.message).to.be.eql(UNRECOVERABLE_ERROR);
expect(elapse).to.be.greaterThan(1000);
expect(job.attemptsMade).to.be.eql(2);
resolve();
try {
const elapse = Date.now() - start;
expect(error.name).to.be.eql('UnrecoverableError');
expect(error.message).to.be.eql(UNRECOVERABLE_ERROR);
expect(elapse).to.be.greaterThan(1000);
expect(job.attemptsMade).to.be.eql(2);
resolve();
} catch (err) {
reject(err);
}
}),
);
});
Expand Down

0 comments on commit 81762a0

Please sign in to comment.