Skip to content

Commit 9c71143

Browse files
authored
chore: upgrade to vite8 (@Miodec) (#7647)
1 parent 49589c4 commit 9c71143

23 files changed

Lines changed: 1133 additions & 493 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,5 @@ frontend/static/webfonts-preview
131131

132132
.turbo
133133
frontend/.env.sentry-build-plugin
134-
.claude/worktrees
134+
.claude/worktrees
135+
1024MiB

backend/__tests__/__integration__/dal/preset.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe("PresetDal", () => {
6969
//WHEN / THEN
7070
await expect(() =>
7171
PresetDal.addPreset(uid, { name: "max", config: {} }),
72-
).rejects.toThrowError("Too many presets");
72+
).rejects.toThrow("Too many presets");
7373
});
7474
it("should add preset", async () => {
7575
//GIVEN
@@ -358,7 +358,7 @@ describe("PresetDal", () => {
358358
const uid = new ObjectId().toHexString();
359359
await expect(() =>
360360
PresetDal.removePreset(uid, new ObjectId().toHexString()),
361-
).rejects.toThrowError("Preset not found");
361+
).rejects.toThrow("Preset not found");
362362
});
363363
it("should remove", async () => {
364364
//GIVEN
@@ -421,7 +421,7 @@ describe("PresetDal", () => {
421421
//WHEN
422422
await expect(() =>
423423
PresetDal.removePreset(decoyUid, first),
424-
).rejects.toThrowError("Preset not found");
424+
).rejects.toThrow("Preset not found");
425425

426426
//THEN
427427
const read = await PresetDal.getPresets(uid);

backend/__tests__/__integration__/dal/user.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ describe("UserDal", () => {
11751175
it("should throw for unknown user", async () => {
11761176
await expect(async () =>
11771177
UserDAL.getPartialUser("1234", "stack", []),
1178-
).rejects.toThrowError("User not found\nStack: stack");
1178+
).rejects.toThrow("User not found\nStack: stack");
11791179
});
11801180

11811181
it("should get streak", async () => {
@@ -1228,7 +1228,7 @@ describe("UserDal", () => {
12281228
it("throws for nonexisting user", async () => {
12291229
await expect(async () =>
12301230
UserDAL.updateEmail("unknown", "test@example.com"),
1231-
).rejects.toThrowError("User not found\nStack: update email");
1231+
).rejects.toThrow("User not found\nStack: update email");
12321232
});
12331233
it("should update", async () => {
12341234
//given
@@ -1244,7 +1244,7 @@ describe("UserDal", () => {
12441244
});
12451245
describe("resetPb", () => {
12461246
it("throws for nonexisting user", async () => {
1247-
await expect(async () => UserDAL.resetPb("unknown")).rejects.toThrowError(
1247+
await expect(async () => UserDAL.resetPb("unknown")).rejects.toThrow(
12481248
"User not found\nStack: reset pb",
12491249
);
12501250
});
@@ -1272,7 +1272,7 @@ describe("UserDal", () => {
12721272
it("throws for nonexisting user", async () => {
12731273
await expect(async () =>
12741274
UserDAL.linkDiscord("unknown", "", ""),
1275-
).rejects.toThrowError("User not found\nStack: link discord");
1275+
).rejects.toThrow("User not found\nStack: link discord");
12761276
});
12771277
it("should update", async () => {
12781278
//given
@@ -1308,7 +1308,7 @@ describe("UserDal", () => {
13081308
it("throws for nonexisting user", async () => {
13091309
await expect(async () =>
13101310
UserDAL.unlinkDiscord("unknown"),
1311-
).rejects.toThrowError("User not found\nStack: unlink discord");
1311+
).rejects.toThrow("User not found\nStack: unlink discord");
13121312
});
13131313
it("should update", async () => {
13141314
//given

backend/__tests__/api/controllers/admin.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ describe("AdminController", () => {
323323
data: null,
324324
});
325325

326-
expect(addToInboxMock).toBeCalledTimes(2);
326+
expect(addToInboxMock).toHaveBeenCalledTimes(2);
327327
expect(deleteReportsMock).toHaveBeenCalledWith(["1", "2"]);
328328
});
329329
it("should fail wihtout mandatory properties", async () => {

backend/__tests__/api/controllers/user.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ describe("user controller test", () => {
18141814
//THEN
18151815
expect(result.body.message).toEqual("The Discord account is blocked");
18161816

1817-
expect(blocklistContainsMock).toBeCalledWith({
1817+
expect(blocklistContainsMock).toHaveBeenCalledWith({
18181818
discordId: "discordUserId",
18191819
});
18201820
});

backend/__tests__/middlewares/auth.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe("middlewares/auth", () => {
154154
{ headers: { authorization: "ApeKey aWQua2V5" } },
155155
{ acceptApeKeys: false },
156156
),
157-
).rejects.toThrowError("This endpoint does not accept ApeKeys");
157+
).rejects.toThrow("This endpoint does not accept ApeKeys");
158158

159159
//THEN
160160
});
@@ -170,7 +170,7 @@ describe("middlewares/auth", () => {
170170
{ headers: { authorization: "ApeKey aWQua2V5" } },
171171
{ acceptApeKeys: false },
172172
),
173-
).rejects.toThrowError("ApeKeys are not being accepted at this time");
173+
).rejects.toThrow("ApeKeys are not being accepted at this time");
174174

175175
//THEN
176176
});
@@ -253,7 +253,7 @@ describe("middlewares/auth", () => {
253253
);
254254
});
255255
it("should fail without authentication", async () => {
256-
await expect(() => authenticate({ headers: {} })).rejects.toThrowError(
256+
await expect(() => authenticate({ headers: {} })).rejects.toThrow(
257257
"Unauthorized\nStack: endpoint: /api/v1 no authorization header found",
258258
);
259259

@@ -269,7 +269,7 @@ describe("middlewares/auth", () => {
269269
it("should fail with empty authentication", async () => {
270270
await expect(() =>
271271
authenticate({ headers: { authorization: "" } }),
272-
).rejects.toThrowError(
272+
).rejects.toThrow(
273273
"Unauthorized\nStack: endpoint: /api/v1 no authorization header found",
274274
);
275275

@@ -285,7 +285,7 @@ describe("middlewares/auth", () => {
285285
it("should fail with missing authentication token", async () => {
286286
await expect(() =>
287287
authenticate({ headers: { authorization: "Bearer" } }),
288-
).rejects.toThrowError(
288+
).rejects.toThrow(
289289
"Missing authentication token\nStack: authenticateWithAuthHeader",
290290
);
291291

@@ -301,7 +301,7 @@ describe("middlewares/auth", () => {
301301
it("should fail with unknown authentication scheme", async () => {
302302
await expect(() =>
303303
authenticate({ headers: { authorization: "unknown format" } }),
304-
).rejects.toThrowError(
304+
).rejects.toThrow(
305305
'Unknown authentication scheme\nStack: The authentication scheme "unknown" is not implemented',
306306
);
307307

@@ -417,7 +417,7 @@ describe("middlewares/auth", () => {
417417
//THEN
418418
await expect(() =>
419419
authenticate({ headers: {} }, { isPublicOnDev: true }),
420-
).rejects.toThrowError("Unauthorized");
420+
).rejects.toThrow("Unauthorized");
421421
});
422422
it("should allow with apeKey on dev public endpoint in production", async () => {
423423
//WHEN
@@ -476,7 +476,7 @@ describe("middlewares/auth", () => {
476476
},
477477
{ isGithubWebhook: true },
478478
),
479-
).rejects.toThrowError("Github webhook signature invalid");
479+
).rejects.toThrow("Github webhook signature invalid");
480480

481481
//THEH
482482
expect(prometheusIncrementAuthMock).not.toHaveBeenCalled();
@@ -497,7 +497,7 @@ describe("middlewares/auth", () => {
497497
},
498498
{ isGithubWebhook: true },
499499
),
500-
).rejects.toThrowError("Missing Github signature header");
500+
).rejects.toThrow("Missing Github signature header");
501501

502502
//THEH
503503
expect(prometheusIncrementAuthMock).not.toHaveBeenCalled();
@@ -518,7 +518,7 @@ describe("middlewares/auth", () => {
518518
},
519519
{ isGithubWebhook: true },
520520
),
521-
).rejects.toThrowError("Missing Github Webhook Secret");
521+
).rejects.toThrow("Missing Github Webhook Secret");
522522

523523
//THEH
524524
expect(prometheusIncrementAuthMock).not.toHaveBeenCalled();
@@ -542,7 +542,7 @@ describe("middlewares/auth", () => {
542542
},
543543
{ isGithubWebhook: true },
544544
),
545-
).rejects.toThrowError(
545+
).rejects.toThrow(
546546
"Failed to authenticate Github webhook: could not validate",
547547
);
548548

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"testcontainers": "11.11.0",
8888
"tsx": "4.21.0",
8989
"typescript": "6.0.0-beta",
90-
"vitest": "4.0.15"
90+
"vitest": "4.1.0"
9191
},
9292
"engines": {
9393
"node": ">=24.0.0 <25"

frontend/__tests__/elements/test-activity-calendar.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ describe("test-activity-calendar.ts", () => {
11501150
);
11511151

11521152
//WHEN
1153-
expect(() => calendar.increment(getDate("2024-04-09"))).toThrowError(
1153+
expect(() => calendar.increment(getDate("2024-04-09"))).toThrow(
11541154
new Error("cannot alter data in the past."),
11551155
);
11561156
});

frontend/__tests__/root/config.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ describe("Config", () => {
7373
it("should throw if config key in not found in metadata", () => {
7474
expect(() => {
7575
Config.setConfig("nonExistentKey" as ConfigKey, true);
76-
}).toThrowError(
77-
`Config metadata for key "nonExistentKey" is not defined.`,
78-
);
76+
}).toThrow(`Config metadata for key "nonExistentKey" is not defined.`);
7977
});
8078

8179
it("fails if test is active and funbox no_quit", () => {

frontend/__tests__/utils/sanitize.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe("sanitize function", () => {
3333
);
3434

3535
if (expected.numbers === false) {
36-
sanitized.toThrowError();
36+
sanitized.toThrow();
3737
} else if (expected.numbers === true) {
3838
sanitized.toStrictEqual(input);
3939
} else {
@@ -50,7 +50,7 @@ describe("sanitize function", () => {
5050
);
5151

5252
if (expected.numbersMin === false) {
53-
sanitized.toThrowError();
53+
sanitized.toThrow();
5454
} else if (expected.numbersMin === true) {
5555
sanitized.toStrictEqual(input);
5656
} else {
@@ -173,7 +173,7 @@ describe("sanitize function", () => {
173173
);
174174

175175
if (expected.mandatory === false) {
176-
sanitized.toThrowError();
176+
sanitized.toThrow();
177177
} else if (expected.mandatory === true) {
178178
sanitized.toStrictEqual(input);
179179
} else {
@@ -190,7 +190,7 @@ describe("sanitize function", () => {
190190
);
191191

192192
if (expected.partial === false) {
193-
sanitized.toThrowError();
193+
sanitized.toThrow();
194194
} else if (expected.partial === true) {
195195
sanitized.toStrictEqual(input);
196196
} else {
@@ -206,7 +206,7 @@ describe("sanitize function", () => {
206206
);
207207

208208
if (expected.optional === false) {
209-
sanitized.toThrowError();
209+
sanitized.toThrow();
210210
} else if (expected.optional === true) {
211211
sanitized.toStrictEqual(input);
212212
} else {
@@ -300,7 +300,7 @@ describe("sanitize function", () => {
300300
);
301301

302302
if (expected.mandatory === false) {
303-
sanitized.toThrowError();
303+
sanitized.toThrow();
304304
} else if (expected.mandatory === true) {
305305
sanitized.toStrictEqual(input);
306306
} else {
@@ -315,7 +315,7 @@ describe("sanitize function", () => {
315315
);
316316

317317
if (expected.partial === false) {
318-
sanitized.toThrowError();
318+
sanitized.toThrow();
319319
} else if (expected.partial === true) {
320320
sanitized.toStrictEqual(input);
321321
} else {
@@ -332,7 +332,7 @@ describe("sanitize function", () => {
332332
);
333333

334334
if (expected.minArray === false) {
335-
sanitized.toThrowError();
335+
sanitized.toThrow();
336336
} else if (expected.minArray === true) {
337337
sanitized.toStrictEqual(input);
338338
} else {
@@ -377,7 +377,7 @@ describe("sanitize function", () => {
377377
} as any;
378378
expect(() => {
379379
sanitize(schema.required().strip(), obj);
380-
}).toThrowError(
380+
}).toThrow(
381381
"unable to sanitize: name: Required, age: Required, tags: Required, enumArray: Required",
382382
);
383383
});

0 commit comments

Comments
 (0)