Vitest utility for integration tests with Neon Postgres. Each test file runs against an isolated Neon branch, providing real database features like transactions and constraints. Version 2.7.0. ESM-only. No CommonJS support. Integrates with Neon WebSocket drivers for automatic connection cleanup. Supports optional branch preservation for debugging. Requires a Neon project and API key.
npm install neon-testingNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up an isolated Neon branch for a test file using makeNeonTesting, creates a table, inserts data, and verifies the result.
Use import statements instead of require().
Upgrade vitest to v3 or v4 (or v5, v6, etc. if supported by future releases).
Set NEON_API_KEY and NEON_PROJECT_ID environment variables.
Increase the expiresIn option (e.g., expiresIn: 20) for long-running tests.
Set autoCloseWebSockets: true in the configuration.
Use vitest@3 or later.
Install vite@7 or later.
Change require('neon-testing') to import { makeNeonTesting } from 'neon-testing'.Ensure you import the named export: import { makeNeonTesting } from 'neon-testing'.Set NEON_API_KEY in your .env file or test environment.
Generate a new Neon API key and update your environment variable.
Verify your Neon project ID from the Neon console.