Skip to content

Commit 66f4701

Browse files
committed
more deprecations with toThrowError
1 parent 4af2c5a commit 66f4701

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

packages/astro/test/server/middleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ describe('sentryMiddleware', () => {
142142
});
143143

144144
// @ts-expect-error, a partial ctx object is fine here
145-
await expect(async () => middleware(ctx, next)).rejects.toThrowError();
145+
await expect(async () => middleware(ctx, next)).rejects.toThrow();
146146

147147
expect(captureExceptionSpy).toHaveBeenCalledWith(error, {
148148
mechanism: { handled: false, type: 'astro', data: { function: 'astroMiddleware' } },

packages/cloudflare/test/transport.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('IsolatedPromiseBuffer', () => {
140140
await ipb.add(task2);
141141
await ipb.add(task3);
142142

143-
await expect(ipb.add(task4)).rejects.toThrowError('Not adding Promise because buffer limit was reached.');
143+
await expect(ipb.add(task4)).rejects.toThrow('Not adding Promise because buffer limit was reached.');
144144
});
145145

146146
it('should not throw when one of the tasks throws when drained', async () => {

packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('wrapCloudEventFunction', () => {
119119
});
120120

121121
const wrappedHandler = wrapCloudEventFunction(handler);
122-
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrowError(error);
122+
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrow(error);
123123

124124
const fakeTransactionContext = {
125125
name: 'event.type',
@@ -143,7 +143,7 @@ describe('wrapCloudEventFunction', () => {
143143
throw error;
144144
};
145145
const wrappedHandler = wrapCloudEventFunction(handler);
146-
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrowError(error);
146+
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrow(error);
147147

148148
const fakeTransactionContext = {
149149
name: 'event.type',
@@ -189,7 +189,7 @@ describe('wrapCloudEventFunction', () => {
189189
cb(error);
190190
};
191191
const wrappedHandler = wrapCloudEventFunction(handler);
192-
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrowError(error);
192+
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrow(error);
193193

194194
const fakeTransactionContext = {
195195
name: 'event.type',
@@ -212,7 +212,7 @@ describe('wrapCloudEventFunction', () => {
212212
throw error;
213213
};
214214
const wrappedHandler = wrapCloudEventFunction(handler);
215-
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrowError(error);
215+
await expect(handleCloudEvent(wrappedHandler)).rejects.toThrow(error);
216216

217217
const fakeTransactionContext = {
218218
name: 'event.type',

packages/google-cloud-serverless/test/gcpfunction/events.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe('wrapEventFunction', () => {
9292
throw error;
9393
};
9494
const wrappedHandler = wrapEventFunction(handler);
95-
await expect(handleEvent(wrappedHandler)).rejects.toThrowError(error);
95+
await expect(handleEvent(wrappedHandler)).rejects.toThrow(error);
9696

9797
const fakeTransactionContext = {
9898
name: 'event.type',
@@ -145,7 +145,7 @@ describe('wrapEventFunction', () => {
145145
});
146146

147147
const wrappedHandler = wrapEventFunction(handler);
148-
await expect(handleEvent(wrappedHandler)).rejects.toThrowError(error);
148+
await expect(handleEvent(wrappedHandler)).rejects.toThrow(error);
149149

150150
const fakeTransactionContext = {
151151
name: 'event.type',
@@ -191,7 +191,7 @@ describe('wrapEventFunction', () => {
191191
cb(error);
192192
};
193193
const wrappedHandler = wrapEventFunction(handler);
194-
await expect(handleEvent(wrappedHandler)).rejects.toThrowError(error);
194+
await expect(handleEvent(wrappedHandler)).rejects.toThrow(error);
195195

196196
const fakeTransactionContext = {
197197
name: 'event.type',
@@ -214,7 +214,7 @@ describe('wrapEventFunction', () => {
214214
throw error;
215215
};
216216
const wrappedHandler = wrapEventFunction(handler);
217-
await expect(handleEvent(wrappedHandler)).rejects.toThrowError(error);
217+
await expect(handleEvent(wrappedHandler)).rejects.toThrow(error);
218218

219219
const fakeTransactionContext = {
220220
name: 'event.type',
@@ -236,7 +236,7 @@ describe('wrapEventFunction', () => {
236236
throw error;
237237
};
238238
const wrappedHandler = wrapEventFunction(handler);
239-
await expect(handleEvent(wrappedHandler)).rejects.toThrowError(error);
239+
await expect(handleEvent(wrappedHandler)).rejects.toThrow(error);
240240

241241
expect(mockCaptureException).toHaveBeenCalledWith(error, expect.any(Function));
242242

packages/node/test/cron.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('cron check-ins', () => {
103103
//
104104
},
105105
});
106-
}).toThrowError("A job named 'my-cron-job' has already been scheduled");
106+
}).toThrow("A job named 'my-cron-job' has already been scheduled");
107107
});
108108
});
109109

@@ -149,7 +149,7 @@ describe('cron check-ins', () => {
149149
cronWithCheckIn.schedule('* * * * *', () => {
150150
//
151151
});
152-
}).toThrowError('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');
152+
}).toThrow('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');
153153
});
154154
});
155155

@@ -194,7 +194,7 @@ describe('cron check-ins', () => {
194194
scheduleWithCheckIn.scheduleJob('my-cron-job', new Date(), () => {
195195
//
196196
});
197-
}).toThrowError(
197+
}).toThrow(
198198
"Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string",
199199
);
200200
});
@@ -212,7 +212,7 @@ describe('cron check-ins', () => {
212212
scheduleWithCheckIn.scheduleJob('* * * * *', () => {
213213
//
214214
});
215-
}).toThrowError(
215+
}).toThrow(
216216
"Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string",
217217
);
218218
});

packages/replay-internal/test/unit/eventBuffer/EventBufferArray.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('Unit | eventBuffer | EventBufferArray', () => {
6363
await buffer.addEvent(largeEvent);
6464

6565
// Now it should error
66-
await expect(() => buffer.addEvent(largeEvent)).rejects.toThrowError(EventBufferSizeExceededError);
66+
await expect(() => buffer.addEvent(largeEvent)).rejects.toThrow(EventBufferSizeExceededError);
6767
});
6868

6969
it('resets size limit on clear', async function () {

packages/replay-internal/test/unit/eventBuffer/EventBufferCompressionWorker.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe('Unit | eventBuffer | EventBufferCompressionWorker', () => {
172172
await buffer.addEvent(largeEvent);
173173

174174
// Now it should error
175-
await expect(() => buffer.addEvent(largeEvent)).rejects.toThrowError(EventBufferSizeExceededError);
175+
await expect(() => buffer.addEvent(largeEvent)).rejects.toThrow(EventBufferSizeExceededError);
176176
});
177177

178178
it('resets size limit on clear', async function () {

packages/sveltekit/test/server/serverRoute.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('wrapServerRouteWithSentry', () => {
8282

8383
await expect(async () => {
8484
await wrappedRouteHandler(getRequestEventMock() as RequestEvent);
85-
}).rejects.toThrowError('Server Route Error');
85+
}).rejects.toThrow('Server Route Error');
8686

8787
expect(captureExceptionSpy).toHaveBeenCalledWith(error, {
8888
mechanism: { type: 'sveltekit', handled: false, data: { function: 'serverRoute' } },

packages/utils/test/promisebuffer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('PromiseBuffer', () => {
1919
});
2020
const producer2 = jest.fn(() => new SyncPromise(resolve => setTimeout(resolve)));
2121
expect(buffer.add(producer1)).toEqual(task1);
22-
void expect(buffer.add(producer2)).rejects.toThrowError();
22+
void expect(buffer.add(producer2)).rejects.toThrow();
2323
expect(buffer.$.length).toEqual(1);
2424
expect(producer1).toHaveBeenCalled();
2525
expect(producer2).not.toHaveBeenCalled();

packages/vercel-edge/test/transports/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('IsolatedPromiseBuffer', () => {
139139
await ipb.add(task2);
140140
await ipb.add(task3);
141141

142-
await expect(ipb.add(task4)).rejects.toThrowError('Not adding Promise because buffer limit was reached.');
142+
await expect(ipb.add(task4)).rejects.toThrow('Not adding Promise because buffer limit was reached.');
143143
});
144144

145145
it('should not throw when one of the tasks throws when drained', async () => {

0 commit comments

Comments
 (0)