From d0f75531ab9533423a4f55b5da18aa3a29bb68ac Mon Sep 17 00:00:00 2001 From: wangdl Date: Sun, 21 Jun 2026 11:03:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20TS=20=E7=B1=BB=E5=9E=8B=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20=E2=80=94=20itIfInfra=20=E7=AD=BE=E5=90=8D=20+=20lo?= =?UTF-8?q?gger=20=E5=A3=B0=E6=98=8E=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - itIfInfra: () => Promise → () => void | Promise(兼容同步测试) - AiJobService.logger: 移至 class 顶部,消除方法调用前未声明问题 Co-Authored-By: Claude --- src/modules/ai-job/ai-job.service.ts | 3 ++- test/m-ai-03-synthetic.e2e-spec.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/ai-job/ai-job.service.ts b/src/modules/ai-job/ai-job.service.ts index fb735d6..0e5334d 100644 --- a/src/modules/ai-job/ai-job.service.ts +++ b/src/modules/ai-job/ai-job.service.ts @@ -8,6 +8,8 @@ import { JobNotCancellableError } from './ai-job.errors'; @Injectable() export class AiJobService { + private readonly logger = new (require('@nestjs/common').Logger)(AiJobService.name); + constructor( private readonly prisma: PrismaService, private readonly lifecycleRepo: AiJobLifecycleRepository, @@ -189,7 +191,6 @@ export class AiJobService { return this.toAdminResponse(newJob); } - private logger = new (require('@nestjs/common').Logger)(AiJobService.name); // ── 可观测性 ── diff --git a/test/m-ai-03-synthetic.e2e-spec.ts b/test/m-ai-03-synthetic.e2e-spec.ts index af327ce..f97f4b6 100644 --- a/test/m-ai-03-synthetic.e2e-spec.ts +++ b/test/m-ai-03-synthetic.e2e-spec.ts @@ -97,7 +97,7 @@ describe('M-AI-03 Synthetic E2E (real infra)', () => { }); // Guard: skip all tests if infra not available - const itIfInfra = (name: string, fn: () => Promise) => { + const itIfInfra = (name: string, fn: () => void | Promise) => { it(name, async () => { if (!infraAvailable) { console.log(` [SKIP] Infra unavailable: ${name}`);