Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jokeyrhyme/assertive-chai.js
Chai.js without Expect or Should
https://github.com/jokeyrhyme/assertive-chai.js
Last synced: 1 day ago
JSON representation
Chai.js without Expect or Should
- Host: GitHub
- URL: https://github.com/jokeyrhyme/assertive-chai.js
- Owner: jokeyrhyme
- License: mit
- Created: 2014-05-23T06:52:17.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-05T01:39:12.000Z (almost 8 years ago)
- Last Synced: 2024-10-31T06:51:20.568Z (8 days ago)
- Language: JavaScript
- Size: 84 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Assertive Chai
[Chai.JS](http://chaijs.com/) without Expect or Should
## ABANDONED
Use [jest](https://github.com/facebook/jest) or [ava](https://github.com/avajs/ava) instead
## What?
This is just the [Assert API](http://chaijs.com/api/assert/) from
Chai.JS. When run in Node.JS, it depends on the built-in `assert`
module. When run in the browser, it depends on the [browser port of
those assertions](https://github.com/Jxck/assert).The unit tests are stolen from Chai.JS in part.
### Status
I'm leaning on Node.js' implementation of `deepEqual` and I need to borrow
Chai's instead, so:- deep-equality assertion for objects with circular references isn't working yet
- deep-equality assertion for objects like `Object.create({ ... })` isn't working
eitherLikewise, I'm leaning on Node.js' implementation of `throws` and `doesNotThrow`,
so:- assertions on the content of a thrown error aren't working yet
## Why?
- [Chai.JS requires ECMAScript 5](https://github.com/chaijs/chai/issues/117),
making it a poor choice for projects that need to span a wide variety of
browsers- I don't feel BDD-style assertions are worth the hassle of having to
learn what is frequently an inconsistent API- BDD makes more sense at the test framework level, and it's easy to
integrate Chai.JS (and this library) with any test framework you like## How?
### Browser
```sh
bower install assertive-chai --save-dev
``````html
var assert = chai.assert;
```
Be sure to include ES5 shims if you need to test in IE8, and a JSON polyfill for
testing in IE7.### Node.JS
Frankly, I'd probably just stick with upstream Chai for Node.JS (as there
aren't any ES5 compatibility issues with Node.JS), but if you like:```sh
npm install assertive-chai --save-dev
``````javascript
var assert = require('assertive-chai').assert;
```## Development
- generate the browser bundle: `npm run build`
- generate browser tests bundle and run Node.js tests: `npm test`
- run the browser tests by navigating to the HTML files in the tests directory## License
- [MIT](LICENSE.txt)
## Related Stuff
- see my [tape-chai](https://github.com/jokeyrhyme/tape-chai.js) project if you
prefer the simplicity of [tape](https://github.com/substack/tape) but miss
some of the more convenient assertions from [chai](http://chaijs.com/)