Skip to content
Browse files

Removed qs; included in express/node_modules

  • Loading branch information...
1 parent 75cc3cd commit d354b0b81a133d0a856cb791453035f2af553f11 @bbyars committed Jun 11, 2011
Showing with 0 additions and 5,055 deletions.
  1. +0 −6 server/deps/qs/.gitmodules
  2. +0 −36 server/deps/qs/History.md
  3. +0 −7 server/deps/qs/Makefile
  4. +0 −38 server/deps/qs/Readme.md
  5. +0 −32 server/deps/qs/benchmark.js
  6. +0 −39 server/deps/qs/examples.js
  7. +0 −2 server/deps/qs/index.js
  8. +0 −123 server/deps/qs/lib/querystring.js
  9. +0 −9 server/deps/qs/package.json
  10. +0 −3 server/deps/qs/support/expresso/.gitignore
  11. +0 −3 server/deps/qs/support/expresso/.gitmodules
  12. +0 −128 server/deps/qs/support/expresso/History.md
  13. +0 −53 server/deps/qs/support/expresso/Makefile
  14. +0 −61 server/deps/qs/support/expresso/Readme.md
  15. +0 −856 server/deps/qs/support/expresso/bin/expresso
  16. +0 −1,080 server/deps/qs/support/expresso/docs/api.html
  17. +0 −377 server/deps/qs/support/expresso/docs/index.html
  18. +0 −290 server/deps/qs/support/expresso/docs/index.md
  19. +0 −3 server/deps/qs/support/expresso/docs/layout/foot.html
  20. +0 −42 server/deps/qs/support/expresso/docs/layout/head.html
  21. +0 −4 server/deps/qs/support/expresso/lib/bar.js
  22. +0 −16 server/deps/qs/support/expresso/lib/foo.js
  23. +0 −12 server/deps/qs/support/expresso/package.json
  24. +0 −91 server/deps/qs/support/expresso/test/assert.test.js
  25. +0 −12 server/deps/qs/support/expresso/test/async.test.js
  26. +0 −13 server/deps/qs/support/expresso/test/bar.test.js
  27. +0 −14 server/deps/qs/support/expresso/test/foo.test.js
  28. +0 −146 server/deps/qs/support/expresso/test/http.test.js
  29. +0 −39 server/deps/qs/support/expresso/test/serial/async.test.js
  30. +0 −48 server/deps/qs/support/expresso/test/serial/http.test.js
  31. +0 −3 server/deps/qs/support/should/.gitmodules
  32. +0 −22 server/deps/qs/support/should/History.md
  33. +0 −6 server/deps/qs/support/should/Makefile
  34. +0 −248 server/deps/qs/support/should/Readme.md
  35. +0 −53 server/deps/qs/support/should/examples/runner.js
  36. +0 −2 server/deps/qs/support/should/index.js
  37. +0 −91 server/deps/qs/support/should/lib/eql.js
  38. +0 −548 server/deps/qs/support/should/lib/should.js
  39. +0 −8 server/deps/qs/support/should/package.json
  40. +0 −358 server/deps/qs/support/should/test/should.test.js
  41. +0 −133 server/deps/qs/test/querystring.test.js
View
6 server/deps/qs/.gitmodules
@@ -1,6 +0,0 @@
-[submodule "support/expresso"]
- path = support/expresso
- url = git://github.com/visionmedia/expresso.git
-[submodule "support/should"]
- path = support/should
- url = git://github.com/visionmedia/should.js.git
View
36 server/deps/qs/History.md
@@ -1,36 +0,0 @@
-
-0.1.0 / 2011-04-13
-==================
-
- * Added jQuery-ish array support
-
-0.0.7 / 2011-03-13
-==================
-
- * Fixed; handle empty string and `== null` in `qs.parse()` [dmit]
- allows for convenient `qs.parse(url.parse(str).query)`
-
-0.0.6 / 2011-02-14
-==================
-
- * Fixed; support for implicit arrays
-
-0.0.4 / 2011-02-09
-==================
-
- * Fixed `+` as a space
-
-0.0.3 / 2011-02-08
-==================
-
- * Fixed case when right-hand value contains "]"
-
-0.0.2 / 2011-02-07
-==================
-
- * Fixed "=" presence in key
-
-0.0.1 / 2011-02-07
-==================
-
- * Initial release
View
7 server/deps/qs/Makefile
@@ -1,7 +0,0 @@
-
-test:
- @./support/expresso/bin/expresso \
- -I support \
- -I lib
-
-.PHONY: test
View
38 server/deps/qs/Readme.md
@@ -1,38 +0,0 @@
-
-# node-querystring
-
- query string parser for node supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.
-
-## Installation
-
- $ npm install qs
-
-## Examples
-
- require('querystring').parse('user[name][first]=tj&user[email]=tj');
- // => { user: { name: { first: 'tj' }}}
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
32 server/deps/qs/benchmark.js
@@ -1,32 +0,0 @@
-
-var old = require('querystring')
- , qs = require('./')
- , times = 100000;
-
-var start = new Date
- , n = times;
-
-while (n--) old.parse('foo=bar');
-console.log('old simple: %dms', new Date - start);
-
-var start = new Date
- , n = times;
-
-while (n--) old.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log('old nested: %dms', new Date - start);
-
-
-console.log();
-
-
-var start = new Date
- , n = times;
-
-while (n--) qs.parse('foo=bar');
-console.log('new simple: %dms', new Date - start);
-
-var start = new Date
- , n = times;
-
-while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log('new nested: %dms', new Date - start);
View
39 server/deps/qs/examples.js
@@ -1,39 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var qs = require('./');
-
-var obj = qs.parse('foo');
-require('inspect')(obj)
-
-var obj = qs.parse('foo=bar=baz');
-require('inspect')(obj)
-
-var obj = qs.parse('users[]');
-require('inspect')(obj)
-
-var obj = qs.parse('name=tj&email=tj@vision-media.ca');
-require('inspect')(obj)
-
-var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane');
-require('inspect')(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-require('inspect')(obj)
-
-var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk');
-require('inspect')(obj)
-
-var obj = qs.parse('a=a&a=b&a=c');
-require('inspect')(obj)
-
-var obj = qs.parse('user[tj]=tj&user[tj]=TJ');
-require('inspect')(obj)
-
-var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler');
-require('inspect')(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ');
-require('inspect')(obj)
View
2 server/deps/qs/index.js
@@ -1,2 +0,0 @@
-
-module.exports = require('./lib/querystring');
View
123 server/deps/qs/lib/querystring.js
@@ -1,123 +0,0 @@
-
-/*!
- * querystring
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Library version.
- */
-
-exports.version = '0.1.0';
-
-/**
- * Parse the given query `str`, returning an object.
- *
- * @param {String} str
- * @return {Object}
- * @api public
- */
-
-exports.parse = function(str) {
- if (str == undefined || str == '') return {};
-
- return String(str)
- .split('&')
- .reduce(function(ret, pair){
- var pair = decodeURIComponent(pair.replace(/\+/g, ' '))
- , eql = pair.indexOf('=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(val.indexOf('=') + 1, val.length)
- , obj = ret;
-
- // ?foo
- if ('' == key) key = pair, val = '';
-
- // nested
- if (~key.indexOf(']')) {
- var parts = key.split('[')
- , len = parts.length
- , last = len - 1;
-
- function parse(obj, parts, parent, key) {
- var part = parts.shift();
-
- // end
- if (!part) {
- if (Array.isArray(parent[key])) {
- parent[key].push(val);
- } else if ('object' == typeof parent[key]) {
- parent[key] = val;
- } else {
- parent[key] = [parent[key], val];
- }
- // array
- } else if (']' == part) {
- obj = parent[key] = Array.isArray(parent[key])
- ? parent[key]
- : [];
- if ('' != val) obj.push(val);
- // prop
- } else if (~part.indexOf(']')) {
- part = part.substr(0, part.length - 1);
- parse(obj[part] = obj[part] || {}, parts, obj, part);
- // key
- } else {
- parse(obj[part] = obj[part] || {}, parts, obj, part);
- }
- }
-
- parse(obj, parts);
- // optimize
- } else {
- set(obj, key, val);
- }
-
- return ret;
- }, {});
-};
-
-/**
- * Set `obj`'s `key` to `val` respecting
- * the weird and wonderful syntax of a qs,
- * where "foo=bar&foo=baz" becomes an array.
- *
- * @param {Object} obj
- * @param {String} key
- * @param {String} val
- * @api private
- */
-
-function set(obj, key, val) {
- var v = obj[key];
- if (undefined === v) {
- obj[key] = val;
- } else if (Array.isArray(v)) {
- v.push(val);
- } else {
- obj[key] = [v, val];
- }
-}
-
-/**
- * Locate last brace in `str` within the key.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function lastBraceInKey(str) {
- var len = str.length
- , brace
- , c;
- for (var i = 0; i < len; ++i) {
- c = str[i];
- if (']' == c) brace = false;
- if ('[' == c) brace = true;
- if ('=' == c && !brace) return i;
- }
-}
View
9 server/deps/qs/package.json
@@ -1,9 +0,0 @@
-{
- "name": "qs",
- "description": "querystring parser",
- "version": "0.1.0",
- "repository": {},
- "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
- "main": "index",
- "engines": { "node": "*" }
-}
View
3 server/deps/qs/support/expresso/.gitignore
@@ -1,3 +0,0 @@
-.DS_Store
-lib-cov
-*.seed
View
3 server/deps/qs/support/expresso/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "deps/jscoverage"]
- path = deps/jscoverage
- url = git://github.com/visionmedia/node-jscoverage.git
View
128 server/deps/qs/support/expresso/History.md
@@ -1,128 +0,0 @@
-
-0.7.2 / 2010-12-29
-==================
-
- * Fixed problem with `listen()` sometimes firing on the same tick [guillermo]
-
-0.7.1 / 2010-12-28
-==================
-
- * Fixed `assert.request()` client logic into an issue() function, fired upon the `listen()` callback if the server doesn't have an assigned fd. [guillermo]
- * Removed `--watch`
-
-0.7.0 / 2010-11-19
-==================
-
- * Removed `assert` from test function signature
- Just use `require('assert')` :) this will make integration
- with libraries like [should](http://github.com/visionmedia/should) cleaner.
-
-0.6.4 / 2010-11-02
-==================
-
- * Added regexp support to `assert.response()` headers
- * Removed `waitForExit` code, causing issues
-
-0.6.3 / 2010-11-02
-==================
-
- * Added `assert.response()` body RegExp support
- * Fixed issue with _--serial_ not executing files sequentially. Closes #42
- * Fixed hang when modules use `setInterval` - monitor running tests & force the process to quit after all have completed + timeout [Steve Mason]
-
-0.6.2 / 2010-09-17
-==================
-
- * Added _node-jsocoverage_ to package.json (aka will respect npm's binroot)
- * Added _-t, --timeout_ MS option, defaulting to 2000 ms
- * Added _-s, --serial_
- * __PREFIX__ clobberable
- * Fixed `assert.response()` for latest node
- * Fixed cov reporting from exploding on empty files
-
-0.6.2 / 2010-08-03
-==================
-
- * Added `assert.type()`
- * Renamed `assert.isNotUndefined()` to `assert.isDefined()`
- * Fixed `assert.includes()` param ordering
-
-0.6.0 / 2010-07-31
-==================
-
- * Added _docs/api.html_
- * Added -w, --watch
- * Added `Array` support to `assert.includes()`
- * Added; outputting exceptions immediately. Closes #19
- * Fixed `assert.includes()` param ordering
- * Fixed `assert.length()` param ordering
- * Fixed jscoverage links
-
-0.5.0 / 2010-07-16
-==================
-
- * Added support for async exports
- * Added timeout support to `assert.response()`. Closes #3
- * Added 4th arg callback support to `assert.response()`
- * Added `assert.length()`
- * Added `assert.match()`
- * Added `assert.isUndefined()`
- * Added `assert.isNull()`
- * Added `assert.includes()`
- * Added growlnotify support via -g, --growl
- * Added -o, --only TESTS. Ex: --only "test foo()" --only "test foo(), test bar()"
- * Removed profanity
-
-0.4.0 / 2010-07-09
-==================
-
- * Added reporting source coverage (respects --boring for color haters)
- * Added callback to assert.response(). Closes #12
- * Fixed; putting exceptions to stderr. Closes #13
-
-0.3.1 / 2010-06-28
-==================
-
- * Faster assert.response()
-
-0.3.0 / 2010-06-28
-==================
-
- * Added -p, --port NUM flags
- * Added assert.response(). Closes #11
-
-0.2.1 / 2010-06-25
-==================
-
- * Fixed issue with reporting object assertions
-
-0.2.0 / 2010-06-21
-==================
-
- * Added `make uninstall`
- * Added better readdir() failure message
- * Fixed `make install` for kiwi
-
-0.1.0 / 2010-06-15
-==================
-
- * Added better usage docs via --help
- * Added better conditional color support
- * Added pre exit assertion support
-
-0.0.3 / 2010-06-02
-==================
-
- * Added more room for filenames in test coverage
- * Added boring output support via --boring (suppress colored output)
- * Fixed async failure exit status
-
-0.0.2 / 2010-05-30
-==================
-
- * Fixed exit status for CI support
-
-0.0.1 / 2010-05-30
-==================
-
- * Initial release
View
53 server/deps/qs/support/expresso/Makefile
@@ -1,53 +0,0 @@
-
-PREFIX ?= /usr/local
-BIN = bin/expresso
-JSCOV = deps/jscoverage/node-jscoverage
-DOCS = docs/index.md
-HTMLDOCS = $(DOCS:.md=.html)
-
-test: $(BIN)
- @./$(BIN) -I lib --growl $(TEST_FLAGS) test/*.test.js
-
-test-cov:
- @./$(BIN) -I lib --cov $(TEST_FLAGS) test/*.test.js
-
-test-serial:
- @./$(BIN) --serial -I lib $(TEST_FLAGS) test/serial/*.test.js
-
-install: install-jscov install-expresso
-
-uninstall:
- rm -f $(PREFIX)/bin/expresso
- rm -f $(PREFIX)/bin/node-jscoverage
-
-install-jscov: $(JSCOV)
- install $(JSCOV) $(PREFIX)/bin
-
-install-expresso:
- install $(BIN) $(PREFIX)/bin
-
-$(JSCOV):
- cd deps/jscoverage && ./configure && make && mv jscoverage node-jscoverage
-
-clean:
- @cd deps/jscoverage && git clean -fd
-
-docs: docs/api.html $(HTMLDOCS)
-
-%.html: %.md
- @echo "... $< > $@"
- @ronn -5 --pipe --fragment $< \
- | cat docs/layout/head.html - docs/layout/foot.html \
- > $@
-
-docs/api.html: bin/expresso
- dox \
- --title "Expresso" \
- --ribbon "http://github.com/visionmedia/expresso" \
- --desc "Insanely fast TDD framework for [node](http://nodejs.org) featuring code coverage reporting." \
- $< > $@
-
-docclean:
- rm -f docs/*.html
-
-.PHONY: test test-cov install uninstall install-expresso install-jscov clean docs docclean
View
61 server/deps/qs/support/expresso/Readme.md
@@ -1,61 +0,0 @@
-
-# Expresso
-
- TDD framework for [nodejs](http://nodejs.org).
-
-## Features
-
- - light-weight
- - intuitive async support
- - intuitive test runner executable
- - test coverage support and reporting
- - uses the _assert_ module
- - `assert.eql()` alias of `assert.deepEqual()`
- - `assert.response()` http response utility
- - `assert.includes()`
- - `assert.type()`
- - `assert.isNull()`
- - `assert.isUndefined()`
- - `assert.isNotNull()`
- - `assert.isDefined()`
- - `assert.match()`
- - `assert.length()`
-
-## Installation
-
-To install both expresso _and_ node-jscoverage run:
-
- $ make install
-
-To install expresso alone (no build required) run:
-
- $ make install-expresso
-
-Install via npm:
-
- $ npm install expresso
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
856 server/deps/qs/support/expresso/bin/expresso
@@ -1,856 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * Expresso
- * Copyright(c) TJ Holowaychuk <tj@vision-media.ca>
- * (MIT Licensed)
- */
-
-/**
- * Module dependencies.
- */
-
-var assert = require('assert'),
- childProcess = require('child_process'),
- http = require('http'),
- path = require('path'),
- sys = require('sys'),
- cwd = process.cwd(),
- fs = require('fs'),
- defer;
-
-/**
- * Expresso version.
- */
-
-var version = '0.7.2';
-
-/**
- * Failure count.
- */
-
-var failures = 0;
-
-
-/**
- * Number of tests executed.
- */
-
-var testcount = 0;
-
-/**
- * Whitelist of tests to run.
- */
-
-var only = [];
-
-/**
- * Boring output.
- */
-
-var boring = false;
-
-/**
- * Growl notifications.
- */
-
-var growl = false;
-
-/**
- * Server port.
- */
-
-var port = 5555;
-
-/**
- * Execute serially.
- */
-
-var serial = false;
-
-/**
- * Default timeout.
- */
-
-var timeout = 2000;
-
-/**
- * Quiet output.
- */
-
-var quiet = false;
-
-/**
- * Usage documentation.
- */
-
-var usage = ''
- + '[bold]{Usage}: expresso [options] <file ...>'
- + '\n'
- + '\n[bold]{Options}:'
- + '\n -g, --growl Enable growl notifications'
- + '\n -c, --coverage Generate and report test coverage'
- + '\n -q, --quiet Suppress coverage report if 100%'
- + '\n -t, --timeout MS Timeout in milliseconds, defaults to 2000'
- + '\n -r, --require PATH Require the given module path'
- + '\n -o, --only TESTS Execute only the comma sperated TESTS (can be set several times)'
- + '\n -I, --include PATH Unshift the given path to require.paths'
- + '\n -p, --port NUM Port number for test servers, starts at 5555'
- + '\n -s, --serial Execute tests serially'
- + '\n -b, --boring Suppress ansi-escape colors'
- + '\n -v, --version Output version number'
- + '\n -h, --help Display help information'
- + '\n';
-
-// Parse arguments
-
-var files = [],
- args = process.argv.slice(2);
-
-while (args.length) {
- var arg = args.shift();
- switch (arg) {
- case '-h':
- case '--help':
- print(usage + '\n');
- process.exit(1);
- break;
- case '-v':
- case '--version':
- sys.puts(version);
- process.exit(1);
- break;
- case '-i':
- case '-I':
- case '--include':
- if (arg = args.shift()) {
- require.paths.unshift(arg);
- } else {
- throw new Error('--include requires a path');
- }
- break;
- case '-o':
- case '--only':
- if (arg = args.shift()) {
- only = only.concat(arg.split(/ *, */));
- } else {
- throw new Error('--only requires comma-separated test names');
- }
- break;
- case '-p':
- case '--port':
- if (arg = args.shift()) {
- port = parseInt(arg, 10);
- } else {
- throw new Error('--port requires a number');
- }
- break;
- case '-r':
- case '--require':
- if (arg = args.shift()) {
- require(arg);
- } else {
- throw new Error('--require requires a path');
- }
- break;
- case '-t':
- case '--timeout':
- if (arg = args.shift()) {
- timeout = parseInt(arg, 10);
- } else {
- throw new Error('--timeout requires an argument');
- }
- break;
- case '-c':
- case '--cov':
- case '--coverage':
- defer = true;
- childProcess.exec('rm -fr lib-cov && node-jscoverage lib lib-cov', function(err){
- if (err) throw err;
- require.paths.unshift('lib-cov');
- run(files);
- })
- break;
- case '-q':
- case '--quiet':
- quiet = true;
- break;
- case '-b':
- case '--boring':
- boring = true;
- break;
- case '-g':
- case '--growl':
- growl = true;
- break;
- case '-s':
- case '--serial':
- serial = true;
- break;
- default:
- if (/\.js$/.test(arg)) {
- files.push(arg);
- }
- break;
- }
-}
-
-/**
- * Colorized sys.error().
- *
- * @param {String} str
- */
-
-function print(str){
- sys.error(colorize(str));
-}
-
-/**
- * Colorize the given string using ansi-escape sequences.
- * Disabled when --boring is set.
- *
- * @param {String} str
- * @return {String}
- */
-
-function colorize(str){
- var colors = { bold: 1, red: 31, green: 32, yellow: 33 };
- return str.replace(/\[(\w+)\]\{([^]*?)\}/g, function(_, color, str){
- return boring
- ? str
- : '\x1B[' + colors[color] + 'm' + str + '\x1B[0m';
- });
-}
-
-// Alias deepEqual as eql for complex equality
-
-assert.eql = assert.deepEqual;
-
-/**
- * Assert that `val` is null.
- *
- * @param {Mixed} val
- * @param {String} msg
- */
-
-assert.isNull = function(val, msg) {
- assert.strictEqual(null, val, msg);
-};
-
-/**
- * Assert that `val` is not null.
- *
- * @param {Mixed} val
- * @param {String} msg
- */
-
-assert.isNotNull = function(val, msg) {
- assert.notStrictEqual(null, val, msg);
-};
-
-/**
- * Assert that `val` is undefined.
- *
- * @param {Mixed} val
- * @param {String} msg
- */
-
-assert.isUndefined = function(val, msg) {
- assert.strictEqual(undefined, val, msg);
-};
-
-/**
- * Assert that `val` is not undefined.
- *
- * @param {Mixed} val
- * @param {String} msg
- */
-
-assert.isDefined = function(val, msg) {
- assert.notStrictEqual(undefined, val, msg);
-};
-
-/**
- * Assert that `obj` is `type`.
- *
- * @param {Mixed} obj
- * @param {String} type
- * @api public
- */
-
-assert.type = function(obj, type, msg){
- var real = typeof obj;
- msg = msg || 'typeof ' + sys.inspect(obj) + ' is ' + real + ', expected ' + type;
- assert.ok(type === real, msg);
-};
-
-/**
- * Assert that `str` matches `regexp`.
- *
- * @param {String} str
- * @param {RegExp} regexp
- * @param {String} msg
- */
-
-assert.match = function(str, regexp, msg) {
- msg = msg || sys.inspect(str) + ' does not match ' + sys.inspect(regexp);
- assert.ok(regexp.test(str), msg);
-};
-
-/**
- * Assert that `val` is within `obj`.
- *
- * Examples:
- *
- * assert.includes('foobar', 'bar');
- * assert.includes(['foo', 'bar'], 'foo');
- *
- * @param {String|Array} obj
- * @param {Mixed} val
- * @param {String} msg
- */
-
-assert.includes = function(obj, val, msg) {
- msg = msg || sys.inspect(obj) + ' does not include ' + sys.inspect(val);
- assert.ok(obj.indexOf(val) >= 0, msg);
-};
-
-/**
- * Assert length of `val` is `n`.
- *
- * @param {Mixed} val
- * @param {Number} n
- * @param {String} msg
- */
-
-assert.length = function(val, n, msg) {
- msg = msg || sys.inspect(val) + ' has length of ' + val.length + ', expected ' + n;
- assert.equal(n, val.length, msg);
-};
-
-/**
- * Assert response from `server` with
- * the given `req` object and `res` assertions object.
- *
- * @param {Server} server
- * @param {Object} req
- * @param {Object|Function} res
- * @param {String} msg
- */
-
-assert.response = function(server, req, res, msg){
- // Check that the server is ready or defer
- if (!server.fd) {
- if (!('__deferred' in server)) {
- server.__deferred = [];
- }
- server.__deferred.push(arguments);
- if (!server.__started) {
- server.listen(server.__port = port++, '127.0.0.1', function(){
- if (server.__deferred) {
- process.nextTick(function(){
- server.__deferred.forEach(function(args){
- assert.response.apply(assert, args);
- });
- });
- }
- });
- server.__started = true;
- }
- return;
- }
-
- // Callback as third or fourth arg
- var callback = typeof res === 'function'
- ? res
- : typeof msg === 'function'
- ? msg
- : function(){};
-
- // Default messate to test title
- if (typeof msg === 'function') msg = null;
- msg = msg || assert.testTitle;
- msg += '. ';
-
- // Pending responses
- server.__pending = server.__pending || 0;
- server.__pending++;
-
- // Create client
- if (!server.fd) {
- server.listen(server.__port = port++, '127.0.0.1', issue);
- } else {
- issue();
- }
-
- function issue(){
- if (!server.client)
- server.client = http.createClient(server.__port);
-
- // Issue request
- var timer,
- client = server.client,
- method = req.method || 'GET',
- status = res.status || res.statusCode,
- data = req.data || req.body,
- requestTimeout = req.timeout || 0;
-
- var request = client.request(method, req.url, req.headers);
-
- // Timeout
- if (requestTimeout) {
- timer = setTimeout(function(){
- --server.__pending || server.close();
- delete req.timeout;
- assert.fail(msg + 'Request timed out after ' + requestTimeout + 'ms.');
- }, requestTimeout);
- }
-
- if (data) request.write(data);
- request.on('response', function(response){
- response.body = '';
- response.setEncoding('utf8');
- response.on('data', function(chunk){ response.body += chunk; });
- response.on('end', function(){
- --server.__pending || server.close();
- if (timer) clearTimeout(timer);
-
- // Assert response body
- if (res.body !== undefined) {
- var eql = res.body instanceof RegExp
- ? res.body.test(response.body)
- : res.body === response.body;
- assert.ok(
- eql,
- msg + 'Invalid response body.\n'
- + ' Expected: ' + sys.inspect(res.body) + '\n'
- + ' Got: ' + sys.inspect(response.body)
- );
- }
-
- // Assert response status
- if (typeof status === 'number') {
- assert.equal(
- response.statusCode,
- status,
- msg + colorize('Invalid response status code.\n'
- + ' Expected: [green]{' + status + '}\n'
- + ' Got: [red]{' + response.statusCode + '}')
- );
- }
-
- // Assert response headers
- if (res.headers) {
- var keys = Object.keys(res.headers);
- for (var i = 0, len = keys.length; i < len; ++i) {
- var name = keys[i],
- actual = response.headers[name.toLowerCase()],
- expected = res.headers[name],
- eql = expected instanceof RegExp
- ? expected.test(actual)
- : expected == actual;
- assert.ok(
- eql,
- msg + colorize('Invalid response header [bold]{' + name + '}.\n'
- + ' Expected: [green]{' + expected + '}\n'
- + ' Got: [red]{' + actual + '}')
- );
- }
- }
-
- // Callback
- callback(response);
- });
- });
- request.end();
- }
-};
-
-/**
- * Pad the given string to the maximum width provided.
- *
- * @param {String} str
- * @param {Number} width
- * @return {String}
- */
-
-function lpad(str, width) {
- str = String(str);
- var n = width - str.length;
- if (n < 1) return str;
- while (n--) str = ' ' + str;
- return str;
-}
-
-/**
- * Pad the given string to the maximum width provided.
- *
- * @param {String} str
- * @param {Number} width
- * @return {String}
- */
-
-function rpad(str, width) {
- str = String(str);
- var n = width - str.length;
- if (n < 1) return str;
- while (n--) str = str + ' ';
- return str;
-}
-
-/**
- * Report test coverage.
- *
- * @param {Object} cov
- */
-
-function reportCoverage(cov) {
- // Stats
- print('\n [bold]{Test Coverage}\n');
- var sep = ' +------------------------------------------+----------+------+------+--------+',
- lastSep = ' +----------+------+------+--------+';
- sys.puts(sep);
- sys.puts(' | filename | coverage | LOC | SLOC | missed |');
- sys.puts(sep);
- for (var name in cov) {
- var file = cov[name];
- if (Array.isArray(file)) {
- sys.print(' | ' + rpad(name, 40));
- sys.print(' | ' + lpad(file.coverage.toFixed(2), 8));
- sys.print(' | ' + lpad(file.LOC, 4));
- sys.print(' | ' + lpad(file.SLOC, 4));
- sys.print(' | ' + lpad(file.totalMisses, 6));
- sys.print(' |\n');
- }
- }
- sys.puts(sep);
- sys.print(' ' + rpad('', 40));
- sys.print(' | ' + lpad(cov.coverage.toFixed(2), 8));
- sys.print(' | ' + lpad(cov.LOC, 4));
- sys.print(' | ' + lpad(cov.SLOC, 4));
- sys.print(' | ' + lpad(cov.totalMisses, 6));
- sys.print(' |\n');
- sys.puts(lastSep);
- // Source
- for (var name in cov) {
- if (name.match(/\.js$/)) {
- var file = cov[name];
- if ((file.coverage < 100) || !quiet) {
- print('\n [bold]{' + name + '}:');
- print(file.source);
- sys.print('\n');
- }
- }
- }
-}
-
-/**
- * Populate code coverage data.
- *
- * @param {Object} cov
- */
-
-function populateCoverage(cov) {
- cov.LOC =
- cov.SLOC =
- cov.totalFiles =
- cov.totalHits =
- cov.totalMisses =
- cov.coverage = 0;
- for (var name in cov) {
- var file = cov[name];
- if (Array.isArray(file)) {
- // Stats
- ++cov.totalFiles;
- cov.totalHits += file.totalHits = coverage(file, true);
- cov.totalMisses += file.totalMisses = coverage(file, false);
- file.totalLines = file.totalHits + file.totalMisses;
- cov.SLOC += file.SLOC = file.totalLines;
- if (!file.source) file.source = [];
- cov.LOC += file.LOC = file.source.length;
- file.coverage = (file.totalHits / file.totalLines) * 100;
- // Source
- var width = file.source.length.toString().length;
- file.source = file.source.map(function(line, i){
- ++i;
- var hits = file[i] === 0 ? 0 : (file[i] || ' ');
- if (!boring) {
- if (hits === 0) {
- hits = '\x1b[31m' + hits + '\x1b[0m';
- line = '\x1b[41m' + line + '\x1b[0m';
- } else {
- hits = '\x1b[32m' + hits + '\x1b[0m';
- }
- }
- return '\n ' + lpad(i, width) + ' | ' + hits + ' | ' + line;
- }).join('');
- }
- }
- cov.coverage = (cov.totalHits / cov.SLOC) * 100;
-}
-
-/**
- * Total coverage for the given file data.
- *
- * @param {Array} data
- * @return {Type}
- */
-
-function coverage(data, val) {
- var n = 0;
- for (var i = 0, len = data.length; i < len; ++i) {
- if (data[i] !== undefined && data[i] == val) ++n;
- }
- return n;
-}
-
-/**
- * Test if all files have 100% coverage
- *
- * @param {Object} cov
- * @return {Boolean}
- */
-
-function hasFullCoverage(cov) {
- for (var name in cov) {
- var file = cov[name];
- if (file instanceof Array) {
- if (file.coverage !== 100) {
- return false;
- }
- }
- }
- return true;
-}
-
-/**
- * Run the given test `files`, or try _test/*_.
- *
- * @param {Array} files
- */
-
-function run(files) {
- cursor(false);
- if (!files.length) {
- try {
- files = fs.readdirSync('test').map(function(file){
- return 'test/' + file;
- });
- } catch (err) {
- print('\n failed to load tests in [bold]{./test}\n');
- ++failures;
- process.exit(1);
- }
- }
- runFiles(files);
-}
-
-/**
- * Show the cursor when `show` is true, otherwise hide it.
- *
- * @param {Boolean} show
- */
-
-function cursor(show) {
- if (show) {
- sys.print('\x1b[?25h');
- } else {
- sys.print('\x1b[?25l');
- }
-}
-
-/**
- * Run the given test `files`.
- *
- * @param {Array} files
- */
-
-function runFiles(files) {
- if (serial) {
- (function next(){
- if (files.length) {
- runFile(files.shift(), next);
- }
- })();
- } else {
- files.forEach(runFile);
- }
-}
-
-/**
- * Run tests for the given `file`, callback `fn()` when finished.
- *
- * @param {String} file
- * @param {Function} fn
- */
-
-function runFile(file, fn) {
- if (file.match(/\.js$/)) {
- var title = path.basename(file),
- file = path.join(cwd, file),
- mod = require(file.replace(/\.js$/, ''));
- (function check(){
- var len = Object.keys(mod).length;
- if (len) {
- runSuite(title, mod, fn);
- } else {
- setTimeout(check, 20);
- }
- })();
- }
-}
-
-/**
- * Report `err` for the given `test` and `suite`.
- *
- * @param {String} suite
- * @param {String} test
- * @param {Error} err
- */
-
-function error(suite, test, err) {
- ++failures;
- var name = err.name,
- stack = err.stack ? err.stack.replace(err.name, '') : '',
- label = test === 'uncaught'
- ? test
- : suite + ' ' + test;
- print('\n [bold]{' + label + '}: [red]{' + name + '}' + stack + '\n');
-}
-
-/**
- * Run the given tests, callback `fn()` when finished.
- *
- * @param {String} title
- * @param {Object} tests
- * @param {Function} fn
- */
-
-var dots = 0;
-function runSuite(title, tests, fn) {
- // Keys
- var keys = only.length
- ? only.slice(0)
- : Object.keys(tests);
-
- // Setup
- var setup = tests.setup || function(fn){ fn(); };
-
- // Iterate tests
- (function next(){
- if (keys.length) {
- var key,
- test = tests[key = keys.shift()];
- // Non-tests
- if (key === 'setup') return next();
-
- // Run test
- if (test) {
- try {
- ++testcount;
- assert.testTitle = key;
- if (serial) {
- sys.print('.');
- if (++dots % 25 === 0) sys.print('\n');
- setup(function(){
- if (test.length < 1) {
- test();
- next();
- } else {
- var id = setTimeout(function(){
- throw new Error("'" + key + "' timed out");
- }, timeout);
- test(function(){
- clearTimeout(id);
- next();
- });
- }
- });
- } else {
- test(function(fn){
- process.on('beforeExit', function(){
- try {
- fn();
- } catch (err) {
- error(title, key, err);
- }
- });
- });
- }
- } catch (err) {
- error(title, key, err);
- }
- }
- if (!serial) next();
- } else if (serial) {
- fn();
- }
- })();
-}
-
-/**
- * Report exceptions.
- */
-
-function report() {
- cursor(true);
- process.emit('beforeExit');
- if (failures) {
- print('\n [bold]{Failures}: [red]{' + failures + '}\n\n');
- notify('Failures: ' + failures);
- } else {
- if (serial) print('');
- print('\n [green]{100%} ' + testcount + ' tests\n');
- notify('100% ok');
- }
- if (typeof _$jscoverage === 'object') {
- populateCoverage(_$jscoverage);
- if (!hasFullCoverage(_$jscoverage) || !quiet) {
- reportCoverage(_$jscoverage);
- }
- }
-}
-
-/**
- * Growl notify the given `msg`.
- *
- * @param {String} msg
- */
-
-function notify(msg) {
- if (growl) {
- childProcess.exec('growlnotify -name Expresso -m "' + msg + '"');
- }
-}
-
-// Report uncaught exceptions
-
-process.on('uncaughtException', function(err){
- error('uncaught', 'uncaught', err);
-});
-
-// Show cursor
-
-['INT', 'TERM', 'QUIT'].forEach(function(sig){
- process.on('SIG' + sig, function(){
- cursor(true);
- process.exit(1);
- });
-});
-
-// Report test coverage when available
-// and emit "beforeExit" event to perform
-// final assertions
-
-var orig = process.emit;
-process.emit = function(event){
- if (event === 'exit') {
- report();
- process.reallyExit(failures);
- }
- orig.apply(this, arguments);
-};
-
-// Run test files
-
-if (!defer) run(files);
View
1,080 server/deps/qs/support/expresso/docs/api.html
@@ -1,1080 +0,0 @@
-<a href="http://github.com/visionmedia/expresso"><img alt="Fork me on GitHub" id="ribbon" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a><html>
- <head>
- <title>Expresso</title>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
- <style>body {
- margin: 0;
- padding: 0;
- font: 14px/1.5 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
- color: #252519;
-}
-a {
- color: #252519;
-}
-a:hover {
- text-decoration: underline;
- color: #19469D;
-}
-p {
- margin: 12px 0;
-}
-h1, h2, h3 {
- margin: 0;
- padding: 0;
-}
-table#source {
- width: 100%;
- border-collapse: collapse;
-}
-table#source td:first-child {
- padding: 30px 40px 30px 40px;
- vertical-align: top;
-}
-table#source td:first-child,
-table#source td:first-child pre {
- width: 450px;
-}
-table#source td:last-child {
- padding: 30px 0 30px 40px;
- border-left: 1px solid #E5E5EE;
- background: #F5F5FF;
-}
-table#source tr {
- border-bottom: 1px solid #E5E5EE;
-}
-table#source tr.filename {
- padding-top: 40px;
- border-top: 1px solid #E5E5EE;
-}
-table#source tr.filename td:first-child {
- text-transform: capitalize;
-}
-table#source tr.filename td:last-child {
- font-size: 12px;
-}
-table#source tr.filename h2 {
- margin: 0;
- padding: 0;
- cursor: pointer;
-}
-table#source tr.code h1,
-table#source tr.code h2,
-table#source tr.code h3 {
- margin-top: 30px;
- font-family: "Lucida Grande", "Helvetica Nueue", Arial, sans-serif;
- font-size: 18px;
-}
-table#source tr.code h2 {
- font-size: 16px;
-}
-table#source tr.code h3 {
- font-size: 14px;
-}
-table#source tr.code ul {
- margin: 15px 0 15px 35px;
- padding: 0;
-}
-table#source tr.code ul li {
- margin: 0;
- padding: 1px 0;
-}
-table#source tr.code ul li p {
- margin: 0;
- padding: 0;
-}
-table#source tr.code td:first-child pre {
- padding: 20px;
-}
-#ribbon {
- position: fixed;
- top: 0;
- right: 0;
-}
-code .string { color: #219161; }
-code .regexp { color: #219161; }
-code .keyword { color: #954121; }
-code .number { color: #19469D; }
-code .comment { color: #bbb; }
-code .this { color: #19469D; }</style>
- <script>
- $(function(){
- $('tr.code').hide();
- $('tr.filename').toggle(function(){
- $(this).nextUntil('.filename').fadeIn();
- }, function(){
- $(this).nextUntil('.filename').fadeOut();
- });
- });
- </script>
- </head>
- <body>
-<table id="source"><tbody><tr><td><h1>Expresso</h1><p>Insanely fast TDD framework for <a href="http://nodejs.org">node</a> featuring code coverage reporting.</p></td><td></td></tr><tr class="filename"><td><h2 id="bin/expresso"><a href="#">expresso</a></h2></td><td>bin/expresso</td></tr><tr class="code">
-<td class="docs">
-<h1>!/usr/bin/env node</h1>
-</td>
-<td class="code">
-<pre><code>
- * <span class="class">Expresso</span>
- * <span class="class">Copyright</span>(<span class="variable">c</span>) <span class="class">TJ</span> <span class="class">Holowaychuk</span> &<span class="variable">lt</span>;<span class="variable">tj</span>@<span class="variable">vision</span>-<span class="variable">media</span>.<span class="variable">ca</span>&<span class="variable">gt</span>;
- * (<span class="class">MIT</span> <span class="class">Licensed</span>)
- </code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Module dependencies.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">assert</span> = <span class="variable">require</span>(<span class="string">'assert'</span>),
- <span class="variable">childProcess</span> = <span class="variable">require</span>(<span class="string">'child_process'</span>),
- <span class="variable">http</span> = <span class="variable">require</span>(<span class="string">'http'</span>),
- <span class="variable">path</span> = <span class="variable">require</span>(<span class="string">'path'</span>),
- <span class="variable">sys</span> = <span class="variable">require</span>(<span class="string">'sys'</span>),
- <span class="variable">cwd</span> = <span class="variable">process</span>.<span class="variable">cwd</span>(),
- <span class="variable">fs</span> = <span class="variable">require</span>(<span class="string">'fs'</span>),
- <span class="variable">defer</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Expresso version.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">version</span> = <span class="string">'0.6.4'</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Failure count.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">failures</span> = <span class="number integer">0</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Number of tests executed.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">testcount</span> = <span class="number integer">0</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Whitelist of tests to run.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">only</span> = [];</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Boring output.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">boring</span> = <span class="variable">false</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Growl notifications.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">growl</span> = <span class="variable">false</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Server port.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">port</span> = <span class="number integer">5555</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Watch mode.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">watch</span> = <span class="variable">false</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Execute serially.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">serial</span> = <span class="variable">false</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Default timeout.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">timeout</span> = <span class="number integer">2000</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Usage documentation.
- </p>
-</td>
-<td class="code">
-<pre><code><span class="keyword">var</span> <span class="variable">usage</span> = <span class="string">''</span>
- + <span class="string">'[bold]{Usage}: expresso [options] &lt;file ...&gt;'</span>
- + <span class="string">'\n'</span>
- + <span class="string">'\n[bold]{Options}:'</span>
- + <span class="string">'\n -w, --watch Watch for modifications and re-execute tests'</span>
- + <span class="string">'\n -g, --growl Enable growl notifications'</span>
- + <span class="string">'\n -c, --coverage Generate and report test coverage'</span>
- + <span class="string">'\n -t, --timeout MS Timeout in milliseconds, defaults to 2000'</span>
- + <span class="string">'\n -r, --require PATH Require the given module path'</span>
- + <span class="string">'\n -o, --only TESTS Execute only the comma sperated TESTS (can be set several times)'</span>
- + <span class="string">'\n -I, --include PATH Unshift the given path to require.paths'</span>
- + <span class="string">'\n -p, --port NUM Port number for test servers, starts at 5555'</span>
- + <span class="string">'\n -s, --serial Execute tests serially'</span>
- + <span class="string">'\n -b, --boring Suppress ansi-escape colors'</span>
- + <span class="string">'\n -v, --version Output version number'</span>
- + <span class="string">'\n -h, --help Display help information'</span>
- + <span class="string">'\n'</span>;
-
-<span class="comment">// Parse arguments</span>
-
-<span class="keyword">var</span> <span class="variable">files</span> = [],
- <span class="variable">args</span> = <span class="variable">process</span>.<span class="variable">argv</span>.<span class="variable">slice</span>(<span class="number integer">2</span>);
-
-<span class="keyword">while</span> (<span class="variable">args</span>.<span class="variable">length</span>) {
- <span class="keyword">var</span> <span class="variable">arg</span> = <span class="variable">args</span>.<span class="variable">shift</span>();
- <span class="keyword">switch</span> (<span class="variable">arg</span>) {
- <span class="keyword">case</span> <span class="string">'-h'</span>:
- <span class="keyword">case</span> <span class="string">'--help'</span>:
- <span class="variable">print</span>(<span class="variable">usage</span> + <span class="string">'\n'</span>);
- <span class="variable">process</span>.<span class="variable">exit</span>(<span class="number integer">1</span>);
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-v'</span>:
- <span class="keyword">case</span> <span class="string">'--version'</span>:
- <span class="variable">sys</span>.<span class="variable">puts</span>(<span class="variable">version</span>);
- <span class="variable">process</span>.<span class="variable">exit</span>(<span class="number integer">1</span>);
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-i'</span>:
- <span class="keyword">case</span> <span class="string">'-I'</span>:
- <span class="keyword">case</span> <span class="string">'--include'</span>:
- <span class="keyword">if</span> (<span class="variable">arg</span> = <span class="variable">args</span>.<span class="variable">shift</span>()) {
- <span class="variable">require</span>.<span class="variable">paths</span>.<span class="variable">unshift</span>(<span class="variable">arg</span>);
- } <span class="keyword">else</span> {
- <span class="keyword">throw</span> <span class="keyword">new</span> <span class="class">Error</span>(<span class="string">'--include requires a path'</span>);
- }
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-o'</span>:
- <span class="keyword">case</span> <span class="string">'--only'</span>:
- <span class="keyword">if</span> (<span class="variable">arg</span> = <span class="variable">args</span>.<span class="variable">shift</span>()) {
- <span class="variable">only</span> = <span class="variable">only</span>.<span class="variable">concat</span>(<span class="variable">arg</span>.<span class="variable">split</span>(<span class="regexp">/ *, */</span>));
- } <span class="keyword">else</span> {
- <span class="keyword">throw</span> <span class="keyword">new</span> <span class="class">Error</span>(<span class="string">'--only requires comma-separated test names'</span>);
- }
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-p'</span>:
- <span class="keyword">case</span> <span class="string">'--port'</span>:
- <span class="keyword">if</span> (<span class="variable">arg</span> = <span class="variable">args</span>.<span class="variable">shift</span>()) {
- <span class="variable">port</span> = <span class="variable">parseInt</span>(<span class="variable">arg</span>, <span class="number integer">10</span>);
- } <span class="keyword">else</span> {
- <span class="keyword">throw</span> <span class="keyword">new</span> <span class="class">Error</span>(<span class="string">'--port requires a number'</span>);
- }
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-r'</span>:
- <span class="keyword">case</span> <span class="string">'--require'</span>:
- <span class="keyword">if</span> (<span class="variable">arg</span> = <span class="variable">args</span>.<span class="variable">shift</span>()) {
- <span class="variable">require</span>(<span class="variable">arg</span>);
- } <span class="keyword">else</span> {
- <span class="keyword">throw</span> <span class="keyword">new</span> <span class="class">Error</span>(<span class="string">'--require requires a path'</span>);
- }
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-t'</span>:
- <span class="keyword">case</span> <span class="string">'--timeout'</span>:
- <span class="keyword">if</span> (<span class="variable">arg</span> = <span class="variable">args</span>.<span class="variable">shift</span>()) {
- <span class="variable">timeout</span> = <span class="variable">parseInt</span>(<span class="variable">arg</span>, <span class="number integer">10</span>);
- } <span class="keyword">else</span> {
- <span class="keyword">throw</span> <span class="keyword">new</span> <span class="class">Error</span>(<span class="string">'--timeout requires an argument'</span>);
- }
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-c'</span>:
- <span class="keyword">case</span> <span class="string">'--cov'</span>:
- <span class="keyword">case</span> <span class="string">'--coverage'</span>:
- <span class="variable">defer</span> = <span class="variable">true</span>;
- <span class="variable">childProcess</span>.<span class="variable">exec</span>(<span class="string">'rm -fr lib-cov &amp;&amp; node-jscoverage lib lib-cov'</span>, <span class="keyword">function</span>(<span class="variable">err</span>){
- <span class="keyword">if</span> (<span class="variable">err</span>) <span class="keyword">throw</span> <span class="variable">err</span>;
- <span class="variable">require</span>.<span class="variable">paths</span>.<span class="variable">unshift</span>(<span class="string">'lib-cov'</span>);
- <span class="variable">run</span>(<span class="variable">files</span>);
- })
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-b'</span>:
- <span class="keyword">case</span> <span class="string">'--boring'</span>:
- <span class="variable">boring</span> = <span class="variable">true</span>;
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-w'</span>:
- <span class="keyword">case</span> <span class="string">'--watch'</span>:
- <span class="variable">watch</span> = <span class="variable">true</span>;
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-g'</span>:
- <span class="keyword">case</span> <span class="string">'--growl'</span>:
- <span class="variable">growl</span> = <span class="variable">true</span>;
- <span class="keyword">break</span>;
- <span class="keyword">case</span> <span class="string">'-s'</span>:
- <span class="keyword">case</span> <span class="string">'--serial'</span>:
- <span class="variable">serial</span> = <span class="variable">true</span>;
- <span class="keyword">break</span>;
- <span class="keyword">default</span>:
- <span class="keyword">if</span> (<span class="regexp">/\.js$/</span>.<span class="variable">test</span>(<span class="variable">arg</span>)) {
- <span class="variable">files</span>.<span class="variable">push</span>(<span class="variable">arg</span>);
- }
- <span class="keyword">break</span>;
- }
-}</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Colorized sys.error().</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>String</em> str</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="keyword">function</span> <span class="variable">print</span>(<span class="variable">str</span>){
- <span class="variable">sys</span>.<span class="variable">error</span>(<span class="variable">colorize</span>(<span class="variable">str</span>));
-}</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Colorize the given string using ansi-escape sequences.
-Disabled when --boring is set.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>String</em> str</p></li><li><p><strong>return</strong>: <em>String</em> </p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="keyword">function</span> <span class="variable">colorize</span>(<span class="variable">str</span>){
- <span class="keyword">var</span> <span class="variable">colors</span> = { <span class="variable">bold</span>: <span class="number integer">1</span>, <span class="variable">red</span>: <span class="number integer">31</span>, <span class="variable">green</span>: <span class="number integer">32</span>, <span class="variable">yellow</span>: <span class="number integer">33</span> };
- <span class="keyword">return</span> <span class="variable">str</span>.<span class="variable">replace</span>(<span class="regexp">/\[(\w+)\]\{([^]*?)\}/g</span>, <span class="keyword">function</span>(<span class="variable">_</span>, <span class="variable">color</span>, <span class="variable">str</span>){
- <span class="keyword">return</span> <span class="variable">boring</span>
- ? <span class="variable">str</span>
- : <span class="string">'\x1B['</span> + <span class="variable">colors</span>[<span class="variable">color</span>] + <span class="string">'m'</span> + <span class="variable">str</span> + <span class="string">'\x1B[0m'</span>;
- });
-}
-
-<span class="comment">// Alias deepEqual as eql for complex equality</span>
-
-<span class="variable">assert</span>.<span class="variable">eql</span> = <span class="variable">assert</span>.<span class="variable">deepEqual</span>;</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>val</code> is null.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Mixed</em> val</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">isNull</span> = <span class="keyword">function</span>(<span class="variable">val</span>, <span class="variable">msg</span>) {
- <span class="variable">assert</span>.<span class="variable">strictEqual</span>(<span class="keyword">null</span>, <span class="variable">val</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>val</code> is not null.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Mixed</em> val</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">isNotNull</span> = <span class="keyword">function</span>(<span class="variable">val</span>, <span class="variable">msg</span>) {
- <span class="variable">assert</span>.<span class="variable">notStrictEqual</span>(<span class="keyword">null</span>, <span class="variable">val</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>val</code> is undefined.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Mixed</em> val</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">isUndefined</span> = <span class="keyword">function</span>(<span class="variable">val</span>, <span class="variable">msg</span>) {
- <span class="variable">assert</span>.<span class="variable">strictEqual</span>(<span class="variable">undefined</span>, <span class="variable">val</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>val</code> is not undefined.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Mixed</em> val</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">isDefined</span> = <span class="keyword">function</span>(<span class="variable">val</span>, <span class="variable">msg</span>) {
- <span class="variable">assert</span>.<span class="variable">notStrictEqual</span>(<span class="variable">undefined</span>, <span class="variable">val</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>obj</code> is <code>type</code>.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Mixed</em> obj</p></li><li><p><strong>param</strong>: <em>String</em> type</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">type</span> = <span class="keyword">function</span>(<span class="variable">obj</span>, <span class="variable">type</span>, <span class="variable">msg</span>){
- <span class="keyword">var</span> <span class="variable">real</span> = <span class="keyword">typeof</span> <span class="variable">obj</span>;
- <span class="variable">msg</span> = <span class="variable">msg</span> || <span class="string">'typeof '</span> + <span class="variable">sys</span>.<span class="variable">inspect</span>(<span class="variable">obj</span>) + <span class="string">' is '</span> + <span class="variable">real</span> + <span class="string">', expected '</span> + <span class="variable">type</span>;
- <span class="variable">assert</span>.<span class="variable">ok</span>(<span class="variable">type</span> === <span class="variable">real</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>str</code> matches <code>regexp</code>.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>String</em> str</p></li><li><p><strong>param</strong>: <em>RegExp</em> regexp</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">match</span> = <span class="keyword">function</span>(<span class="variable">str</span>, <span class="variable">regexp</span>, <span class="variable">msg</span>) {
- <span class="variable">msg</span> = <span class="variable">msg</span> || <span class="variable">sys</span>.<span class="variable">inspect</span>(<span class="variable">str</span>) + <span class="string">' does not match '</span> + <span class="variable">sys</span>.<span class="variable">inspect</span>(<span class="variable">regexp</span>);
- <span class="variable">assert</span>.<span class="variable">ok</span>(<span class="variable">regexp</span>.<span class="variable">test</span>(<span class="variable">str</span>), <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert that <code>val</code> is within <code>obj</code>.</p>
-
-<h2>Examples</h2>
-
-<p> assert.includes('foobar', 'bar');
- assert.includes(['foo', 'bar'], 'foo');</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>String | Array</em> obj</p></li><li><p><strong>param</strong>: <em>Mixed</em> val</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">includes</span> = <span class="keyword">function</span>(<span class="variable">obj</span>, <span class="variable">val</span>, <span class="variable">msg</span>) {
- <span class="variable">msg</span> = <span class="variable">msg</span> || <span class="variable">sys</span>.<span class="variable">inspect</span>(<span class="variable">obj</span>) + <span class="string">' does not include '</span> + <span class="variable">sys</span>.<span class="variable">inspect</span>(<span class="variable">val</span>);
- <span class="variable">assert</span>.<span class="variable">ok</span>(<span class="variable">obj</span>.<span class="variable">indexOf</span>(<span class="variable">val</span>) &<span class="variable">gt</span>;= <span class="number integer">0</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert length of <code>val</code> is <code>n</code>.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Mixed</em> val</p></li><li><p><strong>param</strong>: <em>Number</em> n</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">length</span> = <span class="keyword">function</span>(<span class="variable">val</span>, <span class="variable">n</span>, <span class="variable">msg</span>) {
- <span class="variable">msg</span> = <span class="variable">msg</span> || <span class="variable">sys</span>.<span class="variable">inspect</span>(<span class="variable">val</span>) + <span class="string">' has length of '</span> + <span class="variable">val</span>.<span class="variable">length</span> + <span class="string">', expected '</span> + <span class="variable">n</span>;
- <span class="variable">assert</span>.<span class="variable">equal</span>(<span class="variable">n</span>, <span class="variable">val</span>.<span class="variable">length</span>, <span class="variable">msg</span>);
-};</code></pre>
-</td>
-</tr>
-<tr class="code">
-<td class="docs">
-<p>Assert response from <code>server</code> with
-the given <code>req</code> object and <code>res</code> assertions object.</p>
-
-<h2></h2>
-
-<ul><li><p><strong>param</strong>: <em>Server</em> server</p></li><li><p><strong>param</strong>: <em>Object</em> req</p></li><li><p><strong>param</strong>: <em>Object | Function</em> res</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li></ul>
-</td>
-<td class="code">
-<pre><code><span class="variable">assert</span>.<span class="variable">response</span> = <span class="keyword">function</span>(<span class="variable">server</span>, <span class="variable">req</span>, <span class="variable">res</span>, <span class="variable">msg</span>){
- <span class="comment">// Callback as third or fourth arg</span>
- <span class="keyword">var</span> <span class="variable">callback</span> = <span class="keyword">typeof</span> <span class="variable">res</span> === <span class="string">'function'</span>
- ? <span class="variable">res</span>
- : <span class="keyword">typeof</span> <span class="variable">msg</span> === <span class="string">'function'</span>
- ? <span class="variable">msg</span>
- : <span class="keyword">function</span>(){};
-
- <span class="comment">// Default messate to test title</span>
- <span class="keyword">if</span> (<span class="keyword">typeof</span> <span class="variable">msg</span> === <span class="string">'function'</span>) <span class="variable">msg</span> = <span class="keyword">null</span>;
- <span class="variable">msg</span> = <span class="variable">msg</span> || <span class="variable">assert</span>.<span class="variable">testTitle</span>;
- <span class="variable">msg</span> += <span class="string">'. '</span>;
-
- <span class="comment">// Pending responses</span>
- <span class="variable">server</span>.<span class="variable">__pending</span> = <span class="variable">server</span>.<span class="variable">__pending</span> || <span class="number integer">0</span>;
- <span class="variable">server</span>.<span class="variable">__pending</span>++;
-
- <span class="comment">// Create client</span>
- <span class="keyword">if</span> (!<span class="variable">server</span>.<span class="variable">fd</span>) {
- <span class="variable">server</span>.<span class="variable">listen</span>(<span class="variable">server</span>.<span class="variable">__port</span> = <span class="variable">port</span>++, <span class="string">'127.0.0.1'</span>);
- <span class="variable">server</span>.<span class="variable">client</span> = <span class="variable">http</span>.<span class="variable">createClient</span>(<span class="variable">server</span>.<span class="variable">__port</span>);
- }
-
- <span class="comment">// Issue request</span>
- <span class="keyword">var</span> <span class="variable">timer</span>,
- <span class="variable">client</span> = <span class="variable">server</span>.<span class="variable">client</span>,
- <span class="variable">method</span> = <span class="variable">req</span>.<span class="variable">method</span> || <span class="string">'GET'</span>,
- <span class="variable">status</span> = <span class="variable">res</span>.<span class="variable">status</span> || <span class="variable">res</span>.<span class="variable">statusCode</span>,
- <span class="variable">data</span> = <span class="variable">req</span>.<span class="variable">data</span> || <span class="variable">req</span>.<span class="variable">body</span>,
- <span class="variable">requestTimeout</span> = <span class="variable">req</span>.<span class="variable">timeout</span> || <span class="number integer">0</span>;
-
- <span class="keyword">var</span> <span class="variable">request</span> = <span class="variable">client</span>.<span class="variable">request</span>(<span class="variable">method</span>, <span class="variable">req</span>.<span class="variable">url</span>, <span class="variable">req</span>.<span class="variable">headers</span>);
-
- <span class="comment">// Timeout</span>
- <span class="keyword">if</span> (<span class="variable">requestTimeout</span>) {
- <span class="variable">timer</span> = <span class="variable">setTimeout</span>(<span class="keyword">function</span>(){
- --<span class="variable">server</span>.<span class="variable">__pending</span> || <span class="variable">server</span>.<span class="variable">close</span>();
- <span class="keyword">delete</span> <span class="variable">req</span>.<span class="variable">timeout</span>;
- <span class="variable">assert</span>.<span class="variable">fail</span>(<span class="variable">msg</span> + <span class="string">'Request timed out after '</span> + <span class="variable">requestTimeout</span> + <span class="string">'ms.'</span>);
- }, <span class="variable">requestTimeout</span>);
- }
-
- <span class="keyword">if</span> (<span class="variable">data</span>) <span class="variable">request</span>.<span class="variable">write</span>(<span class="variable">data</span>);
- <span class="variable">request</span>.<span class="variable">addListener</span>(<span class="string">'response'</span>, <span class="keyword">function</span>(<span class="variable">response</span>){
- <span class="variable">response</span>.<span class="variable">body</span> = <span class="string">''</span>;
- <span class="variable">response</span>.<span class="variable">setEncoding</span>(<span class="string">'utf8'</span>);
- <span class="variable">response</span>.<span class="variable">addListener</span>(<span class="string">'data'</span>, <span class="keyword">function</span>(<span class="variable">chunk</span>){ <span class="variable">response</span>.<span class="variable">body</span> += <span class="variable">chunk</span>; });
- <span class="variable">response</span>.<span class="variable">addListener</span>(<span class="string">'end'</span>, <span class="keyword">function</span>(){
- --<span class="variable">server</span>.<span class="variable">__pending</span> || <span class="variable">server</span>.<span class