X-Git-Url: https://git.cworth.org/git?p=obsolete%2Fnotmuch-web;a=blobdiff_plain;f=node_modules%2Fexpress%2Fnode_modules%2Fqs%2Fsupport%2Fexpresso%2Fdocs%2Findex.html;fp=node_modules%2Fexpress%2Fnode_modules%2Fqs%2Fsupport%2Fexpresso%2Fdocs%2Findex.html;h=064313ff2326b7e3116832b6de4b68cdcf218abb;hp=0000000000000000000000000000000000000000;hb=410c776334299b52b7df74c53dafe761ad51cf0d;hpb=df790f70fe96623e5d2469daedaf7114bde13426 diff --git a/node_modules/express/node_modules/qs/support/expresso/docs/index.html b/node_modules/express/node_modules/qs/support/expresso/docs/index.html new file mode 100644 index 0000000..064313f --- /dev/null +++ b/node_modules/express/node_modules/qs/support/expresso/docs/index.html @@ -0,0 +1,377 @@ + +
+
+ index
+
Expresso is a JavaScript TDD framework written for nodejs. Expresso is extremely fast, and is packed with features such as additional assertion methods, code coverage reporting, CI support, and more.
+ +assert.eql()
alias of assert.deepEqual()
assert.response()
http response utilityassert.includes()
assert.isNull()
assert.isUndefined()
assert.isNotNull()
assert.isDefined()
assert.match()
assert.length()
To install both expresso and node-jscoverage run +the command below, which will first compile node-jscoverage:
+ +$ make install
+
+
+To install expresso alone without coverage reporting run:
+ +$ make install-expresso
+
+
+Install via npm:
+ +$ npm install expresso
+
+
+To define tests we simply export several functions:
+ +exports['test String#length'] = function(){
+ 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 = {
+ 'test String#length': function(){
+ assert.equal(6, 'foobar'.length);
+ }
+};
+
+
+If you prefer not to use quoted keys:
+ +exports.testsStringLength = function(){
+ assert.equal(6, 'foobar'.length);
+};
+
+
+The argument passed to each callback is beforeExit, +which is typically used to assert that callbacks have been +invoked.
+ +exports.testAsync = function(beforeExit){
+ var n = 0;
+ setTimeout(function(){
+ ++n;
+ assert.ok(true);
+ }, 200);
+ setTimeout(function(){
+ ++n;
+ assert.ok(true);
+ }, 200);
+ beforeExit(function(){
+ assert.equal(2, n, 'Ensure both timeouts are called');
+ });
+};
+
+
+Asserts that the given val is null.
+ +assert.isNull(null);
+
+
+Asserts that the given val is not null.
+ +assert.isNotNull(undefined);
+assert.isNotNull(false);
+
+
+Asserts that the given val is undefined.
+ +assert.isUndefined(undefined);
+
+
+Asserts that the given val is not undefined.
+ +assert.isDefined(null);
+assert.isDefined(false);
+
+
+Asserts that the given str matches regexp.
+ +assert.match('foobar', /^foo(bar)?/);
+assert.match('foo', /^foo(bar)?/);
+
+
+Assert that the given val has a length of n.
+ +assert.length([1,2,3], 3);
+assert.length('foo', 3);
+
+
+Assert that the given obj is typeof type.
+ +assert.type(3, 'number');
+
+
+Assert that object b is equal to object a. This is an +alias for the core assert.deepEqual() method which does complex +comparisons, opposed to assert.equal() which uses ==.
+ +assert.eql('foo', 'foo');
+assert.eql([1,2], [1,2]);
+assert.eql({ foo: 'bar' }, { foo: 'bar' });
+
+
+Assert that obj is within val. This method supports Array_s +and Strings_s.
+ +assert.includes([1,2,3], 3);
+assert.includes('foobar', 'foo');
+assert.includes('foobar', 'bar');
+
+
+Performs assertions on the given server, which should not call +listen(), as this is handled internally by expresso and the server +is killed after all responses have completed. This method works with +any http.Server instance, so Connect and Express servers will work +as well.
+ +The req object may contain:
+ +The res object may be a callback function which +receives the response for assertions, or an object +which is then used to perform several assertions +on the response with the following properties:
+ +When providing res you may then also pass a callback function +as the fourth argument for additional assertions.
+ +Below are some examples:
+ +assert.response(server, {
+ url: '/', timeout: 500
+}, {
+ body: 'foobar'
+});
+
+assert.response(server, {
+ url: '/',
+ method: 'GET'
+},{
+ body: '{"name":"tj"}',
+ status: 200,
+ headers: {
+ 'Content-Type': 'application/json; charset=utf8',
+ 'X-Foo': 'bar'
+ }
+});
+
+assert.response(server, {
+ url: '/foo',
+ method: 'POST',
+ data: 'bar baz'
+},{
+ body: '/foo bar baz',
+ status: 200
+}, 'Test POST');
+
+assert.response(server, {
+ url: '/foo',
+ method: 'POST',
+ data: 'bar baz'
+},{
+ body: '/foo bar baz',
+ status: 200
+}, function(res){
+ // All done, do some more tests if needed
+});
+
+assert.response(server, {
+ url: '/'
+}, function(res){
+ assert.ok(res.body.indexOf('tj') >= 0, 'Test assert.response() callback');
+});
+
+
+To run a single test suite (file) run:
+ +$ expresso test/a.test.js
+
+
+To run several suites we may simply append another:
+ +$ expresso test/a.test.js test/b.test.js
+
+
+We can also pass a whitelist of tests to run within all suites:
+ +$ expresso --only "foo()" --only "bar()"
+
+
+Or several with one call:
+ +$ expresso --only "foo(), bar()"
+
+
+Globbing is of course possible as well:
+ +$ expresso test/*
+
+
+When expresso is called without any files, test/* is the default, +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, +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 :)
+ + + +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 +run the same tests, however one will auto-instrument, and unshift lib-cov, +and the other will run tests normally:
+ +$ expresso -I lib test/*
+$ expresso -I lib --cov test/*
+
+
+Currently coverage is bound to the lib directory, however in the
+future --cov
will most likely accept a path.
Sometimes it is useful to postpone running of tests until a callback or event has fired, currently the exports.foo = function(){}; syntax is supported for this:
+ +setTimeout(function(){
+ exports['test async exports'] = function(){
+ assert.ok('wahoo');
+ };
+}, 100);
+
+
+