feat: explain analyze

This commit is contained in:
2026-10-21 11:09:31 +03:00
parent 552b74eb95
commit 1d5c1e0cc6
3 changed files with 181 additions and 7 deletions
+14 -7
View File
@@ -17,16 +17,23 @@ export interface TestUser {
token: string;
}
export async function createTestApp(): Promise<{
export async function createTestApp(env: Record<string, string> = {}): Promise<{
app: INestApplication;
server: any;
}> {
const moduleRef = await Test.createTestingModule({
imports: [AppModule],
}).compile();
const app = moduleRef.createNestApplication<NestFastifyApplication>(
new FastifyAdapter(),
);
const saved = { ...process.env };
Object.assign(process.env, env);
let app: NestFastifyApplication;
try {
const moduleRef = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleRef.createNestApplication<NestFastifyApplication>(
new FastifyAdapter(),
);
} finally {
process.env = saved;
}
configureApp(app);
await app.listen(0, '127.0.0.1');
return { app, server: app.getHttpServer() };