Skip to content

Commit

Permalink
🧴 Remove dynamic import, lower global test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdodo committed Dec 17, 2024
1 parent fdff20b commit b1d3230
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"scripts": {
"build": "tsc --noEmit && vitest run --sequence.concurrent --testTimeout 160 && biome ci --organize-imports-enabled=false"
"build": "tsc --noEmit && vitest run --testTimeout 50 && biome ci --organize-imports-enabled=false"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
Expand Down
8 changes: 1 addition & 7 deletions core/utils/validate-client-message.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import type { ClientMessage } from "../types/client-message.js";
import { clientMessageSchema } from "../types/client-message.js";

const waitJsonSchemaLibrary = import("json-schema-library");
import { Draft07 } from "json-schema-library";

export async function validateClientMessage(
message: ClientMessage,
): Promise<[boolean, string]> {
const jsonSchemaLibrary = await waitJsonSchemaLibrary;

const Draft07 =
jsonSchemaLibrary.Draft07 || jsonSchemaLibrary.default.Draft07;

const errors = new Draft07(clientMessageSchema).validate(message);
return [!errors.length, JSON.stringify(errors, null, 2)];
}
2 changes: 1 addition & 1 deletion core/workflows/matchmake.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ test("Should not start a game with 1 player", async () => {
}, 1);
}),
).rejects.toThrow("Good error");
}, 1000);
});

0 comments on commit b1d3230

Please sign in to comment.