Skip to content

Commit c2e1240

Browse files
committed
fix tests
1 parent 061215e commit c2e1240

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

packages/nextjs/src/common/wrapApiHandlerWithSentry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz
115115
if (
116116
process.env.NODE_ENV === 'development' &&
117117
!process.env.SENTRY_IGNORE_API_RESOLUTION_ERROR &&
118-
!res.finished
118+
!res.writableEnded
119119
) {
120120
consoleSandbox(() => {
121121
// eslint-disable-next-line no-console

packages/nextjs/test/config/withSentry.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ describe('withSentry', () => {
2727
this.end();
2828
},
2929
end: function (this: AugmentedNextApiResponse) {
30+
// eslint-disable-next-line deprecation/deprecation
3031
this.finished = true;
32+
// @ts-expect-error This is a mock
33+
this.writableEnded = true;
3134
},
3235
} as unknown as AugmentedNextApiResponse;
3336
});

packages/node-experimental/test/integration/transactions.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,8 @@ describe('Integration | Transactions', () => {
644644
await new Promise(resolve => setTimeout(resolve, 10 * 60 * 1000));
645645
});
646646

647+
jest.advanceTimersByTime(1);
648+
647649
// Child-spans have been added to the exporter, but they are pending since they are waiting for their parant
648650
expect(exporter['_finishedSpans'].length).toBe(2);
649651
expect(beforeSendTransaction).toHaveBeenCalledTimes(0);

packages/utils/test/browser.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { getDomElement, htmlTreeAsString } from '../src/browser';
44

55
beforeAll(() => {
66
const dom = new JSDOM();
7-
// @ts-expect-error need to override global document
87
global.document = dom.window.document;
9-
// @ts-expect-error need to add HTMLElement type or it will not be found
108
global.HTMLElement = new JSDOM().window.HTMLElement;
119
});
1210

0 commit comments

Comments
 (0)