The repeat-test library is my attempt to come up with a nicer API for writing property tests in TypeScript.
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.
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.
See the docs directory for a longer introduction.