Skip to content

azu/power-assert-demo

Repository files navigation

power-assert-demo Build Status

Try power-assert in your browser.

DEMO: http://azu.github.io/power-assert-demo

img

Usage

You can write test with power-assert.

power-assert API equal to Node.js assert module, but it's has very-meaningful results.

describe('Array', function(){
    beforeEach(function(){
        this.ary = [1,2,3];
    });
    describe('#indexOf()', function(){
        it('should return index when the value is present', function(){
            var zero = 0, two = 2;
            assert(this.ary.indexOf(zero) === two);
        });
        it('should return -1 when the value is not present', function(){
            var minusOne = -1, two = 2;
            assert.ok(this.ary.indexOf(two) === minusOne, 'THIS IS AN ASSERTION MESSAGE');
        });
    });
});

Run the test code :

  • mac: ⌘-return
  • windows: ctrl-enter

Browser Support

It's depend on iframe'ssrcdoc.

Development

npm install
bower install
npm run watch

You should commit to master, gh-pages generated by travis-ci.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

About

Try power-assert in your browser.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published