Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.24 KB

README.md

File metadata and controls

34 lines (22 loc) · 1.24 KB

The repeat-test library is my attempt to come up with a nicer API for writing property tests in TypeScript.

Warning

This library is brand new, incomplete, and should be considered experimental. I've only used repeat-test to test itself. It only works with Deno. I don't plan to stabilize the API or support more platforms until I've gained more experience with it.

Also, though it seems promising, I don't know how long I'll keep working on it!

If you're looking for a full-featured, popular, stable property-testing library, I recommend fast-check.

Hello world

The main entry point is the repeatTest function. Here's how to use it as a glorified while loop:

import { assertEquals } from "@std/assert";
import { repeatTest } from "@skybrian/repeat-test";

const examples = ["hello", "world"];

repeatTest(examples, (word) => {
  assertEquals(word.length, 5); // This will run twice.
});

The first argument to repeatTest provides a way of generating examples. The second argument is a test function to run repeatedly that takes an example as input. A repetition ("rep" for short) passes if the test function completes normally.

Documentation

See the docs directory for a longer introduction.