2.1.4 • Published 11 months ago

testra v2.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
11 months ago

Testra

Minimal test runner

Screenshot

Documentation - API · Source

Install

npm install --save-dev testra

Overview

  1. Create tests with title and callback (can be async).
  2. Call asserts inside test: is, ok, not, throws.
  3. Run the tests with run.
import { test, is, ok, run, throws } from 'testra'

test('Test 1', () => {
  ok(true, 'truthy')
  is({ a: 1 }, { b: 2 }, 'deep equal')
  throws(() => someFn(), 'should throw')
})

test('Test 2', async () => {
  await new Promise(resolve => setTimeout(resolve, 1000))
  ok(true, 'async')
})

run()

Universal

The test report uses console to display the results with visual structure.

  • In the browser it uses console.group and CSS to style some text.
  • On the server it uses ANSI color sequences for the terminal. It also exits with code 1 when any test fails, for use in build and test pipeline.
2.1.4

11 months ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.3

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago