# test-cases

> Provides support for test cases in most test runners.

Latest version **1.0.4** (published 2025-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install test-cases
pnpm add test-cases
yarn add test-cases
bun add test-cases
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2025-03-24 |
| First published | 2019-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Max Jöhnk |
| Maintainers | maxjoehnk |
| Keywords | test, testcase |

## Links

- npm: https://www.npmjs.com/package/test-cases
- Repository: https://github.com/maxjoehnk/test-cases
- Issues: https://github.com/maxjoehnk/test-cases/issues
- npm.io page: https://npm.io/package/test-cases

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2025-03-24
- 1.0.3 — 2019-07-29
- 1.0.2 — 2019-05-02
- 1.0.1 — 2019-03-22
- 1.0.0 — 2019-02-04

## README

# test-cases

[![Build Status](https://travis-ci.com/maxjoehnk/test-cases.svg?branch=master)](https://travis-ci.com/maxjoehnk/test-cases)

This package provides support for test cases in most test runners.
Just call setup with the function you use to declare your test (ie `it` for jasmine or mochas bdd interface, `test` for mochas tdd interface,...).
Right now there is Typescript support for up to 5 arguments, after which its just an `any[]`.

```typescript
import { setup } from 'test-cases';
import * as mocha from 'mocha';
import { assert } from 'chai';
const test = setup(mocha.test);

suite('Test', () => {
    // With testcases
    test
        .case(1, 2, 3)
        .case(4, 5, 9)
        .run('a + b = c', (a, b, c) => {
            assert.equal(a + b, c);
        });

    // Without testcases
    test('a basic test', () => {
        assert.equal(true, true);
    });
});

```

---
_Source: https://npm.io/package/test-cases · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
