@bull-board/nestjs 8.0.0 → 8.0.1

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/jest.config.js ADDED
@@ -0,0 +1,20 @@
1
+ const { defaults: tsJest } = require('ts-jest/presets');
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ transform: {
6
+ ...tsJest.transform,
7
+ '^.+\\.tsx?$': [
8
+ 'ts-jest',
9
+ {
10
+ tsconfig: {
11
+ experimentalDecorators: true,
12
+ emitDecoratorMetadata: true,
13
+ esModuleInterop: true,
14
+ },
15
+ },
16
+ ],
17
+ },
18
+ testMatch: ['<rootDir>/tests/**/*.spec.ts'],
19
+ testTimeout: 30000,
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bull-board/nestjs",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "A NestJS module for Bull-Board dashboard.",
5
5
  "keywords": [
6
6
  "bull",
@@ -24,25 +24,32 @@
24
24
  },
25
25
  "scripts": {
26
26
  "build": "yarn clean && tsc",
27
- "clean": "rm -rf dist"
27
+ "clean": "rm -rf dist",
28
+ "test": "jest"
28
29
  },
29
30
  "devDependencies": {
30
- "@bull-board/api": "^8.0.0",
31
- "@bull-board/express": "^8.0.0",
32
- "@bull-board/fastify": "^8.0.0",
31
+ "@bull-board/api": "^8.0.1",
32
+ "@bull-board/express": "^8.0.1",
33
+ "@bull-board/fastify": "^8.0.1",
34
+ "@bull-board/test-utils": "workspace:*",
33
35
  "@nestjs/bull-shared": "^11.0.4",
34
36
  "@nestjs/bullmq": "^11.0.4",
35
37
  "@nestjs/common": "^11.1.24",
36
38
  "@nestjs/core": "^11.1.24",
39
+ "@nestjs/platform-express": "^11.0.0",
37
40
  "@types/node": "^22.19.20",
41
+ "@types/supertest": "^6.0.2",
38
42
  "bull": "^4.16.5",
39
43
  "bullmq": "^5.78.0",
44
+ "jest": "^30.0.0",
40
45
  "reflect-metadata": "^0.2.2",
41
46
  "rxjs": "^7.8.2",
47
+ "supertest": "^7.0.0",
48
+ "ts-jest": "^29.0.0",
42
49
  "typescript": "^5.9.3"
43
50
  },
44
51
  "peerDependencies": {
45
- "@bull-board/api": "^8.0.0",
52
+ "@bull-board/api": "^8.0.1",
46
53
  "@nestjs/bull-shared": "^10.0.0 || ^11.0.0",
47
54
  "@nestjs/common": "^9.0.0 || ^10.0.0 || ^11.0.0",
48
55
  "@nestjs/core": "^9.0.0 || ^10.0.0 || ^11.0.0",
@@ -0,0 +1,50 @@
1
+ import 'reflect-metadata';
2
+ import { ExpressAdapter as BullBoardExpressAdapter } from '@bull-board/express';
3
+ import {
4
+ runServerAdapterContract,
5
+ uiFixtureBasePath,
6
+ NormalizedResponse,
7
+ ContractRequest,
8
+ } from '@bull-board/test-utils';
9
+ import { NestFactory } from '@nestjs/core';
10
+ import { ExpressAdapter } from '@nestjs/platform-express';
11
+ import { json } from 'express';
12
+ import request from 'supertest';
13
+ import { BullBoardModule } from '../src';
14
+ import { BULL_BOARD_INSTANCE } from '../src/bull-board.constants';
15
+ import type { BullBoardInstance } from '../src/bull-board.types';
16
+
17
+ runServerAdapterContract('NestJS', async ({ basePath, queue }) => {
18
+ const nestExpressAdapter = new ExpressAdapter();
19
+
20
+ const route = basePath || '/';
21
+
22
+ const appModule = BullBoardModule.forRoot({
23
+ route,
24
+ adapter: BullBoardExpressAdapter,
25
+ boardOptions: { uiBasePath: uiFixtureBasePath },
26
+ middleware: json(),
27
+ });
28
+
29
+ const app = await NestFactory.create(appModule, nestExpressAdapter, { logger: false });
30
+ await app.init();
31
+
32
+ const board = app.get<BullBoardInstance>(BULL_BOARD_INSTANCE);
33
+ board.addQueue(queue.adapter);
34
+
35
+ const send = async (req: ContractRequest): Promise<NormalizedResponse> => {
36
+ const agent = request(app.getHttpServer());
37
+ const m = req.method.toLowerCase() as 'get' | 'post' | 'put' | 'delete';
38
+ let r = agent[m](req.path);
39
+ if (req.body !== undefined) r = r.send(req.body as object);
40
+ const res = await r;
41
+ return { status: res.status, headers: res.headers as any, text: res.text };
42
+ };
43
+
44
+ return {
45
+ request: send,
46
+ teardown: async () => {
47
+ await app.close();
48
+ },
49
+ };
50
+ });