FarTest
FAst and smaRT TESTing
FarTest is a minimal, colorful and enjoyable test library for small applications.
Installation
npm install --save-dev fartest
In short :
npm i -D fartest
Basic usage
FarTest export three functions :
- starTest - start a new test,
- stage - define the current stage inside a test,
- test - check an assertion inside a test.
First, let's import the functions we need :
const {starTest, stage, test} = require('FarTest')
With ES modules :
import {starTest, stage, test} from 'FarTest')
Then, we start the test :
starTest(async function MyAwesomeTest() {
stage('Some succesful tests')
test(1 == 1)
test(21, 21)
stage('A simple test which will not succeed')
test(21, "21")
stage('Crash test')
undefined.coco = 321321
})
Running multiple tests
You can run multiple tests at once, in which case they will be executed one after another :
starTest(async function CoolTest() {
stage('1 == 1')
test(1 == 1)
stage('2 == "2"')
test(2 == "2")
})
starTest(async function SuperCoolTest() {
stage('3 == 3')
test(3 == 3)
})
That's all...
Let's FarT!