Skip to content

Commit

Permalink
[tap] final touches like adding test descriptions and making readme a…
Browse files Browse the repository at this point in the history
… bit better
  • Loading branch information
dscape committed Sep 9, 2011
1 parent c997de0 commit aa5557a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
22 changes: 20 additions & 2 deletions README.md
Expand Up @@ -38,12 +38,30 @@ an extra parameter is available to allow you to define only some tests from a sp
ensure('foo',tests,module,process.argv[2]);
```

you can also set `ensure` to use a different test engine. for now we have [tap][4] and [vows][5] available
you can also set `ensure` to use a different test engine. for now we have [tap][4] and [vows][5] available with `vows` by default. here's an example using tap

```js
require('ensure').use('vows');
var ensure = require('ensure').use('tap')
, tests = exports
;

tests.tap = function (cb) { cb('foo'); };
tests.tap_ok = function (value) {
var t = this.t; // get the assertions from tap engine
t.equal(value,'foo','foo test worked');
};

ensure(__filename,tests,module,process.argv[2]);
```

to run test tap you can do:

```sh
node test/tap.js tap
```

tap is the test name and is optional (by default all tests run).

# contribute

everyone is welcome to contribute. patches, bugfixes, new features
Expand Down
6 changes: 3 additions & 3 deletions test/tap.js
Expand Up @@ -5,13 +5,13 @@ var ensure = require('../ensure').use('tap')
tests.tap = function (cb) { cb('foo'); };
tests.tap_ok = function (value) {
var t = this.t;
t.equal(value,'foo');
t.equal(value,'foo','foo works');
};

tests.plan_works = function (cb) { cb('bar'); };
tests.plan_works_ok = function (value) {
var t = this.t;
t.equal(value,'bar');
t.equal(value,'bar','plan tests work');
};

ensure(__filename,tests,module,process.argv[2]);
ensure('tap',tests,module,process.argv[2]);

0 comments on commit aa5557a

Please sign in to comment.