ought
v0.0.6
Published
This module combines your underlying Node.js runtime's [assert](https://nodejs.org/api/assert.html) module's assertions with the pleasant diffing output from the [ava](https://github.com/avajs/ava) test runner (which is actually powered by [concordance](h
Downloads
190
Readme
ought
This module combines your underlying Node.js runtime's assert module's assertions with the pleasant diffing output from the ava test runner (which is actually powered by concordance).
To avoid adding unnecessary overhead to your tests, ought goes out of its way to
not require
any of its diffing and printing dependencies unless one of your
assertions has actually failed.
Usage
Install it:
npm install -D ought
Use it:
const ought = require('ought')
module.exports = function myTest () {
const result = 34 + 43
ought.equal(result, 77)
}
The other method is ought.notEqual
.
API
Assertions
ought.equal(actual, expected, message)
- Other than the pretty failure message, behavior should exactly match assert.deepStrictEqualought.notEqual(actual, expected, message)
- This one just calls assert.notDeepStrictEqual
We would've kept the original assertion names, but we hate typing.
Configuration
You can configure ought with ought.config
. Defaults follow:
ought.config({
color: true
})
Output
What does the output look like? The theme's colors need some tweaking, but for now the output of test.js's failing test looks like this:
Code of Conduct
This project follows Test Double's code of conduct for all community interactions, including (but not limited to) one-on-one communications, public posts/comments, code reviews, pull requests, and GitHub issues. If violations occur, Test Double will take any action they deem appropriate for the infraction, up to and including blocking a user from the organization's repositories.