2.1.1 • Published 4 years ago

tesuto v2.1.1

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

Build Status npm version

tesuto logo

tesuto

A really tiny test reporting library with one unique dependency.

$ yarn add --dev tesuto

$ npm install --save-dev tesuto

Usage

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

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

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

result()
2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago