test: fix flaky test

This commit is contained in:
Kamil Myśliwiec
2026-02-16 13:14:39 +01:00
parent dc33abecc1
commit a5c981c18b

View File

@@ -1,5 +1,6 @@
import { RequestMethod } from '@nestjs/common'; import { RequestMethod } from '@nestjs/common';
import { loadPackage } from '@nestjs/common/utils/load-package.util.js'; import { loadPackage } from '@nestjs/common/utils/load-package.util.js';
import * as microservicesPackage from '@nestjs/microservices';
import { MicroserviceOptions } from '@nestjs/microservices'; import { MicroserviceOptions } from '@nestjs/microservices';
import { ApplicationConfig } from '../application-config.js'; import { ApplicationConfig } from '../application-config.js';
import { NestContainer } from '../injector/container.js'; import { NestContainer } from '../injector/container.js';
@@ -12,12 +13,13 @@ describe('NestApplication', () => {
beforeAll(async () => { beforeAll(async () => {
// Pre-populate the package cache so that connectMicroservice() // Pre-populate the package cache so that connectMicroservice()
// can synchronously retrieve @nestjs/microservices via loadPackageCached. // can synchronously retrieve @nestjs/microservices via loadPackageCached.
// Use the already-imported module to avoid a slow dynamic import() on CI.
await loadPackage( await loadPackage(
'@nestjs/microservices', '@nestjs/microservices',
'NestApplication tests', 'NestApplication tests',
() => import('@nestjs/microservices'), () => microservicesPackage,
); );
}, 30_000); });
describe('Hybrid Application', () => { describe('Hybrid Application', () => {
class Interceptor { class Interceptor {