Permalink
Browse files

[tap] final touches like adding test descriptions and making readme a…

… bit better
  • Loading branch information...
1 parent c997de0 commit aa5557a4db1e141295943a815d74de5cf8758633 @dscape committed Sep 9, 2011
Showing with 23 additions and 5 deletions.
  1. +20 −2 README.md
  2. +3 −3 test/tap.js
View
@@ -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
View
@@ -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.