kreszentia
v1.1.0
Published
A tiny and elegant BDD test suite for NodeJS.
Downloads
2
Readme
Contents
Installing
Using npm:
$ npm install kreszentia --globalGetting Started
$ npm install kreszentia --global
$ mkdir __tests__ && cd __tests__
$ touch addition.jsIn your editor:
import { equal } from "node:assert";
// Define a new suite
suite("addition", () => {
// Add a new test
add("add 1+1", () => {
equal(1 + 1, 3);
});
// Add a new test
add("add 2+2", () => {
equal(2 + 2, 4);
});
// Finish adding tests
done();
});
// Runs all suites.
run();In the terminal:
$ kreszentia
addition:
✕ - add 1+1: expected 3, got 2
✓ - add 2+2
1 tests passing, 1 tests failingAs of version 1.1.0. kreszentia also supports require()/import:
const { suite, add, done, run } = require("kreszentia");Or:
import { suite, add, done, run } from "kreszentia";API
suite(suiteName, callback)
Creates a new test suite.
| suiteName | string | |-----------|----------| | callback | function |
add(testName, callback)
Adds a test to the current test suite.
| testName | string | |-----------|----------| | callback | function |
done()
Finish adding tests to the test suite.
run()
Run all suites.
