A tiny stand-alone fluent-styled testing package.
A tiny stand-alone fluent-styled testing package.
This package is released under the ISC license.
Installing package using npm:
$ npm install --save-dev bountiful-tags
Configuring the package.json to use the testing framework:
{
"scripts": {
"test": "bountiful-tags",
"preversion": "npm test"
}
}
Writing a test suite called basics.js found in the test directory of the package:
const {testContext} = require('bountiful-tags');
const context = testContext();
context.testSuite()
.unit()
.testCase('expected success')
.return(() => { /* no exceptions */ })
.testCase('unexpected failure')
.return(() => { throw new Error('unexpected error'); })
.testCase('expected failure')
.throw(() => { throw new Error('expected error'); })
.testCase('expected failure with expected error message')
.throw(() => { throw new Error('expected error'); }, 'expected error')
.testCase('expected failure with unexpected error message')
.throw(() => { throw new Error('unexpected error'); }, 'expected error');
Running all test suites:
$ npm test
/home/wareification/Repos/bt-example/test/basics.js
✕ [unit: unexpected failure] 0ms
unexpected error
✕ [unit: expected failure with unexpected error message] 0ms
Error("unexpected error") != Error("expected error")
✓ 3 ✕ 2 1ms
*.js
✓ 3 ✕ 2 1ms
Please visit the test directory of the bountiful-tags repo for more detailed examples.
Please forward all bug reports and feature requests to author's email.