An elegant and minimal TAP 13 compliant testing library
Tester 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
No fugazzi here, just equality
npm i -D @hydre/doubt
Usage is trivial
stdout
- Doubt doesn't pollute the standard output, use any streamtitle
- Test suite titlecalls
- 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',
})
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 },
})