Skip to content

Commit 50a6580

Browse files
committed
refactor: wip
1 parent f393a31 commit 50a6580

4 files changed

Lines changed: 25 additions & 25 deletions

File tree

packages/utils/src/lib/profiler/profiler-node.unit.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ describe('NodejsProfiler', () => {
294294

295295
profiler.close();
296296

297-
expect(() => profiler.setEnabled(true)).toThrowError(
297+
expect(() => profiler.setEnabled(true)).toThrow(
298298
'Profiler already closed',
299299
);
300-
expect(() => profiler.setEnabled(false)).toThrowError(
300+
expect(() => profiler.setEnabled(false)).toThrow(
301301
'Profiler already closed',
302302
);
303303

@@ -317,7 +317,7 @@ describe('NodejsProfiler', () => {
317317
// This should not throw since we're using the public API correctly
318318
profiler.setEnabled(false);
319319
profiler.setEnabled(true);
320-
}).not.toThrowError();
320+
}).not.toThrow();
321321
});
322322
});
323323

@@ -399,7 +399,7 @@ describe('NodejsProfiler', () => {
399399
profiler.measure('error-test', () => {
400400
throw error;
401401
});
402-
}).toThrowError(error);
402+
}).toThrow(error);
403403
});
404404

405405
it('should propagate errors from measureAsync work function', async () => {
@@ -410,7 +410,7 @@ describe('NodejsProfiler', () => {
410410
profiler.measureAsync('async-error-test', async () => {
411411
throw error;
412412
}),
413-
).rejects.toThrowError(error);
413+
).rejects.toThrow(error);
414414
});
415415

416416
it('should skip measurement when profiler is not active', () => {
@@ -447,7 +447,7 @@ describe('NodejsProfiler', () => {
447447

448448
expect(() => {
449449
profiler.marker('inactive-marker');
450-
}).not.toThrowError();
450+
}).not.toThrow();
451451
});
452452

453453
it('base Profiler behavior: should always be active in base profiler', () => {
@@ -471,7 +471,7 @@ describe('NodejsProfiler', () => {
471471

472472
expect(() => {
473473
profiler.marker('base-marker');
474-
}).not.toThrowError();
474+
}).not.toThrow();
475475
});
476476
});
477477

@@ -789,7 +789,7 @@ describe('NodejsProfiler', () => {
789789
});
790790

791791
it('installs exit handlers on construction', () => {
792-
expect(() => createProfiler()).not.toThrowError();
792+
expect(() => createProfiler()).not.toThrow();
793793

794794
expect(mockSubscribeProcessExit).toHaveBeenCalledWith({
795795
onError: expect.any(Function),

packages/utils/src/lib/profiler/profiler.int.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ describe('Profiler Integration', () => {
231231
profiler.measure('error-test', () => {
232232
throw error;
233233
});
234-
}).toThrowError(error);
234+
}).toThrow(error);
235235

236236
const measures = performance.getEntriesByType('measure');
237237
expect(measures).toStrictEqual(
@@ -258,7 +258,7 @@ describe('Profiler Integration', () => {
258258
profiler.measure('custom-error-test', () => {
259259
throw customError;
260260
});
261-
}).toThrowError(customError);
261+
}).toThrow(customError);
262262

263263
const measures = performance.getEntriesByType('measure');
264264
expect(measures).toStrictEqual(

packages/utils/src/lib/profiler/profiler.unit.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('Profiler', () => {
154154
tooltipText: 'Test marker',
155155
properties: [['key', 'value']],
156156
});
157-
}).not.toThrowError();
157+
}).not.toThrow();
158158

159159
const marks = performance.getEntriesByType('mark');
160160
expect(marks).toStrictEqual([
@@ -181,7 +181,7 @@ describe('Profiler', () => {
181181
profilerWithColor.marker('test-marker-default-color', {
182182
tooltipText: 'Test marker with default color',
183183
});
184-
}).not.toThrowError();
184+
}).not.toThrow();
185185

186186
const marks = performance.getEntriesByType('mark');
187187
expect(marks).toStrictEqual([
@@ -207,7 +207,7 @@ describe('Profiler', () => {
207207
tooltipText: 'Test marker without default color',
208208
properties: [['key', 'value']],
209209
});
210-
}).not.toThrowError();
210+
}).not.toThrow();
211211

212212
const marks = performance.getEntriesByType('mark');
213213
expect(marks).toStrictEqual([
@@ -233,7 +233,7 @@ describe('Profiler', () => {
233233
color: 'primary',
234234
tooltipText: 'This should not create a mark',
235235
});
236-
}).not.toThrowError();
236+
}).not.toThrow();
237237

238238
const marks = performance.getEntriesByType('mark');
239239
expect(marks).toHaveLength(0);
@@ -304,7 +304,7 @@ describe('Profiler', () => {
304304
throw error;
305305
});
306306

307-
expect(() => profiler.measure('test-event', workFn)).toThrowError(error);
307+
expect(() => profiler.measure('test-event', workFn)).toThrow(error);
308308
expect(workFn).toHaveBeenCalled();
309309
});
310310

@@ -314,7 +314,7 @@ describe('Profiler', () => {
314314
throw error;
315315
});
316316

317-
expect(() => profiler.measure('test-event', workFn)).toThrowError(error);
317+
expect(() => profiler.measure('test-event', workFn)).toThrow(error);
318318
expect(workFn).toHaveBeenCalled();
319319
});
320320

@@ -325,9 +325,9 @@ describe('Profiler', () => {
325325
throw error;
326326
});
327327

328-
expect(() =>
329-
enabledProfiler.measure('test-event-error', workFn),
330-
).toThrowError(error);
328+
expect(() => enabledProfiler.measure('test-event-error', workFn)).toThrow(
329+
error,
330+
);
331331
expect(workFn).toHaveBeenCalled();
332332

333333
// Verify that performance marks were created even though error occurred
@@ -424,7 +424,7 @@ describe('Profiler', () => {
424424

425425
await expect(
426426
profiler.measureAsync('test-async-event', workFn),
427-
).rejects.toThrowError(error);
427+
).rejects.toThrow(error);
428428
expect(workFn).toHaveBeenCalled();
429429
});
430430

@@ -438,7 +438,7 @@ describe('Profiler', () => {
438438

439439
await expect(
440440
enabledProfiler.measureAsync('test-async-event-error', workFn),
441-
).rejects.toThrowError(error);
441+
).rejects.toThrow(error);
442442
expect(workFn).toHaveBeenCalled();
443443

444444
// Verify that performance marks were created even though error occurred

packages/utils/src/lib/wal.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('createTolerantCodec', () => {
3434
throw new Error('decoding error');
3535
},
3636
});
37-
expect(() => c.encode(42)).toThrowError('encoding error');
37+
expect(() => c.encode(42)).toThrow('encoding error');
3838
const result = c.decode('42');
3939
expect(result).toEqual({ __invalid: true, raw: '42' });
4040
});
@@ -169,7 +169,7 @@ describe('WriteAheadLogFile', () => {
169169
w.open();
170170
expect(() =>
171171
w.append('{ id: 1, name:...' as unknown as object),
172-
).not.toThrowError();
172+
).not.toThrow();
173173
w.close();
174174
expect(w.recover().records).toStrictEqual([
175175
{ id: 1, name: 'test' },
@@ -187,7 +187,7 @@ describe('WriteAheadLogFile', () => {
187187
it('throws error when appending without opening', () => {
188188
const w = wal('/test/a.log');
189189
expect(w.isClosed()).toBeTrue();
190-
expect(() => w.append('a')).toThrowError('WAL not opened');
190+
expect(() => w.append('a')).toThrow('WAL not opened');
191191
});
192192

193193
it('opens and closes correctly', () => {
@@ -920,7 +920,7 @@ describe('ShardedWal', () => {
920920
vol.unlinkSync(
921921
'/shards/20231114-221320-000/test.20231114-221320-000.10001.2.1.log',
922922
);
923-
expect(() => sw.cleanup()).not.toThrowError();
923+
expect(() => sw.cleanup()).not.toThrow();
924924
});
925925

926926
it('should use custom options in finalizer', () => {

0 commit comments

Comments
 (0)