Skip to content

Commit 7cd79af

Browse files
committed
Merge branch 'feat/separate-source-reading' of https://github.com/timfish/sentry-javascript into feat/separate-source-reading
2 parents 965d48f + e08bcbb commit 7cd79af

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/nextjs/test/index.server.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { BaseClient } from '@sentry/core';
21
import { RewriteFrames } from '@sentry/integrations';
32
import * as SentryNode from '@sentry/node';
43
import { getCurrentHub, NodeClient } from '@sentry/node';
@@ -17,7 +16,6 @@ const global = getGlobalObject();
1716
(global as typeof global & { __rewriteFramesDistDir__: string }).__rewriteFramesDistDir__ = '.next';
1817

1918
const nodeInit = jest.spyOn(SentryNode, 'init');
20-
const captureEvent = jest.spyOn(BaseClient.prototype, 'captureEvent');
2119
const logError = jest.spyOn(logger, 'error');
2220

2321
describe('Server init()', () => {
@@ -91,7 +89,7 @@ describe('Server init()', () => {
9189
expect(currentScope._tags.vercel).toBeUndefined();
9290
});
9391

94-
it('adds 404 transaction filter', () => {
92+
it('adds 404 transaction filter', async () => {
9593
init({
9694
dsn: 'https://[email protected]/12312012',
9795
tracesSampleRate: 1.0,
@@ -102,8 +100,10 @@ describe('Server init()', () => {
102100
const transaction = hub.startTransaction({ name: '/404' });
103101
transaction.finish();
104102

103+
// We need to flush because the event processor pipeline is async whereas transaction.finish() is sync.
104+
await SentryNode.flush();
105+
105106
expect(sendEvent).not.toHaveBeenCalled();
106-
expect(captureEvent.mock.results[0].value).toBeUndefined();
107107
expect(logError).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.'));
108108
});
109109

0 commit comments

Comments
 (0)