/tap-strings

Generate valid TAP output as strings

Primary LanguageJavaScript

tap-strings

Generate valid TAP output as strings.

API

const tap = require('tap-strings')

tap.version(number)

tap.version(13) // => `TAP version 13`

tap.plan(start, end)

tap.plan(1, 5) // => `1..5`

tap.test(ok, number, [description])

tap.test(true, 1, `lookin' cool my man`) // => `ok 1 lookin' cool my man`

tap.todo(ok, number, [descriptor, [directive]])

const todoOutput = tap.todo(false, 2, `everything's groovy`, `Fix this later`)
todoOutput // => `not ok 2 everything's groovy # TODO Fix this later`

tap.skip(ok, number, [descriptor, [directive]])

tap.skip(true, 3, null, `Don't care`) // => `ok 3 # SKIP Don't care`

tap.bail([message])

tap.bail(`eek`) // => `Bail out! eek`

tap.diagnostic([message])

tap.diagnostic(`yo`) // => `# yo`

tap.message(message)

const messageOutput = tap.message(`This is totally
a multiline string`)

const expected = `  ---
  message: |-
    This is totally
    a multiline string
  ...`

messageOutput // => expected

License

WTFPL