Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh
# Check the message against Conventional Commits (ADR 31). Enable: git config core.hooksPath .githooks
# A merge commit is skipped, as in CI: its message is git's "Merge branch …".
git rev-parse -q --verify MERGE_HEAD > /dev/null && exit 0
exec node scripts/check-commits.ts --file "$1"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint": "biome ci .",
"format": "biome check --write .",
"typecheck": "tsc -p tsconfig.json && pnpm -r typecheck",
"test": "vitest run",
"test": "vitest run --project unit && vitest run --project perf",
"test:bun": "bun test ./fixtures ./packages/engine ./packages/shared ./packages/web ./scripts",
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm test:mod && pnpm layers && pnpm scan && pnpm egress && pnpm supply-chain",
"layers": "node scripts/check-layers.ts",
Expand Down
5 changes: 2 additions & 3 deletions packages/engine/test/providers/anthropic/estimate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ describe("imageSize", () => {
});

test("reads only the header bytes: a huge image decodes no more than its first 64 KB", () => {
const huge = PNG_96x64 + "A".repeat(20_000_000);
const start = performance.now();
// Not valid base64 after the first 64 KB: an image read whole would not decode. No clock, so no flake on CI.
const huge = `${PNG_96x64}${"A".repeat(200_000)}!!!!`;
expect(imageSize(huge)).toEqual({ width: 96, height: 64 });
expect(performance.now() - start).toBeLessThan(50);
});

test("returns undefined for data that is not a known image format", () => {
Expand Down
19 changes: 17 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import { configDefaults, defineConfig } from "vitest/config";

// Load tests measure time, and take most of the CPU while they run. Beside the unit tests they made unit tests
// pass vitest's 5 s timeout on slow CI runners, and their own numbers noisy. So `pnpm test` runs `unit` (files in
// parallel) and then `perf` (one file at a time, nothing beside it).
const PERF = [
"packages/engine/test/query/performance.test.ts",
"packages/engine/test/ingest/performance.test.ts",
"packages/engine/test/api/latency.test.ts",
];

export default defineConfig({
// The mod's tests import claude-code/testing and run under `claude plugin test` (pnpm test:mod).
test: { exclude: [...configDefaults.exclude, "packages/mod/**"] },
test: {
// The mod's tests import claude-code/testing and run under `claude plugin test` (pnpm test:mod).
exclude: [...configDefaults.exclude, "packages/mod/**"],
projects: [
{ extends: true, test: { name: "unit", exclude: PERF } },
{ extends: true, test: { name: "perf", include: PERF, fileParallelism: false } },
],
},
});
Loading