tsx runs tests without type checking and tsconfig.json covers only src, so 71 type errors had accumulated unnoticed. tsconfig.tests.json now checks every test and helper, and npm run typecheck includes it. Fixtures gain the fields the DTOs have grown since they were written (manualQuantity, circuit apparent power/cos phi, downstream board loads, section totals, building, cover and board info fields). Repository lookups that return "row ?? null" now declare the null in their type, which their callers already handle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 lines
474 B
TypeScript
11 lines
474 B
TypeScript
import path from "node:path";
|
|
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
|
|
import type { AppDatabase } from "../../src/db/database-context.js";
|
|
|
|
/**
|
|
* Applies all migrations. ES-module tests (tests/security) use this helper so
|
|
* the migrator resolves the same Drizzle declarations as the application.
|
|
*/
|
|
export function migrateDatabase(database: AppDatabase): void {
|
|
migrate(database, { migrationsFolder: path.resolve("src", "db", "migrations") });
|
|
}
|