Writing integration tests in the Nextly monorepo
SkillDatabases & dataUse when writing or debugging Nextly integration tests (*.integration.test.ts), when integration tests fail with self-import or connection errors, or when adding database-backed test coverage for a new feature.
Use Writing integration tests in the Nextly monorepo in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Writing integration tests in the Nextly monorepo and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Writing integration tests in the Nextly monorepo skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by nextlyhq/nextly in .claude/skills/writing-integration-tests/SKILL.md and read by Ahel’s review.
The rules that prevent 90% of the pain
- Build first, always. Integration tests import built package output.
Run from the repo ROOT (
pnpm test:integration...) so turbo builds dependencies; a directpnpm --filter nextly test:integrationon an unbuilt tree fails 60+ files with self-import errors that look real. - Dialect URLs decide what runs. Tests self-skip when the dialect's URL
is unset:
TEST_POSTGRES_URL,TEST_MYSQL_URL(SQLite falls back to in-memory). The root scripts wire the standard local ports:pnpm test:integration:postgres17-> localhost:5435pnpm test:integration:postgres15-> localhost:5434pnpm test:integration:mysql-> localhost:3307pnpm test:integration:sqlite-> no URL neededpnpm docker:testdoes NOT start them — it probes the DEV stack'spostgresservice and exits 1 when that is down. Start them the way therunning-builds-and-testsskill documents:docker startby container name when they already exist,docker compose -f docker-compose.test.yml up -don a fresh clone. NEVER point a TEST_* URL at a database you did not create for the run.
- Isolation is per-file prefixes, not parallelism. Use the canonical
helper (
packages/nextly/src/database/__tests__/integration/helpers/test-db.ts) which generates a random per-file table/schema prefix. In packages/nextly the integration config runs files sequentially (fileParallelism: false, single fork) because system-table suites share fixed table names likenextly_schema_events. Do not re-enable parallelism to make runs faster. - System tables come from production DDL. If a suite needs a Nextly
system table, create it with the production helper (for example
getSchemaEventsDdl(dialect)), never a hand-copied CREATE TABLE. Copies drift; there is a parity test that will catch you.
Writing a new suite
- Name it
<area>.integration.test.ts; the unit config excludes that pattern and the integration config picks it up. - Follow an existing suite in the same domain for setup/teardown shape.
- Timeouts are 30s in integration configs; if a test needs more, the test is usually doing too much.
- Cover Postgres AND at least one of MySQL/SQLite when the behavior touches
SQL generation; the CI matrix runs all three dialects
(
.github/workflows/integration.yml).
Debugging failures
- "Cannot resolve nextly/testing" or self-import errors -> unbuilt tree, build first.
- Connection refused -> containers not up, or wrong port (see the mapping
above).
pnpm docker:testwill not fix this and does not report on these containers at all; it probes the DEV database. - A suite passes alone but fails in the full run -> table-name collision; check the suite uses the prefix helper, and that it is not creating a fixed-name system table directly.
- Do not add retries or sleeps to mask ordering issues; fix the isolation.
Signals
- GitHub stars
- 59
- Forks
- 9
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
writing-integration-tests- Source
- github.com/nextlyhq/nextly
Related picks
Skill · wshobson
The pick for Noderun-node-tests
Skill · hiroro-work
The pick for Nodemysql-patterns
Skill · affaan-m
The pick for MySQLmysql-query
Skill · hashgraph-online
The pick for MySQLsupabase-postgres-best-practices
Skill · baekenough
The pick for Postgressqlite-ops
Skill · aiskillstore
The pick for SQLite