A test runner-agnostic library for data-driven testing, fuzz testing, and snapshot testing with descriptive titles.
test-each is a JavaScript library that facilitates data-driven testing by repeating test cases with various inputs. It solves the problem of writing repetitive test code by automating the iteration over input combinations, supporting cartesian products, fuzz testing, and snapshot testing. It generates clear test titles to improve test output readability.
JavaScript developers using test runners like Ava, Jest, Mocha, or Jasmine who need to write data-driven tests, fuzz tests, or snapshot tests with multiple input scenarios.
Developers choose test-each because it is test runner-agnostic, integrates easily into existing setups, and provides powerful features like automatic title generation and cartesian product iteration without locking them into a specific framework.
🤖 Repeat tests. Repeat tests. Repeat tests.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works seamlessly with any test runner (Ava, Jest, Mocha, etc.), as shown in the examples, allowing easy integration into existing setups without framework lock-in.
Automatically generates descriptive, unique test titles for any JavaScript type, not just JSON, improving test output readability and debugging, as detailed in the 'Test titles' section.
Supports cartesian product iteration to test every possible combination of inputs, enabling comprehensive test coverage without manual loops, highlighted in the 'Cartesian product' section.
Enables fuzz testing by allowing random input functions and integer multipliers, compatible with libraries like faker.js for randomized scenarios, as demonstrated in the 'Fuzz testing' examples.
Must be loaded as an ES module, requiring projects using CommonJS or older build systems to adapt, which adds setup complexity and excludes environments without ES module support.
Requires developers to manually append generated titles to test descriptions, increasing boilerplate code and potential for errors, as seen in the examples where titles are concatenated in test calls.
The README warns that modifying parameters directly can cause side effects across iterations, forcing developers to manage copies carefully and adding cognitive load to avoid bugs.