https://github.com/dy/tst
Tests without efforts
https://github.com/dy/tst
mocha tap test
Last synced: 5 days ago
JSON representation
Tests without efforts
- Host: GitHub
- URL: https://github.com/dy/tst
- Owner: dy
- License: other
- Created: 2016-01-05T19:48:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-04-06T19:14:15.000Z (3 months ago)
- Last Synced: 2025-05-30T11:52:24.481Z (about 2 months ago)
- Topics: mocha, tap, test
- Language: JavaScript
- Homepage:
- Size: 303 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tst
Test without efforts.
* no tooling, vanilla ESM
* works both node/browser
* async functions support
* inspectable errors
* stacktrace with sourcemaps
* clean l&f in browser/node
* supports [assert](https://www.npmjs.com/package/assert), [chai](https://www.npmjs.com/package/chai) etc.
* minimal, 0dep
* tape API## usage
```js
import test, { ok, is, not, throws } from 'tst.js'test('tst demo test', () => {
ok(true);
ok(true, 'this time with an optional message');
ok('not true, but truthy enough');is(1 + 1, 2);
is(Math.max(1, 2, 3), 3);
is({}, {})throws(() => {
throw new Error('oh no!');
}, /oh no!/);
})
```## api
* `test.only` − run only selected test(s)
* `test.mute` − run test(s), mute assertions
* `test.skip` − bypass test(s)
* `test.todo` − bypass test(s), mark as WIP
* `test.demo` − demo run, skip failed assertions.## assert
* `ok(a, msg?)` − generic truthfulness assert
* `is(a, b, msg?)` − assert with `Object.is` for primitives and `deepEqual` for objects
* `not(a, b, msg?)` - assert with `!Object.is` for primitives and `!deepEqual` for objects
* `any(a, [a, b, c], msg?)` − assert with optional results
* `same(listA, listB, msg?)` − assert same members of a list/set/map/object
* `throws(fn, msg?)` − fn must throw
* `pass(msg)`, `fail(msf)` − pass or fail the whole test.## why?
Testing should not involve maintaining test runner.
It should be simple as [tap/tape](https://ghub.io/tape), working in browser/node, ESM, with nice l&f, done in a straightforward way.
I wasn't able to find such test runner that so I had to create one.* [testra](https://github.com/eliot-akira/testra)
* [tape-modern](https://ghub.io/tape-modern)
* [@goto-bus-stop/tape-modern](https://github.com/goto-bus-stop/tape-modern#readme)
* [brittle](https://github.com/davidmarkclements/brittle)
* [tap](https://ghub.io/tap)
* [tape](https://github.com/tape-testing/tape)
* [zora](https://github.com/lorenzofox3/zora)
* [tapes](https://www.npmjs.com/package/tapes)
* [tape-es](https://github.com/vanillaes/tape-es)
* [uvu](https://github.com/lukeed/uvu)
* [pitesti](https://github.com/bengl/pitesti)