https://github.com/dgellow/tesuto
✅ Tiny node/typescript library for test reporting
https://github.com/dgellow/tesuto
lightweight minimalist test test-reporting testing typescript
Last synced: about 1 year ago
JSON representation
✅ Tiny node/typescript library for test reporting
- Host: GitHub
- URL: https://github.com/dgellow/tesuto
- Owner: dgellow
- Created: 2015-08-05T08:50:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T19:04:50.000Z (about 6 years ago)
- Last Synced: 2025-03-26T22:06:57.367Z (about 1 year ago)
- Topics: lightweight, minimalist, test, test-reporting, testing, typescript
- Language: TypeScript
- Homepage:
- Size: 105 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/dgellow/tesuto) [](https://badge.fury.io/js/tesuto)

# tesuto
A really tiny test reporting library with [one unique dependency](https://github.com/dgellow/neocolor/).
```
$ yarn add --dev tesuto
$ npm install --save-dev tesuto
```

## Usage
```typescript
import assert from "assert"
import {testing, report, result} from "tesuto"
function add (x, y) {
return x + y
}
// Report a test
report("add numbers", function () {
assert.equal(add(1, 2), 3)
assert.equal(add(2, 2), 4)
})
// Define a group of tests
testing("add function", function () {
report("when first arg is a string, concatenate", function () {
assert.equal(add("hello_", "you"), "hello_you")
assert.equal(add("hello_", 2), "hello_2")
})
// Groups can be nested
testing("with numbers", function() {
report("should be associative", function () {
assert.equal(add(1, 2), 3)
assert.equal(add(2, 1), 3)
})
report("should support negative numbers", function () {
assert.equal(add(-1, -2), -3)
assert.equal(add(1, -2), -1)
})
})
})
result()
```
## API
### `report`, define a test
```typescript
report("add numbers", function () {
assert.equal(add(1, 2), 3)
assert.equal(add(2, 2), 4)
})
```
### `testing`, define a group of tests
> Note: Groups can be nested
```typescript
testing("add function", function () {
report("when first arg is a string, concatenate", function () {
assert.equal(add("hello_", "you"), "hello_you")
assert.equal(add("hello_", 2), "hello_2")
})
})
```
### `result`, print statistics
```typescript
result()
```