@tsed/bullmq 8.6.1 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/BullMQModule.spec.ts +8 -3
- package/vitest.config.mts +4 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/bullmq",
|
|
3
3
|
"description": "BullMQ integration for Ts.ED",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.7.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Ts.ED",
|
|
8
8
|
"BullMQ"
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
"build": "yarn barrels && yarn build:ts",
|
|
24
24
|
"barrels": "barrels",
|
|
25
25
|
"test": "vitest run",
|
|
26
|
-
"build:ts": "tsc --build tsconfig.json",
|
|
26
|
+
"build:ts": "tsc --build tsconfig.esm.json",
|
|
27
27
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"tslib": "2.7.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tsed/barrels": "8.
|
|
34
|
-
"@tsed/core": "8.
|
|
35
|
-
"@tsed/di": "8.
|
|
36
|
-
"@tsed/platform-http": "8.
|
|
37
|
-
"@tsed/schema": "8.
|
|
38
|
-
"@tsed/typescript": "8.
|
|
33
|
+
"@tsed/barrels": "8.7.0",
|
|
34
|
+
"@tsed/core": "8.7.0",
|
|
35
|
+
"@tsed/di": "8.7.0",
|
|
36
|
+
"@tsed/platform-http": "8.7.0",
|
|
37
|
+
"@tsed/schema": "8.7.0",
|
|
38
|
+
"@tsed/typescript": "8.7.0",
|
|
39
39
|
"bullmq": "^4.12.3 || ^5.1.1",
|
|
40
40
|
"eslint": "9.12.0",
|
|
41
41
|
"ts-mockito": "^2.6.1",
|
|
42
42
|
"typescript": "5.4.5",
|
|
43
|
-
"vitest": "
|
|
43
|
+
"vitest": "3.0.9"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"bullmq": "^4.12.3 || ^5.1.1"
|
package/src/BullMQModule.spec.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./BullMQModule.js";
|
|
2
2
|
|
|
3
3
|
import {catchAsyncError} from "@tsed/core";
|
|
4
|
+
import {logger} from "@tsed/di";
|
|
4
5
|
import {PlatformTest} from "@tsed/platform-http/testing";
|
|
5
6
|
import {Queue, Worker} from "bullmq";
|
|
6
7
|
import {anything, instance, mock, verify, when} from "ts-mockito";
|
|
@@ -17,6 +18,8 @@ import {JobDispatcher} from "./dispatchers/index.js";
|
|
|
17
18
|
const queueConstructorSpy = vi.fn();
|
|
18
19
|
const workerConstructorSpy = vi.fn();
|
|
19
20
|
|
|
21
|
+
vi.spyOn(logger(), "error");
|
|
22
|
+
|
|
20
23
|
vi.mock("bullmq", () => {
|
|
21
24
|
return {
|
|
22
25
|
Queue: class {
|
|
@@ -384,6 +387,10 @@ describe("BullMQModule", () => {
|
|
|
384
387
|
});
|
|
385
388
|
|
|
386
389
|
it("should run worker, execute processor and handle error", async () => {
|
|
390
|
+
vi.spyOn(logger(), "error").mockReturnThis();
|
|
391
|
+
|
|
392
|
+
logger().level = "error";
|
|
393
|
+
|
|
387
394
|
const bullMQModule = PlatformTest.get<BullMQModule>(BullMQModule);
|
|
388
395
|
const worker = PlatformTest.get<JobMethods>("bullmq.job.default.regular");
|
|
389
396
|
const job = {
|
|
@@ -393,14 +400,12 @@ describe("BullMQModule", () => {
|
|
|
393
400
|
attemptsMade: 1
|
|
394
401
|
};
|
|
395
402
|
|
|
396
|
-
vi.spyOn(PlatformTest.injector.logger, "error");
|
|
397
|
-
|
|
398
403
|
vi.spyOn(worker, "handle").mockRejectedValue(new Error("error") as never);
|
|
399
404
|
|
|
400
405
|
const error = await catchAsyncError(() => (bullMQModule as any).onProcess(job));
|
|
401
406
|
|
|
402
407
|
expect(worker.handle).toHaveBeenCalledWith({test: "test"}, job);
|
|
403
|
-
expect(
|
|
408
|
+
expect(logger().error).toHaveBeenCalledWith({
|
|
404
409
|
attempt: 1,
|
|
405
410
|
name: "regular",
|
|
406
411
|
queue: "default",
|
package/vitest.config.mts
CHANGED