From ddf0e43248f7d4bf76da0d8a722f8623b225a80e Mon Sep 17 00:00:00 2001 From: Erkan Yilmaz Date: Fri, 9 Mar 2012 17:21:48 +0100 Subject: [PATCH] language fixes, typo --- docs/index.html | 10 +++++----- docs/index.md | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/index.html b/docs/index.html index 587f933..914089c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,14 +45,14 @@

Expresso 0.9.0

assert.equal(6, 'foobar'.length); };

Alternatively for large numbers of tests you may want to export your own object containing the tests, however this -is essentially the as above:

module.exports = {
+is essentially the same as above:

module.exports = {
     'test String#length': function(beforeExit, assert) {
       assert.equal(6, 'foobar'.length);
     }
 };

If you prefer not to use quoted keys:

exports.testsStringLength = function(beforeExit, assert) {
     assert.equal(6, 'foobar'.length);
 };

The argument passed to each callback is beforeExit and assert. -The context ("this") of each test function is a Test object. You can pass a function to beforeExit to make sure the assertions are run before the tests exit. This is can be used to verify that tests have indeed been run. beforeExit is a shortcut for listening to the exit event on this. The second parameter assert is the assert object localized to that test. It makes sure that assertions in asynchronous callbacks are associated with the correct test.

exports.testAsync = function(beforeExit, assert) {
+The context ("this") of each test function is a Test object. You can pass a function to beforeExit to make sure the assertions are run before the tests exit. This can be used to verify that tests have indeed been run. beforeExit is a shortcut for listening to the exit event on this. The second parameter assert is the assert object localized to that test. It makes sure that assertions in asynchronous callbacks are associated with the correct test.

exports.testAsync = function(beforeExit, assert) {
     var n = 0;
     setTimeout(function() {
         ++n;
@@ -81,7 +81,7 @@ 

Expresso 0.9.0

comparisons, opposed to assert.equal() which uses ==.

assert.eql('foo', 'foo');
 assert.eql([1,2], [1,2]);
 assert.eql({ foo: 'bar' }, { foo: 'bar' });

assert.includes(obj, val[, msg])

Assert that obj is within val. This method supports Arrays -and Stringss.

assert.includes([1,2,3], 3);
+and Strings.

assert.includes([1,2,3], 3);
 assert.includes('foobar', 'foo');
 assert.includes('foobar', 'bar');

assert.response(server, req, res|fn[, msg|fn])

Performs assertions on the given server, which should not call listen(), as this is handled internally by expresso and the server @@ -137,7 +137,7 @@

Expresso 0.9.0

so the following is equivalent to the command above:

$ expresso

If you wish to unshift a path to require.paths before running tests, you may use the -I or --include flag.

$ expresso --include lib test/*

The previous example is typically what I would recommend, since expresso supports test coverage via node-jscoverage (bundled with expresso), -so you will need to expose an instrumented version of you library.

To instrument your library, simply run node-jscoverage, +so you will need to expose an instrumented version of your library.

To instrument your library, simply run node-jscoverage, passing the src and dest directories:

$ node-jscoverage lib lib-cov

Now we can run our tests again, using the lib-cov directory that has been instrumented with coverage statements:

$ expresso -I lib-cov test/*

The output will look similar to below, depending on your test coverage of course :)

node coverage

To make this process easier expresso has the -c or --cov which essentially does the same as the two commands above. The following two commands will @@ -171,4 +171,4 @@

Expresso 0.9.0

}, 100);

Note that you only have one "shot" at exporting. You have to export all of your test functions in the same loop as the first one. That means you can't progressively add more test functions to the exports object.

- \ No newline at end of file + diff --git a/docs/index.md b/docs/index.md index d3845ff..71712f1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -43,7 +43,7 @@ To define tests we simply export several functions: Alternatively for large numbers of tests you may want to export your own object containing the tests, however this -is essentially the as above: +is essentially the same as above: module.exports = { 'test String#length': function(beforeExit, assert) { @@ -58,7 +58,7 @@ If you prefer not to use quoted keys: }; The argument passed to each callback is `beforeExit` and `assert`. -The context ("`this`") of each test function is a _Test_ object. You can pass a function to `beforeExit` to make sure the assertions are run before the tests exit. This is can be used to verify that tests have indeed been run. `beforeExit` is a shortcut for listening to the `exit` event on `this`. The second parameter `assert` is the `assert` object localized to that test. It makes sure that assertions in asynchronous callbacks are associated with the correct test. +The context ("`this`") of each test function is a _Test_ object. You can pass a function to `beforeExit` to make sure the assertions are run before the tests exit. This can be used to verify that tests have indeed been run. `beforeExit` is a shortcut for listening to the `exit` event on `this`. The second parameter `assert` is the `assert` object localized to that test. It makes sure that assertions in asynchronous callbacks are associated with the correct test. exports.testAsync = function(beforeExit, assert) { var n = 0; @@ -143,7 +143,7 @@ comparisons, opposed to `assert.equal()` which uses `==`. ### assert.includes(obj, val[, msg]) Assert that `obj` is within `val`. This method supports `Array`s -and `Strings`s. +and `String`s. assert.includes([1,2,3], 3); assert.includes('foobar', 'foo'); @@ -260,7 +260,7 @@ running tests, you may use the `-I` or `--include` flag. The previous example is typically what I would recommend, since expresso supports test coverage via [node-jscoverage](http://github.com/visionmedia/node-jscoverage) (bundled with expresso), -so you will need to expose an instrumented version of you library. +so you will need to expose an instrumented version of your library. To instrument your library, simply run [node-jscoverage](http://github.com/visionmedia/node-jscoverage), passing the _src_ and _dest_ directories: