diff --git a/packages/bull/ZembleQueueMock.ts b/packages/bull/ZembleQueueMock.ts index 1e0697a1..3f56c9e7 100644 --- a/packages/bull/ZembleQueueMock.ts +++ b/packages/bull/ZembleQueueMock.ts @@ -25,6 +25,8 @@ class ZembleQueueMock['addBulk']>[number]) { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any const js = jobs.map((job) => this.#createMockJob(job.name, job.data as any, job.opts)) @@ -94,14 +94,12 @@ class ZembleQueueMock) { + async #executeWorker(job: Job) { try { - // eslint-disable-next-line no-plusplus - this.#jobsRemaining++ - return this.#worker(job, { logger: zembleContext.logger }) + return await this.#worker(job, { logger: zembleContext.logger }) } finally { // eslint-disable-next-line no-plusplus - this.#jobsRemaining-- + this.jobsRemaining-- this.#triggerWaitUntilFinishedIfNeeded() } } @@ -113,8 +111,10 @@ class ZembleQueueMock { - this.#executeWorker(job) + await this.#executeWorker(job) }, 0) return job } @@ -149,7 +149,7 @@ class ZembleQueueMock