test-combo
raw JSON → 0.0.2 verified Sat Apr 25 auth: no javascript
A testing framework built on top of Jest that generates test cases from configuration-driven combinatorial inputs. Current stable version 0.0.2 (published 2022-11-30). Enables high-coverage testing by defining factors and their conditions, then automatically generating all combinations as Jest test cases. Differentiates from parameterized testing libraries by providing a declarative factor/condition model and built-in support for setup/teardown per combination. Release cadence is unknown; appears to be a pre-1.0 package with limited adoption.
Common errors
error TypeError: testCombo is not a function ↓
cause Using CommonJS require() on an ESM-only package.
fix
Switch to ESM: add 'type': 'module' to package.json or use import syntax.
error Cannot find module 'jest' ↓
cause Jest is not installed as a devDependency.
fix
Run npm install --save-dev jest
error testCombo is not a function (or undefined) ↓
cause Importing default incorrectly with named import syntax.
fix
Use import testCombo from 'test-combo'
Warnings
breaking test-combo requires Jest as a peer dependency. Ensure Jest is installed and configured, or tests will fail to execute. ↓
fix Install jest: npm install --save-dev jest
deprecated The default export testCombo is deprecated in favor of the named export TestCombo in future versions. ↓
fix Use import { TestCombo } from 'test-combo' instead of default import.
gotcha Factor values are deep-equality compared; avoid using non-serializable objects (e.g., functions) to prevent unexpected behavior. ↓
fix Use primitive values or plain objects for factor values.
Install
npm install test-combo yarn add test-combo pnpm add test-combo Imports
- default wrong
const testCombo = require('test-combo')correctimport testCombo from 'test-combo' - TestCombo wrong
import TestCombo from 'test-combo'correctimport { TestCombo } from 'test-combo' - Factor wrong
const Factor = require('test-combo').Factorcorrectimport { Factor } from 'test-combo' - Condition wrong
import { Condition } from 'test-combo/dist/index.js'correctimport { Condition } from 'test-combo'
Quickstart
import testCombo, { Factor, Condition } from 'test-combo';
const add = (a, b) => a + b;
testCombo({
name: 'add',
test: (factor, condition) => {
if (condition === 'positive') {
expect(add(factor.a, factor.b)).toBeGreaterThan(0);
} else {
expect(add(factor.a, factor.b)).toBeLessThanOrEqual(0);
}
},
factors: [
{ name: 'a', values: [1, 2, -1, -2] },
{ name: 'b', values: [3, -3, 0, 5] },
],
conditions: [
{ name: 'positive', filter: (f) => f.a + f.b > 0 },
{ name: 'non-positive', filter: (f) => f.a + f.b <= 0 },
],
});