$ npm install test-runner
A minimal test runner built around a single, core principle: if a test function completes successfully (or fulfils), it passes. If it throws (or rejects) it fails. It has no opinion how you write tests, or which (if any) assertion library you use.
const TestRunner = require('test-runner')
const runner = new TestRunner()
Passing test, sync.
runner.test('this will pass', function () {
const result = 'Pass'
})
Passing test, async.
runner.test('this will also pass', function () {
return Promise.resolve('Pass')
})
Failing test, sync.
runner.test('this will fail', function () {
throw new Error('Fail')
})
Failing test, async.
runner.test('this will also fail', function () {
return Promise.reject('Fail')
})
To run the tests, execute the script:
$ node test.js
... or use the command-line tool to test multiple files:
$ test-runner test/*.js
PromiseKind: Exported class
Emits: event:start, event:end, event:test-start, event:test-end, event:test-pass, event:test-fail
PromiseRun all tests in parallel
Kind: instance method of TestRunner
© 2016-18 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.
© 2010 - cnpmjs.org x YWFE | Home | YWFE