@hydre/doubt
TAP 13 compliant testing library
An elegant and minimalTester c'est douter
Test your code and pipe the output to a consumer like tape-spec-emoji
- The only assertion is a fast deep equality
Concept
No fugazzi here, just equality
Toc
Install
npm i -D @hydre/doubt
Use
Usage is trivial
-
stdout
- Doubt doesn't pollute the standard output, use any stream -
title
- Test suite title -
calls
- Enforce how many tests you want, it will fails if the count doesn't match
import Doubt from '@hydre/doubt'
const doubt = Doubt({
stdout : process.stdout,
title : 'Testing is simple',
calls : 1,
})
And then write some tests
doubt['Roses are red']({
because: 'red',
is : 'red',
})
Format
import Doubt from '@hydre/doubt'
import reporter from 'tap-spec-emoji'
import { pipeline, PassThrough } from 'stream'
const through = new PassThrough()
pipeline(
through,
reporter(),
process.stdout,
() => {},
)
const doubt = Doubt({
stdout : through,
title : 'Testing is simple',
calls : 4,
})
doubt['Roses are red']({
because: 'red',
is : 'red',
})
doubt['Violets are blue']({
because: 'blue',
is : 'blue',
})
doubt['Doubt is awesome']({
because: { amazing: true },
is : { amazing: true },
})
doubt['Your tests should be too']({
because: { 'using doubt': true },
is : { 'using doubt': false },
})