Files
TREK/server/vitest.pg.config.ts
T
Maurice fd1942afab ci(test): restructure test.yml for a ten-minute ci-ok
Rename the workflow to CI and name every job "<Area> <what>[ i/n]" with
ids in kebab-case, in area order. Fold i18n parity, shared coverage and
the plugin SDK into Shared tests, split the client gates into Client
types and Client checks (with the bundle), and merge the image and chart
jobs into Docker and Helm with per-area step conditions. Server and
client tests run in ten slices, the Postgres lane in three per major,
and e2e in two slices inside the digest-pinned Playwright container.

A local setup action restores node_modules and shared/dist from exact
cache keys and falls back to npm ci and the shared build. The
node_modules key covers the lockfile and every workspace package.json,
so npm ci still refuses a package.json out of step with the lockfile.
Only pushes to dev and main save, the npm download cache included, and
only a full install saves that one. The plugin SDK installs and runs
before the root install so it resolves only its own dependencies.
Timeouts drop to 15/10/5 minutes. The workflow tests now check the name
form, the Playwright tag against the lockfile, scan's needs, timeouts,
the cache keys and saves, and that installs go through the setup action;
.github/actions/ counts like test.yml in changed-areas.
2026-11-18 14:48:43 +01:00

38 lines
1.7 KiB
TypeScript

import { postgresLane } from './tests/postgres/lane';
import base from './vitest.config';
import { defineConfig } from 'vitest/config';
/**
* The Postgres lane (`npm run test:pg`): every suite that boots the app on the
* real database module, each file on a database of its own copied from one
* migrated template, plus the Postgres-only suites under tests/postgres/.
* TREK_TEST_DB_URL names a database the lane may create and drop databases
* from (`postgres://…/postgres`); without it the lane fails.
*
* The suites are not listed here: tests/postgres/lane.ts finds them by what
* they import, and names the few that stay on SQLite by design with their
* reason. tests/unit/postgres-lane.test.ts, in the SQLite lane, fails when a
* suite boots the app some way the discovery does not see, when an exclusion
* goes stale, or when a new suite boots the app over the SQLite snapshot mock
* instead of the real database module.
*
* CI runs the lane once per supported Postgres major (the server-postgres job
* in test.yml), each in three slices (`--shard=i/3`) like the SQLite suite;
* every slice builds its own template in global setup. The slice count lives
* in the workflow only.
*/
export default defineConfig({
...base,
test: {
...base.test,
include: postgresLane(),
exclude: [],
globalSetup: ['tests/postgres/global-setup.ts'],
setupFiles: [...(base.test?.setupFiles as string[]), 'tests/postgres/setup.ts'],
// Every file boots the app on a database of its own; the lane is about
// the engine, so coverage stays the SQLite lane's measure.
coverage: { ...base.test?.coverage, enabled: false, thresholds: undefined },
},
});