Fix logs in integration tests (#11632)

## Before
<img width="1512" alt="image"
src="https://github.com/user-attachments/assets/3e8be2e0-ac16-4735-8783-69c800bf0aaf"
/>

## After
<img width="1512" alt="image"
src="https://github.com/user-attachments/assets/1a83e7ce-d70a-43c4-a6cd-89dd456d80c1"
/>
This commit is contained in:
martmull
2025-04-17 17:05:10 +02:00
committed by GitHub
parent caf44207fd
commit e4150ff3cb
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,17 @@
import { Injectable } from '@nestjs/common';
import { ExceptionHandlerOptions } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface';
import { ExceptionHandlerDriverInterface } from 'src/engine/core-modules/exception-handler/interfaces';
@Injectable()
export class ExceptionHandlerMockService
implements ExceptionHandlerDriverInterface
{
captureExceptions(
exceptions: readonly any[],
_?: ExceptionHandlerOptions | undefined,
): string[] {
return exceptions.map(() => 'mocked-exception-id');
}
}

View File

@ -4,6 +4,8 @@ import { Test, TestingModule, TestingModuleBuilder } from '@nestjs/testing';
import { AppModule } from 'src/app.module';
import { StripeSDKMockService } from 'src/engine/core-modules/billing/stripe/stripe-sdk/mocks/stripe-sdk-mock.service';
import { StripeSDKService } from 'src/engine/core-modules/billing/stripe/stripe-sdk/services/stripe-sdk.service';
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
import { ExceptionHandlerMockService } from 'src/engine/core-modules/exception-handler/mocks/exception-handler-mock.service';
interface TestingModuleCreatePreHook {
(moduleBuilder: TestingModuleBuilder): TestingModuleBuilder;
@ -26,11 +28,14 @@ export const createApp = async (
} = {},
): Promise<NestExpressApplication> => {
const stripeSDKMockService = new StripeSDKMockService();
const mockExceptionHandlerService = new ExceptionHandlerMockService();
let moduleBuilder: TestingModuleBuilder = Test.createTestingModule({
imports: [AppModule],
})
.overrideProvider(StripeSDKService)
.useValue(stripeSDKMockService);
.useValue(stripeSDKMockService)
.overrideProvider(ExceptionHandlerService)
.useValue(mockExceptionHandlerService);
if (config.moduleBuilderHook) {
moduleBuilder = config.moduleBuilderHook(moduleBuilder);
@ -49,5 +54,7 @@ export const createApp = async (
await app.init();
app.useLogger(false);
return app;
};