@catalystiq/test-kit
v0.6.0
Published
Shared test setup for Vitest, a fake MCP Apps host for jsdom and Playwright, the local Neon test-database run, the local environment guard, the database endpoint reader and the install hardening check.
Readme
@catalystiq/test-kit
Shared test helpers: one package, added to part by part. Pin an exact version ("@catalystiq/test-kit": "0.6.0");
Dependabot raises it.
| Part | Import | What |
|---|---|---|
| Setup | @catalystiq/test-kit/setup/config, /setup, /setup/dom | Vitest defaults and the safety setup: credentials stripped, network blocked, production and .env* databases refused, React warnings fail the test. (dist/setup/README.md in the package) |
| Environment guard | tk-dev-guard, tk-check-env-example, @catalystiq/test-kit/env | A predev guard that refuses a production database and lists unset required variables, and a check that .env.example lists what the code reads. (dist/env/README.md in the package) |
| Database endpoint reader | @catalystiq/test-kit/neon-endpoint | Which database a connection string addresses, read as the clients resolve its host (percent-decoded, IDNA-mapped): a dependency-free module an app also imports at build and boot, fed with its own production and allowed endpoint ids. The two guards above keep their own reading (src/setup/database.ts). (dist/neon-endpoint/README.md in the package) |
| Install hardening check | tk-check-install-scripts, @catalystiq/test-kit/install | package.json allowScripts against the lockfile, .npmrc's min-release-age and strict-allow-scripts, the lockfile's pins and the npm floor, saying precisely what is wrong. (dist/install/README.md in the package) |
| Neon test database | tk-neon-test-db (bin), @catalystiq/test-kit/neon-test-db | npm run test:db: a short-lived schema-only Neon branch for one command, deleted afterwards; moved from github-actions' vendored scripts/neon-test-db.mjs. (dist/neon-test-db/README.md in the package) |
| MCP Apps host | @catalystiq/test-kit/mcp-apps-host, /mcp-apps-host/playwright | A fake ChatGPT or Claude host for an MCP Apps card, in jsdom and in Playwright, and tk-check-bundle. (dist/mcp-apps-host/README.md in the package) |
Vitest 4.1 or 5 and Node 22.18 or later. Every peer dependency is optional; install what the parts you use need (vitest,
@playwright/test, @testing-library/react, @testing-library/jest-dom; typescript for tk-check-env-example).
Developing
npm test runs the unit suite and the rule proofs: each rule is shown working, then cut out of a copy of src and shown
failing (test/support/run-fixture.ts). npm run test:browser runs the Playwright host and its rule proofs (Chromium).
npm run typecheck, npm run lint, npm run build.
Releasing
Raise the version in a pull request (npm version <x> --no-git-tag-version, which also updates package-lock.json)
and the pin above. After it merges, publish a GitHub release tagged v<version>;
.github/workflows/publish.yml checks the tag matches, runs typecheck, lint, the unit suite (one Node version) and the
package smoke check, not the browser lane, and publishes to npm through npm's trusted publishing (OIDC), so no npm
token is needed. npmjs.com's settings for the package name this repository, publish.yml and the GitHub environment
npm (which admits main and v* tags only) as its trusted publisher, so renaming the workflow file or the
environment breaks publishing until that entry is recreated.
