Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabioricali/beJS
Simple, light-weight assertions framework for javascript
https://github.com/fabioricali/beJS
assertion-library assertions framework javascript nodejs test-framework throw-errors validation-library
Last synced: 2 months ago
JSON representation
Simple, light-weight assertions framework for javascript
- Host: GitHub
- URL: https://github.com/fabioricali/beJS
- Owner: fabioricali
- Created: 2017-06-11T10:24:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T16:41:14.000Z (over 4 years ago)
- Last Synced: 2024-11-09T09:02:55.371Z (2 months ago)
- Topics: assertion-library, assertions, framework, javascript, nodejs, test-framework, throw-errors, validation-library
- Language: JavaScript
- Homepage: https://be.js.org
- Size: 1.47 MB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-github-star - beJS - weight assertions framework for javascript | fabioricali | 12 | (JavaScript)
README
***to be, or not to be, that is the question***
# Simple, light-weight assertions framework for javascript#### More than ***190*** validation methods
## Installation
### Node.js
```javascript
npm install bejs --save
```### Browser
#### Local
```html```
#### CDN unpkg
```html```
#### CDN jsDeliver
```html```
## Example
```javascript
const be = require('bejs');// call a method
be.boolean(true);// call interface "not"
be.not.boolean(1);// call interface "all" and passing arguments
be.all.boolean(true, false, true);// call interface "all" and passing array
be.all.boolean([true, false, true]);// call interface "any" and passing arguments
be.any.boolean(true, false, 1);// call interface "err" to throw an error if assertions are not satisfied
be.err.equal('hello world', 'hello world!'); // throw AssertionError// call interface "err" passing a custom error message
be.err('the string must be equal to "hello world!"').equal('hello world', 'hello world!'); // throw AssertionError// call others interfaces from "err"
be.err.any.array([], {}, '');
```## As unit test with Mocha
```javascript
describe('a test', () => {
it('should be ok', (done)=>{
be.err(done).email('[email protected]');
});
it('should be false', ()=>{
be.err.false(2 === 3);
});
});
```## Documentation
See https://be.js.org## Changelog
You can view the changelog here## License
beJS is open-sourced software licensed under the MIT license## Author
Fabio Ricali