Integration Test Utils

Provides integration test helpers for a ready-to-use Payload instance in vitest.

Community 0 2/wk MIT v1.0.0

Installation

pnpm add payload-integration-test-utils

About

This plugin offers a set of opinionated integration test helpers specifically designed for testing Payload applications using vitest. It simplifies the process of setting up a local Payload instance connected to either a MongoDB or PostgreSQL database. Users can quickly create a global setup file to handle test initialization and teardown, ensuring a clean database state for each test. The core function, `getTestContextFor`, allows users to easily retrieve a Payload instance configured with their collections and globals, making it straightforward to write integration tests. Users can specify options to customize their test setup, including collection and global configurations. The plugin provides lifecycle hooks to manage test preparation and cleanup, with automatic handling of starting and stopping database containers through Testcontainers. This offers a streamlined approach to running integration tests without having to manually manage database instances.

Package info

Package name
payload-integration-test-utils
Latest version
1.0.0
Unpacked size
12 kB
License
MIT
Weekly downloads
2
Last publish
Mar 8, 2026

More from bhofstaetter

View profile