mirror of
https://github.com/stackrender/stackrender.git
synced 2026-09-10 11:15:42 +00:00
d0cd2d8fa4
Introduce automated testing to a project that had no test runner, no test script and no CI. Vitest fits the existing Vite setup with near-zero config; a standalone vitest.config.ts wires the @/ alias via vite-tsconfig-paths and runs in the node environment, avoiding the app's Tailwind/React/WASM plugins that pure-logic tests do not need. Cover the cheapest, highest-value surface first: pure helpers with no DOM, WASM or database. getNextSequence and cloneField (field.ts), the charset/collation and SQLite integer-column reordering plus enum naming (render-uttils.ts), and orderTables including the CircularDependencyError cycle path that backs the Foreign Key Cycle Detection feature. The build's tsc step is unaffected (plain tsc no-ops on the root config) and the new files typecheck clean under strict and lint clean.
14 lines
472 B
TypeScript
14 lines
472 B
TypeScript
import { defineConfig } from "vitest/config";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
// Standalone test config: the app's vite.config.ts pulls in Tailwind, React and
|
|
// WASM/worker plugins that pure-logic tests do not need. We only need the `@/`
|
|
// alias to resolve, which vite-tsconfig-paths provides from tsconfig.json.
|
|
export default defineConfig({
|
|
plugins: [tsconfigPaths()],
|
|
test: {
|
|
environment: "node",
|
|
include: ["src/**/*.test.ts"],
|
|
},
|
|
});
|