Parcourir la source

✅ test(ci): add integration test commands and update test configurations

- 添加test:integration命令到多个模块的package.json中: advertisements-module, delivery-address-module, goods-module, merchant-module和supplier-module
- 更新supplier-module的集成测试文件,添加File实体依赖
- 在claude设置中重复添加pnpm test:integration:*命令到允许列表
yourname il y a 1 mois
Parent
commit
340c1aea00

+ 2 - 1
.claude/settings.local.json

@@ -44,7 +44,8 @@
       "Bash(pnpm test:coverage:*)",
       "Bash(pnpm run test:integration:*)",
       "Bash(pnpm install:*)",
-      "Bash(cat:*)"
+      "Bash(cat:*)",
+      "Bash(pnpm test:integration:*)"
     ],
     "deny": [],
     "ask": []

+ 1 - 0
packages/advertisements-module/package.json

@@ -40,6 +40,7 @@
     "dev": "tsc --watch",
     "test": "vitest run",
     "test:watch": "vitest",
+    "test:integration": "vitest run tests/integration",
     "test:coverage": "vitest run --coverage",
     "lint": "eslint src --ext .ts,.tsx",
     "typecheck": "tsc --noEmit"

+ 1 - 0
packages/delivery-address-module/package.json

@@ -40,6 +40,7 @@
     "dev": "tsc --watch",
     "test": "vitest run",
     "test:watch": "vitest",
+    "test:integration": "vitest run tests/integration",
     "test:coverage": "vitest run --coverage",
     "lint": "eslint src --ext .ts,.tsx",
     "typecheck": "tsc --noEmit"

+ 1 - 0
packages/goods-module/package.json

@@ -40,6 +40,7 @@
     "dev": "tsc --watch",
     "test": "vitest run",
     "test:watch": "vitest",
+    "test:integration": "vitest run tests/integration",
     "test:coverage": "vitest run --coverage",
     "lint": "eslint src --ext .ts,.tsx",
     "typecheck": "tsc --noEmit"

+ 1 - 0
packages/merchant-module/package.json

@@ -41,6 +41,7 @@
     "test": "vitest run",
     "test:watch": "vitest",
     "test:coverage": "vitest run --coverage",
+    "test:integration": "vitest run tests/integration",
     "lint": "eslint src --ext .ts,.tsx",
     "typecheck": "tsc --noEmit"
   },

+ 2 - 0
packages/supplier-module/package.json

@@ -41,6 +41,7 @@
     "test": "vitest run",
     "test:watch": "vitest",
     "test:coverage": "vitest run --coverage",
+    "test:integration": "vitest run tests/integration",
     "lint": "eslint src --ext .ts,.tsx",
     "typecheck": "tsc --noEmit"
   },
@@ -50,6 +51,7 @@
     "@d8d/shared-crud": "workspace:*",
     "@d8d/auth-module": "workspace:*",
     "@d8d/user-module": "workspace:*",
+    "@d8d/file-module": "workspace:*",
     "@hono/zod-openapi": "^1.0.2",
     "typeorm": "^0.3.20",
     "zod": "^4.1.12"

+ 2 - 1
packages/supplier-module/tests/integration/admin-routes.integration.test.ts

@@ -3,11 +3,12 @@ import { testClient } from 'hono/testing';
 import { IntegrationTestDatabase, setupIntegrationDatabaseHooksWithEntities } from '@d8d/shared-test-util';
 import { JWTUtil } from '@d8d/shared-utils';
 import { UserEntity, Role } from '@d8d/user-module';
+import { File } from '@d8d/file-module';
 import { adminSupplierRoutes } from '../../src/routes';
 import { Supplier } from '../../src/entities';
 
 // 设置集成测试钩子
-setupIntegrationDatabaseHooksWithEntities([UserEntity, Role, Supplier])
+setupIntegrationDatabaseHooksWithEntities([UserEntity, Role, Supplier, File])
 
 describe('管理员供应商管理API集成测试', () => {
   let client: ReturnType<typeof testClient<typeof adminSupplierRoutes>>;

+ 2 - 1
packages/supplier-module/tests/integration/user-routes.integration.test.ts

@@ -3,11 +3,12 @@ import { testClient } from 'hono/testing';
 import { IntegrationTestDatabase, setupIntegrationDatabaseHooksWithEntities } from '@d8d/shared-test-util';
 import { JWTUtil } from '@d8d/shared-utils';
 import { UserEntity, Role } from '@d8d/user-module';
+import { File } from '@d8d/file-module';
 import { userSupplierRoutes } from '../../src/routes';
 import { Supplier } from '../../src/entities';
 
 // 设置集成测试钩子
-setupIntegrationDatabaseHooksWithEntities([UserEntity, Role, Supplier])
+setupIntegrationDatabaseHooksWithEntities([UserEntity, Role, Supplier, File])
 
 describe('用户供应商管理API集成测试', () => {
   let client: ReturnType<typeof testClient<typeof userSupplierRoutes>>;