power-doctest

doctest + power-assert - comment as testing.

npm install power-doctest
24 downloads in the last week
41 downloads in the last month

power-doctest Build Status

doctest + power-assert.

Installation

npm install -g power-doctest

Task

Usage

Usage: power-doctest [options] /path/to/file.js

Options:
  -h, --help    Display help and usage details.
  -o, --output  Output Path

Test code :

function sum(ary) {
    return ary.reduce(function (current, next) {
        return current + next
    }, 0);
}

var total = sum([1, 2, 3, 4, 5]);
total; // > 5

This code expect total to be 5.

Result :

$ node bin/power-doctest.js example/item03.js
example/item03.js:8:0
AssertionError

        assert(total === 5);
               |     |
               15    false

assert-test

Exception Test

Look like => Error is assert.throw().

throw new Error(); // => Error
obj.not.found;// => Error

error-test

image

Async Test

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

npm loves you