diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts index 5becddbc05e0..ec0a921da2c4 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts @@ -1,4 +1,5 @@ import { Controller, Get, Param, ParseIntPipe, UseGuards, UseInterceptors } from '@nestjs/common'; +import { flush } from '@sentry/nestjs'; import { AppService } from './app.service'; import { ExampleGuard } from './example.guard'; import { ExampleInterceptor } from './example.interceptor'; @@ -68,4 +69,9 @@ export class AppController { async killTestCron() { this.appService.killTestCron(); } + + @Get('flush') + async flush() { + await flush(); + } } diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/errors.test.ts index ccc919cdd025..34e626cb8c52 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/errors.test.ts @@ -65,7 +65,7 @@ test('Does not send HttpExceptions to Sentry', async ({ baseURL }) => { await transactionEventPromise400; await transactionEventPromise500; - await new Promise(resolve => setTimeout(resolve, 10000)); + (await fetch(`${baseURL}/flush`)).text(); expect(errorEventOccurred).toBe(false); }); @@ -90,7 +90,7 @@ test('Does not send RpcExceptions to Sentry', async ({ baseURL }) => { await transactionEventPromise; - await new Promise(resolve => setTimeout(resolve, 10000)); + (await fetch(`${baseURL}/flush`)).text(); expect(errorEventOccurred).toBe(false); }); diff --git a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/src/app.controller.ts b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/src/app.controller.ts index 71a410e8d0a8..0d2c46e90da2 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/src/app.controller.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/src/app.controller.ts @@ -1,4 +1,5 @@ import { Controller, Get, Param } from '@nestjs/common'; +import { flush } from '@sentry/nestjs'; import { AppService } from './app.service'; @Controller() @@ -14,4 +15,9 @@ export class AppController { async testExpectedException(@Param('id') id: string) { return this.appService.testExpectedException(id); } + + @Get('flush') + async flush() { + await flush(); + } } diff --git a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/errors.test.ts index 87b828dc8501..6fbc9f2c1f32 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/errors.test.ts @@ -81,7 +81,7 @@ test('Does not send exception to Sentry if user-defined global exception filter await transactionEventPromise; - await new Promise(resolve => setTimeout(resolve, 10000)); + (await fetch(`${baseURL}/flush`)).text(); expect(errorEventOccurred).toBe(false); }); @@ -111,7 +111,7 @@ test('Does not send exception to Sentry if user-defined local exception filter a await transactionEventPromise; - await new Promise(resolve => setTimeout(resolve, 10000)); + (await fetch(`${baseURL}/flush`)).text(); expect(errorEventOccurred).toBe(false); }); diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts index 5becddbc05e0..ec0a921da2c4 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts @@ -1,4 +1,5 @@ import { Controller, Get, Param, ParseIntPipe, UseGuards, UseInterceptors } from '@nestjs/common'; +import { flush } from '@sentry/nestjs'; import { AppService } from './app.service'; import { ExampleGuard } from './example.guard'; import { ExampleInterceptor } from './example.interceptor'; @@ -68,4 +69,9 @@ export class AppController { async killTestCron() { this.appService.killTestCron(); } + + @Get('flush') + async flush() { + await flush(); + } } diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/errors.test.ts index 171f42920487..0155c3887805 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/errors.test.ts @@ -65,7 +65,7 @@ test('Does not send HttpExceptions to Sentry', async ({ baseURL }) => { await transactionEventPromise400; await transactionEventPromise500; - await new Promise(resolve => setTimeout(resolve, 10000)); + (await fetch(`${baseURL}/flush`)).text(); expect(errorEventOccurred).toBe(false); }); @@ -90,7 +90,7 @@ test('Does not send RpcExceptions to Sentry', async ({ baseURL }) => { await transactionEventPromise; - await new Promise(resolve => setTimeout(resolve, 10000)); + (await fetch(`${baseURL}/flush`)).text(); expect(errorEventOccurred).toBe(false); });