Skip to content
/ doubt Public

An elegant and minimal TAP 13 compliant testing library

License

Notifications You must be signed in to change notification settings

HydreIO/doubt

Repository files navigation

@hydre/doubt

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

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 },
})

About

An elegant and minimal TAP 13 compliant testing library

Resources

License

Stars

Watchers

Forks

Packages

No packages published