Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(e2e): Remove await timeout in nest e2e tests #13243

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -68,4 +69,9 @@ export class AppController {
async killTestCron() {
this.appService.killTestCron();
}

@Get('flush')
async flush() {
await flush();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Controller, Get, Param } from '@nestjs/common';
import { flush } from '@sentry/nestjs';
import { AppService } from './app.service';

@Controller()
Expand All @@ -14,4 +15,9 @@ export class AppController {
async testExpectedException(@Param('id') id: string) {
return this.appService.testExpectedException(id);
}

@Get('flush')
async flush() {
await flush();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -68,4 +69,9 @@ export class AppController {
async killTestCron() {
this.appService.killTestCron();
}

@Get('flush')
async flush() {
await flush();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Loading