fix: Gate E2E — Test.createTestingModule 缺少 Reflector provider
Some checks failed
Deploy API Server / build-and-unit (push) Successful in 34s
Deploy API Server / current-integration (push) Successful in 30s
Deploy API Server / backward-compat (push) Successful in 1s
Deploy API Server / m-ai-03-synthetic-e2e (push) Failing after 11s
Deploy API Server / deploy (push) Has been skipped

AdminAuthGuard 依赖 Reflector(@nestjs/core),TestingModule 不会自动导入。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-21 11:37:41 +08:00
parent dfbf91382b
commit 2f5989be49

View File

@ -1,5 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common'; import { INestApplication } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { JwtService } from '@nestjs/jwt'; import { JwtService } from '@nestjs/jwt';
import request from 'supertest'; import request from 'supertest';
import { AppModule } from '../src/app.module'; import { AppModule } from '../src/app.module';
@ -43,6 +44,7 @@ describe('M-AI-03 GATE E2E (fail-closed)', () => {
// AppModule.init() 连接 Prisma + Redis — 失败则测试 fail-closed // AppModule.init() 连接 Prisma + Redis — 失败则测试 fail-closed
const module: TestingModule = await Test.createTestingModule({ const module: TestingModule = await Test.createTestingModule({
imports: [AppModule], imports: [AppModule],
providers: [Reflector],
}).compile(); }).compile();
app = module.createNestApplication(); app = module.createNestApplication();