2.1.1 • Published 5 years ago

tesuto v2.1.1

Weekly downloads
18
License
MIT
Repository
github
Last release
5 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

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago