Skip to content

Commit

Permalink
test(job): stacktraceLimit test compare stacktrace (taskforcesh#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
nocodehummel committed Mar 25, 2024
1 parent b8df5a9 commit 24122ee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,11 +810,18 @@ describe('Job', function () {
const job = (await worker.getNextJob(token)) as Job;
const isFailed = await job.isFailed();
expect(isFailed).to.be.equal(false);
await job.moveToFailed(new Error('test error'), '0', true);
// first time failed.
await job.moveToFailed(new Error('failed once'), '0', true);
const isFailed2 = await job.isFailed();
const stackTrace1 = job.stacktrace[0];
expect(isFailed2).to.be.equal(true);
expect(job.stacktrace).not.be.equal(null);
expect(job.stacktrace.length).to.be.equal(stackTraceLimit);
// second time failed.
await job.moveToFailed(new Error('failed twice'), '0', true);
const stackTrace2 = job.stacktrace[0];
expect(job.stacktrace.length).to.be.equal(stackTraceLimit);
expect(stackTrace1).not.be.equal(stackTrace2);
await worker.close();
});

Expand Down

0 comments on commit 24122ee

Please sign in to comment.