Test Pantry is a JavaScript test factory library for creating test data in a simple, fluid manner. Current stable version is 1.7.1. It uses a 'pantry' instance where you define recipes for objects (factories), then call them to generate instances. Key features include support for traits (mixing multiple factories), dynamic properties via functions, after-build hooks, sequence counters via `this.count`, list generation by passing a number, and alternative call syntax (e.g., `pantry.recipeName()`). Unlike libraries like Factory Bot or Rosie, Test Pantry emphasizes a minimalist JavaScript-native API with chaining and UMD support, though it has not seen recent updates and relies on UMD builds without ESM, which may cause issues in modern environments.
npm install test-pantryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines two factories (object literal and function) and creates single and multiple instances.
If you want a function as a value, wrap it in another function or use a function factory.
Use a different mechanism if you need a global sequence.
If using ESM, consider using a bundler that can handle UMD, or look for an alternative library with ESM support.
Plan trait composition to avoid nested object conflicts.
Use 'new TestPantry()' or import default: import TestPantry from 'test-pantry'
Run 'npm install -D test-pantry' and ensure node_modules contains it.
const pantry = new TestPantry()
No dependency data recorded yet.