https://github.com/tapjs/tt
tiny tap test thing
https://github.com/tapjs/tt
Last synced: about 1 year ago
JSON representation
tiny tap test thing
- Host: GitHub
- URL: https://github.com/tapjs/tt
- Owner: tapjs
- License: isc
- Created: 2012-11-29T02:23:40.000Z (over 13 years ago)
- Default Branch: main
- Last Pushed: 2022-02-26T23:13:49.000Z (over 4 years ago)
- Last Synced: 2025-04-23T22:06:18.618Z (about 1 year ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tt
A very very small tap-emitting test
framework.
This is *not* a test runner, but you can use tap as your test runner.
Because tt outputs TAP formatted results, it'll get interpreted
nicely.
## USAGE
Do this in your test script:
```javascript
var test = require('tt')
test('first test', function(t) {
t.equal(2, 1 + 1, 'math works')
t.equal(0.3, 0.1 + 0.1 + 0.1, 'except when it doesnt')
t.test('child test', function(t) {
t.pass('this will always pass')
t.fail('this will never pass')
t.end()
})
t.end()
})
test('second test', function(t) {
t.ok(true, 'etc')
t.end()
})
```
Run it with `node my-test.js`, or your favorite TAP-aware test runner
thingie.
## API
The function exported by `require('tt')` is the test function. Give
it a name and a function. That function will get an argument object
which has some assertion methods.
Every function from `require('assert')` are supported, but they output
TAP data rather than throwing.
Also, you have `t.pass(message)`, `t.fail(message)`,
`t.comment(message)`, and `t.test(name, fn)`.