diff --git a/apps/blade/package.json b/apps/blade/package.json index b563d8adc..5d96bcc78 100644 --- a/apps/blade/package.json +++ b/apps/blade/package.json @@ -15,8 +15,8 @@ "with-env": "dotenv -e ../../.env --", "analyze:react": "tsx ../../scripts/analyze-react.ts src", "analyze:react:changed": "tsx ../../scripts/analyze-react-changed.ts", - "test": "pnpm with-env vitest run --passWithNoTests", - "test:watch": "pnpm with-env vitest --passWithNoTests", + "test": "NODE_ENV=test pnpm with-env vitest run --passWithNoTests", + "test:watch": "NODE_ENV=test pnpm with-env vitest --passWithNoTests", "e2e": "BLADE_E2E_AUTH=true NEXT_PUBLIC_BLADE_E2E_AUTH=true BLADE_E2E_DEFAULT_USER_ID=00000000-0000-4000-8000-000000000101 pnpm with-env playwright test --pass-with-no-tests" }, "dependencies": { diff --git a/apps/blade/src/tests/events/event-detail-dialog.test.tsx b/apps/blade/src/tests/events/event-detail-dialog.test.tsx index 502665f42..1bddb84a2 100644 --- a/apps/blade/src/tests/events/event-detail-dialog.test.tsx +++ b/apps/blade/src/tests/events/event-detail-dialog.test.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from "react"; import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; -import { describe, expect, it, vi } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { EventDetailDialog } from "~/app/_components/admin/events/event-detail-dialog"; @@ -83,6 +83,13 @@ const detail = { }; describe("EventDetailDialog", () => { + beforeEach(() => { + vi.useFakeTimers(); + vi.setSystemTime(new Date("2026-08-12T23:00:00.000Z")); + }); + + afterEach(() => vi.useRealTimers()); + it("TC-007 TC-023 renders one sectioned read-only hierarchy", () => { const html = renderToStaticMarkup( createElement(EventDetailDialog, { diff --git a/lefthook.yml b/lefthook.yml index c593c47f3..0d9ab257c 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,29 +1,31 @@ # Local quality gates. # -# These hooks mirror the CI jobs so contributors catch failures before pushing. +# Keep commit-time work quick and limited to staged files. Broader validation +# remains available through the package scripts and CI rather than a push hook. # -# The split matters: a pre-commit hook that runs the whole gate gets slow, people -# learn `--no-verify`, and the hook becomes decoration. Commit-time work is -# formatting only and touches staged files; the real gate runs once per push. -# -# Escape hatches: `git commit --no-verify`, or `LEFTHOOK=0 git push` to skip -# everything. Use them when you mean to, not by habit. +# Escape hatch: `git commit --no-verify`. Use it when you mean to, not by habit. pre-commit: - parallel: true + parallel: false jobs: - name: format staged files - glob: "*.{ts,tsx,js,jsx,cjs,mjs,json,md,css,yml,yaml}" - run: npx prettier --write {staged_files} + glob: "*.{ts,tsx,js,jsx,cjs,mjs,json,md,css,yml,yaml,md}" + run: pnpm exec prettier --write "{staged_files}" stage_fixed: true -pre-push: - parallel: false - jobs: - # The same commands as CI's format, lint, and typecheck jobs. - - name: verify - run: pnpm verify:push + - name: lint staged files + glob: "*.{ts,tsx,js,jsx,cjs,mjs}" + run: pnpm exec eslint "{staged_files}" + + - name: typecheck staged files + glob: "*.{ts,tsx,cts,mts}" + run: | + filters=$( + git diff --cached --name-only --diff-filter=ACMRD | + sed -nE 's#^((apps|packages|tooling)/[^/]+)/.*#--filter=./\1#p' | + sort -u + ) - # CI runs this as its own job; keep the local push gate aligned with it. - - name: test - run: pnpm test + if [ -n "$filters" ]; then + pnpm exec turbo run typecheck $filters + fi diff --git a/packages/api/package.json b/packages/api/package.json index ce24c8490..9439debb6 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -38,8 +38,8 @@ "format": "prettier --check . --ignore-path ../../.gitignore", "lint": "eslint", "typecheck": "tsc --noEmit --emitDeclarationOnly false", - "test": "pnpm with-env vitest run --passWithNoTests", - "test:watch": "pnpm with-env vitest --passWithNoTests", + "test": "NODE_ENV=test pnpm with-env vitest run --passWithNoTests", + "test:watch": "NODE_ENV=test pnpm with-env vitest --passWithNoTests", "with-env": "dotenv -e ../../.env --" }, "dependencies": { diff --git a/packages/db/package.json b/packages/db/package.json index 9425f7d47..606206ed3 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -38,8 +38,8 @@ "studio": "pnpm with-env drizzle-kit studio", "typecheck": "tsc --noEmit --emitDeclarationOnly false", "with-env": "dotenv -e ../../.env --", - "test": "pnpm with-env vitest run --passWithNoTests", - "test:watch": "pnpm with-env vitest --passWithNoTests" + "test": "NODE_ENV=test pnpm with-env vitest run --passWithNoTests", + "test:watch": "NODE_ENV=test pnpm with-env vitest --passWithNoTests" }, "dependencies": { "@forge/consts": "workspace:*",