Skip to content

Commit e69c02d

Browse files
committed
fix(tests): update dev Jest to 30
toThrowError -> toThrow, toBeCalledTimes -> toHaveBeenCalledTimes
1 parent fe9c772 commit e69c02d

11 files changed

Lines changed: 1144 additions & 784 deletions

File tree

package-lock.json

Lines changed: 1072 additions & 712 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"devDependencies": {
4242
"@types/bindings": "^1.5.5",
43-
"@types/jest": "^29.5.13",
43+
"@types/jest": "^30.0.0",
4444
"@types/node": "^25.5.0",
4545
"@types/yargs": "^17.0.33",
4646
"@eslint/js": "^9.39.0",
@@ -55,7 +55,7 @@
5555
"typescript-eslint": "^8.57.2",
5656
"husky": "^9.1.7",
5757
"istanbul-lib-coverage": "^3.2.2",
58-
"jest": "^29.7.0",
58+
"jest": "^30.3.0",
5959
"lint-staged": "^16.4.0",
6060
"prettier": "^3.8.1",
6161
"rimraf": "^6.1.3",

packages/core/callbacks.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("callbacks", () => {
3232
registerBeforeEachCallback(callback);
3333
const callbacks = getCallbacks();
3434
callbacks.runBeforeEachCallbacks();
35-
expect(callback).toBeCalledTimes(3);
35+
expect(callback).toHaveBeenCalledTimes(3);
3636
});
3737

3838
it("executes registered afterEach callbacks", () => {
@@ -42,6 +42,6 @@ describe("callbacks", () => {
4242
registerAfterEachCallback(callback);
4343
const callbacks = getCallbacks();
4444
callbacks.runAfterEachCallbacks();
45-
expect(callback).toBeCalledTimes(3);
45+
expect(callback).toHaveBeenCalledTimes(3);
4646
});
4747
});

packages/instrumentor/plugins/functionHooks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ function expectLogHooks(
997997
hookType: string,
998998
hookName: string,
999999
) {
1000-
expect(mock).toBeCalledTimes(callsites);
1000+
expect(mock).toHaveBeenCalledTimes(callsites);
10011001
if (callsites > 0) {
10021002
const hookTp: string = mock.mock.calls[0][1];
10031003
expect(hookTp).toEqual(hookType);

packages/jest-runner/corpus.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe("Corpus", () => {
9595

9696
it("throw error if no package.json was found", () => {
9797
const fuzzTest = mockFuzzTest({ generatePackageJson: false });
98-
expect(() => new Corpus(fuzzTest, [])).toThrowError();
98+
expect(() => new Corpus(fuzzTest, [])).toThrow();
9999
});
100100
});
101101
});

packages/jest-runner/fuzz.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ describe("fuzz", () => {
179179
}),
180180
).rejects;
181181
await rejects.toThrow(FuzzerError);
182-
await rejects.toThrowError(new RegExp(".*async or done.*"));
182+
await rejects.toThrow(new RegExp(".*async or done.*"));
183183
});
184184

185185
// This test is disabled as it prints an additional error message to the console,

packages/jest-runner/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"istanbul-reports": "^3.1.7"
2222
},
2323
"peerDependencies": {
24-
"@types/jest": "29.*",
25-
"jest": "29.*"
24+
"@types/jest": ">=29.0.0",
25+
"jest": ">=29.0.0"
2626
},
2727
"devDependencies": {
2828
"@types/tmp": "^0.2.6",

tests/bug-detectors/prototype-pollution.test.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("Prototype Pollution", () => {
3434
.build();
3535
expect(() => {
3636
fuzzTest.execute();
37-
}).toThrowError(FuzzingExitCode);
37+
}).toThrow(FuzzingExitCode);
3838
expect(fuzzTest.stderr).toContain("Prototype Pollution");
3939
});
4040

@@ -47,7 +47,7 @@ describe("Prototype Pollution", () => {
4747
.build();
4848
expect(() => {
4949
fuzzTest.execute();
50-
}).toThrowError(FuzzingExitCode);
50+
}).toThrow(FuzzingExitCode);
5151
expect(fuzzTest.stderr).toContain("Prototype Pollution");
5252
});
5353

@@ -60,7 +60,7 @@ describe("Prototype Pollution", () => {
6060
.build();
6161
expect(() => {
6262
fuzzTest.execute();
63-
}).toThrowError(FuzzingExitCode);
63+
}).toThrow(FuzzingExitCode);
6464
expect(fuzzTest.stderr).toContain("Prototype Pollution");
6565
});
6666

@@ -73,7 +73,7 @@ describe("Prototype Pollution", () => {
7373
.build();
7474
expect(() => {
7575
fuzzTest.execute();
76-
}).toThrowError(FuzzingExitCode);
76+
}).toThrow(FuzzingExitCode);
7777
expect(fuzzTest.stderr).toContain(
7878
"Prototype Pollution\n Prototype of Function changed",
7979
);
@@ -88,7 +88,7 @@ describe("Prototype Pollution", () => {
8888
.build();
8989
expect(() => {
9090
fuzzTest.execute();
91-
}).toThrowError(FuzzingExitCode);
91+
}).toThrow(FuzzingExitCode);
9292
expect(fuzzTest.stderr).toContain(
9393
"Prototype Pollution\n Prototype of String changed",
9494
);
@@ -103,7 +103,7 @@ describe("Prototype Pollution", () => {
103103
.build();
104104
expect(() => {
105105
fuzzTest.execute();
106-
}).toThrowError(FuzzingExitCode);
106+
}).toThrow(FuzzingExitCode);
107107
expect(fuzzTest.stderr).toContain(
108108
"Prototype Pollution\n Prototype of Number changed",
109109
);
@@ -118,7 +118,7 @@ describe("Prototype Pollution", () => {
118118
.build();
119119
expect(() => {
120120
fuzzTest.execute();
121-
}).toThrowError(FuzzingExitCode);
121+
}).toThrow(FuzzingExitCode);
122122
expect(fuzzTest.stderr).toContain(
123123
"Prototype Pollution\n Prototype of Boolean changed",
124124
);
@@ -136,7 +136,7 @@ describe("Prototype Pollution", () => {
136136
.build();
137137
expect(() => {
138138
fuzzTest.execute();
139-
}).toThrowError(FuzzingExitCode);
139+
}).toThrow(FuzzingExitCode);
140140
expect(fuzzTest.stderr).toContain(
141141
"Prototype Pollution\n a.__proto__ value is ",
142142
);
@@ -154,7 +154,7 @@ describe("Prototype Pollution", () => {
154154
.build();
155155
expect(() => {
156156
fuzzTest.execute();
157-
}).toThrowError(FuzzingExitCode);
157+
}).toThrow(FuzzingExitCode);
158158
expect(fuzzTest.stderr).toContain("Prototype Pollution\n a.__proto__");
159159
});
160160

@@ -180,7 +180,7 @@ describe("Prototype Pollution", () => {
180180
.build();
181181
expect(() => {
182182
fuzzTest.execute();
183-
}).toThrowError(FuzzingExitCode);
183+
}).toThrow(FuzzingExitCode);
184184
expect(fuzzTest.stderr).toContain("Prototype Pollution");
185185
});
186186

@@ -206,7 +206,7 @@ describe("Prototype Pollution", () => {
206206
.build();
207207
expect(() => {
208208
fuzzTest.execute();
209-
}).toThrowError(FuzzingExitCode);
209+
}).toThrow(FuzzingExitCode);
210210
expect(fuzzTest.stderr).toContain("Prototype Pollution");
211211
});
212212

@@ -219,7 +219,7 @@ describe("Prototype Pollution", () => {
219219
.build();
220220
expect(() => {
221221
fuzzTest.execute();
222-
}).toThrowError(FuzzingExitCode);
222+
}).toThrow(FuzzingExitCode);
223223
expect(fuzzTest.stderr).toContain("Prototype Pollution");
224224
});
225225

@@ -235,7 +235,7 @@ describe("Prototype Pollution", () => {
235235
.build();
236236
expect(() => {
237237
fuzzTest.execute();
238-
}).toThrowError(FuzzingExitCode);
238+
}).toThrow(FuzzingExitCode);
239239
expect(fuzzTest.stderr).toContain("Prototype Pollution");
240240
});
241241

@@ -250,7 +250,7 @@ describe("Prototype Pollution", () => {
250250
.build();
251251
expect(() => {
252252
fuzzTest.execute();
253-
}).toThrowError(FuzzingExitCode);
253+
}).toThrow(FuzzingExitCode);
254254
expect(fuzzTest.stderr).toContain("Prototype Pollution");
255255
});
256256

@@ -265,7 +265,7 @@ describe("Prototype Pollution", () => {
265265
.build();
266266
expect(() => {
267267
fuzzTest.execute();
268-
}).toThrowError(FuzzingExitCode);
268+
}).toThrow(FuzzingExitCode);
269269
expect(fuzzTest.stderr).toContain("Prototype Pollution");
270270
});
271271

@@ -281,7 +281,7 @@ describe("Prototype Pollution", () => {
281281
.build();
282282
expect(() => {
283283
fuzzTest.execute();
284-
}).toThrowError(FuzzingExitCode);
284+
}).toThrow(FuzzingExitCode);
285285
expect(fuzzTest.stderr).toContain("Prototype Pollution");
286286
});
287287

@@ -297,7 +297,7 @@ describe("Prototype Pollution", () => {
297297
.build();
298298
expect(() => {
299299
fuzzTest.execute();
300-
}).toThrowError(FuzzingExitCode);
300+
}).toThrow(FuzzingExitCode);
301301
expect(fuzzTest.stderr).toContain("Prototype Pollution");
302302
});
303303

@@ -314,7 +314,7 @@ describe("Prototype Pollution", () => {
314314
// .build();
315315
// expect(() => {
316316
// fuzzTest.execute();
317-
// }).toThrowError(FuzzingExitCode);
317+
// }).toThrow(FuzzingExitCode);
318318
// expect(fuzzTest.stderr).toContain("Prototype Pollution");
319319
// });
320320
});
@@ -332,7 +332,7 @@ describe("Prototype Pollution Jest tests", () => {
332332
.build();
333333
expect(() => {
334334
fuzzTest.execute();
335-
}).toThrowError(JestRegressionExitCode);
335+
}).toThrow(JestRegressionExitCode);
336336
expect(fuzzTest.stderr).toContain(
337337
"Prototype Pollution\n Prototype of Object changed",
338338
);
@@ -351,7 +351,7 @@ describe("Prototype Pollution Jest tests", () => {
351351
.build();
352352
expect(() => {
353353
fuzzTest.execute();
354-
}).toThrowError(JestRegressionExitCode);
354+
}).toThrow(JestRegressionExitCode);
355355
expect(fuzzTest.stderr).toContain(
356356
"Prototype Pollution\n a.__proto__ value is",
357357
);
@@ -370,7 +370,7 @@ describe("Prototype Pollution Jest tests", () => {
370370
.build();
371371
expect(() => {
372372
fuzzTest.execute();
373-
}).toThrowError(JestRegressionExitCode);
373+
}).toThrow(JestRegressionExitCode);
374374
expect(fuzzTest.stderr).toContain(
375375
"Prototype Pollution\n a.__proto__ value is",
376376
);
@@ -387,7 +387,7 @@ describe("Prototype Pollution Jest tests", () => {
387387
.build();
388388
expect(() => {
389389
fuzzTest.execute();
390-
}).toThrowError(JestRegressionExitCode);
390+
}).toThrow(JestRegressionExitCode);
391391
expect(fuzzTest.stderr).toContain(
392392
"Prototype Pollution\n Prototype of Object changed",
393393
);

tests/bug-detectors/remote-code-execution.test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe("CLI", () => {
5252
.build();
5353
expect(() => {
5454
fuzzTest.execute();
55-
}).toThrowError(FuzzingExitCode);
55+
}).toThrow(FuzzingExitCode);
5656
expect(fuzzTest.stderr).toContain(findingMessage);
5757
});
5858

@@ -63,7 +63,7 @@ describe("CLI", () => {
6363
.build();
6464
expect(() => {
6565
fuzzTest.execute();
66-
}).toThrowError(FuzzingExitCode);
66+
}).toThrow(FuzzingExitCode);
6767
expect(fuzzTest.stderr).toContain(findingMessage);
6868
});
6969

@@ -74,7 +74,7 @@ describe("CLI", () => {
7474
.build();
7575
expect(() => {
7676
fuzzTest.execute();
77-
}).toThrowError(FuzzingExitCode);
77+
}).toThrow(FuzzingExitCode);
7878
expect(fuzzTest.stderr).toContain(findingMessage);
7979
});
8080

@@ -85,7 +85,7 @@ describe("CLI", () => {
8585
.build();
8686
expect(() => {
8787
fuzzTest.execute();
88-
}).toThrowError(FuzzingExitCode);
88+
}).toThrow(FuzzingExitCode);
8989
expect(fuzzTest.stderr).toContain(findingMessage);
9090
});
9191
});
@@ -116,7 +116,7 @@ describe("CLI", () => {
116116
.build();
117117
expect(() => {
118118
fuzzTest.execute();
119-
}).toThrowError(FuzzingExitCode);
119+
}).toThrow(FuzzingExitCode);
120120
expect(fuzzTest.stderr).toContain(findingMessage);
121121
});
122122

@@ -127,7 +127,7 @@ describe("CLI", () => {
127127
.build();
128128
expect(() => {
129129
fuzzTest.execute();
130-
}).toThrowError(FuzzingExitCode);
130+
}).toThrow(FuzzingExitCode);
131131
expect(fuzzTest.stderr).toContain(findingMessage);
132132
});
133133

@@ -147,7 +147,7 @@ describe("CLI", () => {
147147
.build();
148148
expect(() => {
149149
fuzzTest.execute();
150-
}).toThrowError(FuzzingExitCode);
150+
}).toThrow(FuzzingExitCode);
151151
expect(fuzzTest.stderr).toContain(findingMessage);
152152
});
153153

@@ -172,7 +172,7 @@ describe("Jest", () => {
172172
.build();
173173
expect(() => {
174174
fuzzTest.execute();
175-
}).toThrowError(JestRegressionExitCode);
175+
}).toThrow(JestRegressionExitCode);
176176
expect(fuzzTest.stderr).toContain(findingMessage);
177177
});
178178

@@ -184,7 +184,7 @@ describe("Jest", () => {
184184
.build();
185185
expect(() => {
186186
fuzzTest.execute();
187-
}).toThrowError(JestRegressionExitCode);
187+
}).toThrow(JestRegressionExitCode);
188188
expect(fuzzTest.stderr).toContain(findingMessage);
189189
});
190190

@@ -196,7 +196,7 @@ describe("Jest", () => {
196196
.build();
197197
expect(() => {
198198
fuzzTest.execute();
199-
}).toThrowError(JestRegressionExitCode);
199+
}).toThrow(JestRegressionExitCode);
200200
expect(fuzzTest.stderr).toContain(findingMessage);
201201
});
202202

@@ -209,7 +209,7 @@ describe("Jest", () => {
209209
.build();
210210
expect(() => {
211211
fuzzTest.execute();
212-
}).toThrowError(JestRegressionExitCode);
212+
}).toThrow(JestRegressionExitCode);
213213
expect(fuzzTest.stderr).toContain(findingMessage);
214214
});
215215

@@ -253,7 +253,7 @@ describe("Jest", () => {
253253
.build();
254254
expect(() => {
255255
fuzzTest.execute();
256-
}).toThrowError(JestRegressionExitCode);
256+
}).toThrow(JestRegressionExitCode);
257257
expect(fuzzTest.stderr).toContain(findingMessage);
258258
});
259259

@@ -265,7 +265,7 @@ describe("Jest", () => {
265265
.build();
266266
expect(() => {
267267
fuzzTest.execute();
268-
}).toThrowError(JestRegressionExitCode);
268+
}).toThrow(JestRegressionExitCode);
269269
expect(fuzzTest.stderr).toContain(findingMessage);
270270
});
271271

@@ -287,7 +287,7 @@ describe("Jest", () => {
287287
.build();
288288
expect(() => {
289289
fuzzTest.execute();
290-
}).toThrowError(JestRegressionExitCode);
290+
}).toThrow(JestRegressionExitCode);
291291
expect(fuzzTest.stderr).toContain(findingMessage);
292292
});
293293

0 commit comments

Comments
 (0)