Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Big commit, tests push function

  • Loading branch information...
commit 44d1c4c63bffc941220e5eacc94f04bae490f134 1 parent 805f194
@arnklint authored
Showing with 31,837 additions and 5 deletions.
  1. +1 −0  .gitignore
  2. +19 −0 LICENSE
  3. +1 −1  Makefile
  4. +46 −0 README.md
  5. +17 −0 lib/helpers.js
  6. +2 −0  lib/index.js
  7. +84 −0 lib/prowl.js
  8. +1 −0  node_modules/.bin/_mocha
  9. +1 −0  node_modules/.bin/mocha
  10. +4 −0 node_modules/mocha/.npmignore
  11. +5 −0 node_modules/mocha/.travis.yml
  12. +263 −0 node_modules/mocha/History.md
  13. +22 −0 node_modules/mocha/LICENSE
  14. +99 −0 node_modules/mocha/Makefile
  15. +34 −0 node_modules/mocha/Readme.md
  16. +3,153 −0 node_modules/mocha/_mocha.js
  17. +320 −0 node_modules/mocha/bin/_mocha
  18. +28 −0 node_modules/mocha/bin/mocha
  19. +16 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet
  20. +16 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet
  21. +16 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet
  22. +16 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet
  23. +16 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet
  24. +16 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/untitled.tmSnippet
  25. +19 −0 node_modules/mocha/editors/JavaScript mocha.tmbundle/info.plist
  26. BIN  node_modules/mocha/images/error.png
  27. BIN  node_modules/mocha/images/ok.png
  28. +2 −0  node_modules/mocha/index.js
  29. +6 −0 node_modules/mocha/lib/browser/debug.js
  30. +178 −0 node_modules/mocha/lib/browser/events.js
  31. 0  node_modules/mocha/lib/browser/fs.js
  32. 0  node_modules/mocha/lib/browser/path.js
  33. +125 −0 node_modules/mocha/lib/browser/progress.js
  34. +8 −0 node_modules/mocha/lib/browser/tty.js
  35. +30 −0 node_modules/mocha/lib/hook.js
  36. +86 −0 node_modules/mocha/lib/interfaces/bdd.js
  37. +60 −0 node_modules/mocha/lib/interfaces/exports.js
  38. +5 −0 node_modules/mocha/lib/interfaces/index.js
  39. +91 −0 node_modules/mocha/lib/interfaces/qunit.js
  40. +94 −0 node_modules/mocha/lib/interfaces/tdd.js
  41. +21 −0 node_modules/mocha/lib/mocha.js
  42. +236 −0 node_modules/mocha/lib/reporters/base.js
  43. +74 −0 node_modules/mocha/lib/reporters/doc.js
  44. +62 −0 node_modules/mocha/lib/reporters/dot.js
  45. +154 −0 node_modules/mocha/lib/reporters/html.js
  46. +13 −0 node_modules/mocha/lib/reporters/index.js
  47. +61 −0 node_modules/mocha/lib/reporters/json-stream.js
  48. +70 −0 node_modules/mocha/lib/reporters/json.js
  49. +97 −0 node_modules/mocha/lib/reporters/landing.js
  50. +64 −0 node_modules/mocha/lib/reporters/list.js
  51. +85 −0 node_modules/mocha/lib/reporters/progress.js
  52. +87 −0 node_modules/mocha/lib/reporters/spec.js
  53. +63 −0 node_modules/mocha/lib/reporters/tap.js
  54. +56 −0 node_modules/mocha/lib/reporters/teamcity.js
  55. +101 −0 node_modules/mocha/lib/reporters/xunit.js
  56. +163 −0 node_modules/mocha/lib/runnable.js
  57. +432 −0 node_modules/mocha/lib/runner.js
  58. +238 −0 node_modules/mocha/lib/suite.js
  59. +32 −0 node_modules/mocha/lib/test.js
  60. +175 −0 node_modules/mocha/lib/utils.js
  61. +133 −0 node_modules/mocha/mocha.css
  62. +3,290 −0 node_modules/mocha/mocha.js
  63. +4 −0 node_modules/mocha/node_modules/commander/.npmignore
  64. +4 −0 node_modules/mocha/node_modules/commander/.travis.yml
  65. +99 −0 node_modules/mocha/node_modules/commander/History.md
  66. +7 −0 node_modules/mocha/node_modules/commander/Makefile
  67. +263 −0 node_modules/mocha/node_modules/commander/Readme.md
  68. +2 −0  node_modules/mocha/node_modules/commander/index.js
  69. +992 −0 node_modules/mocha/node_modules/commander/lib/commander.js
  70. +13 −0 node_modules/mocha/node_modules/commander/package.json
  71. +4 −0 node_modules/mocha/node_modules/debug/.npmignore
  72. +41 −0 node_modules/mocha/node_modules/debug/History.md
  73. +5 −0 node_modules/mocha/node_modules/debug/Makefile
  74. +130 −0 node_modules/mocha/node_modules/debug/Readme.md
  75. +122 −0 node_modules/mocha/node_modules/debug/debug.js
  76. +19 −0 node_modules/mocha/node_modules/debug/example/app.js
  77. +24 −0 node_modules/mocha/node_modules/debug/example/browser.html
  78. +10 −0 node_modules/mocha/node_modules/debug/example/wildcards.js
  79. +22 −0 node_modules/mocha/node_modules/debug/example/worker.js
  80. +2 −0  node_modules/mocha/node_modules/debug/index.js
  81. +147 −0 node_modules/mocha/node_modules/debug/lib/debug.js
  82. +11 −0 node_modules/mocha/node_modules/debug/package.json
  83. +37 −0 node_modules/mocha/node_modules/growl/History.md
  84. +83 −0 node_modules/mocha/node_modules/growl/Readme.md
  85. +159 −0 node_modules/mocha/node_modules/growl/lib/growl.js
  86. +6 −0 node_modules/mocha/node_modules/growl/package.json
  87. +16 −0 node_modules/mocha/node_modules/growl/test.js
  88. +21 −0 node_modules/mocha/package.json
  89. +55 −0 node_modules/request/LICENSE
  90. +287 −0 node_modules/request/README.md
  91. +103 −0 node_modules/request/forever.js
  92. +913 −0 node_modules/request/main.js
  93. +152 −0 node_modules/request/mimetypes.js
  94. +34 −0 node_modules/request/oauth.js
  95. +15 −0 node_modules/request/package.json
  96. BIN  node_modules/request/tests/googledoodle.png
  97. +38 −0 node_modules/request/tests/run.js
  98. +82 −0 node_modules/request/tests/server.js
  99. +77 −0 node_modules/request/tests/squid.conf
  100. +20 −0 node_modules/request/tests/ssl/ca/ca.cnf
  101. 0  node_modules/request/tests/ssl/ca/ca.crl
  102. +17 −0 node_modules/request/tests/ssl/ca/ca.crt
  103. +13 −0 node_modules/request/tests/ssl/ca/ca.csr
  104. +18 −0 node_modules/request/tests/ssl/ca/ca.key
  105. +1 −0  node_modules/request/tests/ssl/ca/ca.srl
  106. +19 −0 node_modules/request/tests/ssl/ca/server.cnf
  107. +16 −0 node_modules/request/tests/ssl/ca/server.crt
  108. +11 −0 node_modules/request/tests/ssl/ca/server.csr
  109. +28 −0 node_modules/request/tests/ssl/ca/server.js
  110. +9 −0 node_modules/request/tests/ssl/ca/server.key
  111. +16 −0 node_modules/request/tests/ssl/npm-ca.crt
  112. +15 −0 node_modules/request/tests/ssl/test.crt
  113. +15 −0 node_modules/request/tests/ssl/test.key
  114. +95 −0 node_modules/request/tests/test-body.js
  115. +29 −0 node_modules/request/tests/test-cookie.js
  116. +90 −0 node_modules/request/tests/test-cookiejar.js
  117. +68 −0 node_modules/request/tests/test-defaults.js
  118. +37 −0 node_modules/request/tests/test-errors.js
  119. +52 −0 node_modules/request/tests/test-headers.js
  120. +94 −0 node_modules/request/tests/test-httpModule.js
  121. +97 −0 node_modules/request/tests/test-https-strict.js
  122. +86 −0 node_modules/request/tests/test-https.js
  123. +117 −0 node_modules/request/tests/test-oauth.js
  124. +92 −0 node_modules/request/tests/test-params.js
  125. +202 −0 node_modules/request/tests/test-pipes.js
  126. +39 −0 node_modules/request/tests/test-proxy.js
  127. +28 −0 node_modules/request/tests/test-qs.js
  128. +154 −0 node_modules/request/tests/test-redirect.js
  129. +87 −0 node_modules/request/tests/test-timeout.js
  130. +14 −0 node_modules/request/tests/test-toJSON.js
  131. +61 −0 node_modules/request/tests/test-tunnel.js
  132. +229 −0 node_modules/request/tunnel.js
  133. +19 −0 node_modules/request/uuid.js
  134. +65 −0 node_modules/request/vendor/cookie/index.js
  135. +72 −0 node_modules/request/vendor/cookie/jar.js
  136. +3 −0  node_modules/should/.gitmodules
  137. +1 −0  node_modules/should/.npmignore
  138. +106 −0 node_modules/should/History.md
  139. +6 −0 node_modules/should/Makefile
  140. +367 −0 node_modules/should/Readme.md
  141. +53 −0 node_modules/should/examples/runner.js
  142. +2 −0  node_modules/should/index.js
  143. +91 −0 node_modules/should/lib/eql.js
  144. +701 −0 node_modules/should/lib/should.js
  145. +13 −0 node_modules/should/package.json
  146. +96 −0 node_modules/should/test/exist.test.js
  147. +557 −0 node_modules/should/test/should.test.js
  148. +2 −0  node_modules/xml2js/.npmignore
  149. +12 −0 node_modules/xml2js/Cakefile
  150. +19 −0 node_modules/xml2js/LICENSE
  151. +139 −0 node_modules/xml2js/README.md
  152. +152 −0 node_modules/xml2js/lib/xml2js.js
  153. +9 −0 node_modules/xml2js/node_modules/sax/AUTHORS
  154. +23 −0 node_modules/xml2js/node_modules/sax/LICENSE
  155. +215 −0 node_modules/xml2js/node_modules/sax/README.md
  156. +8,002 −0 node_modules/xml2js/node_modules/sax/examples/big-not-pretty.xml
  157. +41 −0 node_modules/xml2js/node_modules/sax/examples/example.js
  158. +58 −0 node_modules/xml2js/node_modules/sax/examples/get-products.js
  159. +4 −0 node_modules/xml2js/node_modules/sax/examples/hello-world.js
  160. +8 −0 node_modules/xml2js/node_modules/sax/examples/not-pretty.xml
  161. +74 −0 node_modules/xml2js/node_modules/sax/examples/pretty-print.js
  162. +2 −0  node_modules/xml2js/node_modules/sax/examples/shopping.xml
  163. +870 −0 node_modules/xml2js/node_modules/sax/examples/strict.dtd
  164. +45 −0 node_modules/xml2js/node_modules/sax/examples/switch-bench.js
  165. +15 −0 node_modules/xml2js/node_modules/sax/examples/test.html
  166. +1,254 −0 node_modules/xml2js/node_modules/sax/examples/test.xml
  167. +1,007 −0 node_modules/xml2js/node_modules/sax/lib/sax.js
  168. +10 −0 node_modules/xml2js/node_modules/sax/package.json
  169. +25 −0 node_modules/xml2js/node_modules/sax/test/buffer-overrun.js
  170. +47 −0 node_modules/xml2js/node_modules/sax/test/case.js
  171. +11 −0 node_modules/xml2js/node_modules/sax/test/cdata-chunked.js
  172. +15 −0 node_modules/xml2js/node_modules/sax/test/cdata-end-split.js
  173. +28 −0 node_modules/xml2js/node_modules/sax/test/cdata-fake-end.js
  174. +15 −0 node_modules/xml2js/node_modules/sax/test/cdata-multiple.js
  175. +10 −0 node_modules/xml2js/node_modules/sax/test/cdata.js
  176. +86 −0 node_modules/xml2js/node_modules/sax/test/index.js
  177. +43 −0 node_modules/xml2js/node_modules/sax/test/issue-23.js
  178. +24 −0 node_modules/xml2js/node_modules/sax/test/issue-30.js
  179. +15 −0 node_modules/xml2js/node_modules/sax/test/issue-35.js
  180. +13 −0 node_modules/xml2js/node_modules/sax/test/issue-47.js
  181. +31 −0 node_modules/xml2js/node_modules/sax/test/issue-49.js
  182. +28 −0 node_modules/xml2js/node_modules/sax/test/parser-position.js
  183. +12 −0 node_modules/xml2js/node_modules/sax/test/script.js
  184. +40 −0 node_modules/xml2js/node_modules/sax/test/self-closing-child-strict.js
  185. +40 −0 node_modules/xml2js/node_modules/sax/test/self-closing-child.js
  186. +25 −0 node_modules/xml2js/node_modules/sax/test/self-closing-tag.js
  187. +17 −0 node_modules/xml2js/node_modules/sax/test/stray-ending.js
  188. +17 −0 node_modules/xml2js/node_modules/sax/test/trailing-non-whitespace.js
  189. +17 −0 node_modules/xml2js/node_modules/sax/test/unquoted.js
  190. +67 −0 node_modules/xml2js/node_modules/sax/test/xmlns-issue-41.js
  191. +59 −0 node_modules/xml2js/node_modules/sax/test/xmlns-rebinding.js
  192. +71 −0 node_modules/xml2js/node_modules/sax/test/xmlns-strict.js
  193. +15 −0 node_modules/xml2js/node_modules/sax/test/xmlns-unbound.js
  194. +35 −0 node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js
  195. +20 −0 node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-prefix.js
  196. +40 −0 node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-redefine.js
  197. +37 −0 node_modules/xml2js/package.json
  198. +142 −0 node_modules/xml2js/src/xml2js.coffee
  199. +34 −0 node_modules/xml2js/test/fixtures/sample.xml
  200. +154 −0 node_modules/xml2js/test/xml2js.test.coffee
  201. +4 −4 package.json
  202. +12 −0 test/all.js
View
1  .gitignore
@@ -0,0 +1 @@
+./node_modules
View
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright 2010, 2011. All rights reserved.
+
+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
2  Makefile
@@ -1,4 +1,4 @@
test:
- @./node_modules/.bin/mocha -w --reporter list --require tobi should --globals encoding --timeout 10000
+ @./node_modules/.bin/mocha -w --reporter list --require should --globals encoding --timeout 10000
.PHONY: test
View
46 README.md
@@ -0,0 +1,46 @@
+# Prowl Node.js API
+
+Be happy! Send push notifications to iDevices (iPad, iPhone etc) that
+has the [Prowl iPhone app](http://www.prowlapp.com/) installed. Simple,
+easy and clean.
+
+As of now this API supports push and only push.
+
+## Installation
+
+ npm install prowl
+
+or put it in your package.json as usual and hit npm install. It depends
+on xml2js and request.
+
+## Usage
+
+The API requires your API-key, which could be found or created on the
+"API Keys" tab on the [Prowl website](http://www.prowlapp.com/).
+
+Initialize it with your key and start pushing!
+
+ var prowl = new Prowl('MY-API-KEY');
+ prowl.push('YO, this is awesomez!', 'My app', function( err, remaining ){
+ if( err ) throw err;
+ console.log( 'I have ' + remaining + ' calls to the api during current hour. BOOM!' );
+ });
+
+## Contribute
+
+I´d be happy if you wanted to contribute with pull requests or tips.
+I´ll add you to the contributors list here and in the package.json file.
+
+## Testing
+
+While contributing, make sure to write a test and make it pass if you
+extend the library. Tests are written in the test directory, preferably
+in all.js, since its quite small right now. It uses should.js and mocha
+for tests.
+
+Test by installing mocha and should.js (dev dependencies) and then just
+hit:
+
+PROWL_KEY=[my key here] make
+
+And voila, it autotests for you.
View
17 lib/helpers.js
@@ -0,0 +1,17 @@
+/**
+ * Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
+ * @param obj1
+ * @param obj2
+ * @returns obj3 a new object based on obj1 and obj2
+ */
+
+function merge( obj1, obj2 ){
+ var obj3 = {};
+ for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
+ for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
+ return obj3;
+}
+
+module.exports = {
+ merge: merge
+}
View
2  lib/index.js
@@ -0,0 +1,2 @@
+var prowl = require('./prowl');
+module.export = prowl;
View
84 lib/prowl.js
@@ -0,0 +1,84 @@
+var request = require('request'),
+ querystring = require('querystring'),
+ helpers = require('./helpers'),
+ xml2js = require('xml2js'),
+ parser = new xml2js.Parser();
+
+/**
+ * Prowl - send PUSH notification to you iDevice (iPhone, iPad)
+ */
+function Prowl( apiKey ){
+ this.apiKey = apiKey || undefined;
+
+ this.endpoint = "https://api.prowlapp.com/publicapi/";
+}
+
+
+/**
+ * push - send push notification
+ *
+ * Example
+ *
+ * var prowl = new Prowl('MY-API-KEY');
+ * prowl.push('YO, this is awesomez!', 'My app', function( err, remaining ){
+ * if( err ) throw err;
+ * console.log( 'I have ' + remaining + ' calls to the api during current hour' );
+ * });
+ *
+ * @param {String} event - the event name
+ * @param {String} application - the name of your application or the application generating the event
+ * @optional {Object} options
+ * * providerkey: optional provider key
+ * * priority: from -2 to 2, Emergency priority messages may bypass quiet hours according to the user's settings.
+ * * url: The URL which should be attached to the notification.
+ * @param {Function} callback - calls back with to parameters; error message if any, and remaining api calls until you reach prowls limit
+ *
+ * @public
+ */
+
+var push = function( event, application, options, callback ){
+ if( !application ) throw new Error("Second parameter \'application\' is missing");
+
+ var me = this;
+ if( typeof options == 'function' ){
+ callback = options;
+ options = {};
+ }
+
+ var defaults = {
+ providerkey: null,
+ priority: 0,
+ url: null
+ }
+
+ var options = helpers.merge( defaults, options );
+
+ var query = { event: event,
+ application: application,
+ apikey: me.apiKey,
+ providerkey: options.providerkey,
+ priority: options.priority,
+ url: options.url
+ }
+
+ var url = me.endpoint + 'add?' + querystring.stringify( query );
+
+ request({
+ method: 'POST',
+ uri: url
+ }, function( err, res ){
+ parser.parseString(res.body, function (err, result) {
+ var error = null;
+ if( err ) error = err;
+ if( !result['success'] ) error = err;
+
+ callback( error, result['success']['@']['remaining']*1 );
+ });
+ })
+}
+
+Prowl.prototype = {
+ push: push
+}
+
+module.exports = Prowl;
View
1  node_modules/.bin/_mocha
View
1  node_modules/.bin/mocha
View
4 node_modules/mocha/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
View
5 node_modules/mocha/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
+ - 0.7
View
263 node_modules/mocha/History.md
@@ -0,0 +1,263 @@
+
+0.12.0 / 2012-02-02
+==================
+
+ * Added .coffee `--watch` support. Closes #242
+ * Added support to `--require` files relative to the CWD. Closes #241
+ * Added quick n dirty syntax highlighting. Closes #248
+ * Changed: made HTML progress indicator smaller
+ * Fixed xunit errors attribute [dhendo]
+
+0.10.2 / 2012-01-21
+==================
+
+ * Fixed suite count in reporter stats. Closes #222
+ * Fixed `done()` after timeout error reporting [Phil Sung]
+ * Changed the 0-based errors to 1
+
+0.10.1 / 2012-01-17
+==================
+
+ * Added support for node 0.7.x
+ * Fixed absolute path support. Closes #215 [kompiro]
+ * Fixed `--no-colors` option [Jussi Virtanen]
+ * Fixed Arial CSS typo in the correct file
+
+0.10.0 / 2012-01-13
+==================
+
+ * Added `-b, --bail` to exit on first exception [guillermo]
+ * Added support for `-gc` / `--expose-gc` [TooTallNate]
+ * Added `qunit`-inspired interface
+ * Added MIT LICENSE. Closes #194
+ * Added: `--watch` all .js in the CWD. Closes #139
+ * Fixed `self.test` reference in runner. Closes #189
+ * Fixed double reporting of uncaught exceptions after timeout. Closes #195
+
+0.8.2 / 2012-01-05
+==================
+
+ * Added test-case context support. Closes #113
+ * Fixed exit status. Closes #187
+ * Update commander. Closes #190
+
+0.8.1 / 2011-12-30
+==================
+
+ * Fixed reporting of uncaught exceptions. Closes #183
+ * Fixed error message defaulting [indutny]
+ * Changed mocha(1) from bash to node for windows [Nathan Rajlich]
+
+0.8.0 / 2011-12-28
+==================
+
+ * Added `XUnit` reporter [FeeFighters/visionmedia]
+ * Added `say(1)` notification support [Maciej Małecki]
+ * Changed: fail when done() is invoked with a non-Error. Closes #171
+ * Fixed `err.stack`, defaulting to message. Closes #180
+ * Fixed: `make tm` mkdir -p the dest. Closes #137
+ * Fixed mocha(1) --help bin name
+ * Fixed `-d` for `--debug` support
+
+0.7.1 / 2011-12-22
+==================
+
+ * Removed `mocha-debug(1)`, use `mocha --debug`
+ * Fixed CWD relative requires
+ * Fixed growl issue on windows [Raynos]
+ * Fixed: platform specific line endings [TooTallNate]
+ * Fixed: escape strings in HTML reporter. Closes #164
+
+0.7.0 / 2011-12-18
+==================
+
+ * Added support for IE{7,8} [guille]
+ * Changed: better browser nextTick implementation [guille]
+
+0.6.0 / 2011-12-18
+==================
+
+ * Added setZeroTimeout timeout for browser (nicer stack traces). Closes #153
+ * Added "view source" on hover for HTML reporter to make it obvious
+ * Changed: replace custom growl with growl lib
+ * Fixed duplicate reporting for HTML reporter. Closes #154
+ * Fixed silent hook errors in the HTML reporter. Closes #150
+
+0.5.0 / 2011-12-14
+==================
+
+ * Added: push node_modules directory onto module.paths for relative require Closes #93
+ * Added teamcity reporter [blindsey]
+ * Fixed: recover from uncaught exceptions for tests. Closes #94
+ * Fixed: only emit "test end" for uncaught within test, not hook
+
+0.4.0 / 2011-12-14
+==================
+
+ * Added support for test-specific timeouts via `this.timeout(0)`. Closes #134
+ * Added guillermo's client-side EventEmitter. Closes #132
+ * Added progress indicator to the HTML reporter
+ * Fixed slow browser tests. Closes #135
+ * Fixed "suite" color for light terminals
+ * Fixed `require()` leak spotted by [guillermo]
+
+0.3.6 / 2011-12-09
+==================
+
+ * Removed suite merging (for now)
+
+0.3.5 / 2011-12-08
+==================
+
+ * Added support for `window.onerror` [guillermo]
+ * Fixed: clear timeout on uncaught exceptions. Closes #131 [guillermo]
+ * Added `mocha.css` to PHONY list.
+ * Added `mocha.js` to PHONY list.
+
+0.3.4 / 2011-12-08
+==================
+
+ * Added: allow `done()` to be called with non-Error
+ * Added: return Runner from `mocha.run()`. Closes #126
+ * Fixed: run afterEach even on failures. Closes #125
+ * Fixed clobbering of current runnable. Closes #121
+
+0.3.3 / 2011-12-08
+==================
+
+ * Fixed hook timeouts. Closes #120
+ * Fixed uncaught exceptions in hooks
+
+0.3.2 / 2011-12-05
+==================
+
+ * Fixed weird reporting when `err.message` is not present
+
+0.3.1 / 2011-12-04
+==================
+
+ * Fixed hook event emitter leak. Closes #117
+ * Fixed: export `Spec` constructor. Closes #116
+
+0.3.0 / 2011-12-04
+==================
+
+ * Added `-w, --watch`. Closes #72
+ * Added `--ignore-leaks` to ignore global leak checking
+ * Added browser `?grep=pattern` support
+ * Added `--globals <names>` to specify accepted globals. Closes #99
+ * Fixed `mocha-debug(1)` on some systems. Closes #232
+ * Fixed growl total, use `runner.total`
+
+0.2.0 / 2011-11-30
+==================
+
+ * Added `--globals <names>` to specify accepted globals. Closes #99
+ * Fixed funky highlighting of messages. Closes #97
+ * Fixed `mocha-debug(1)`. Closes #232
+ * Fixed growl total, use runner.total
+
+0.1.0 / 2011-11-29
+==================
+
+ * Added `suiteSetup` and `suiteTeardown` to TDD interface [David Henderson]
+ * Added growl icons. Closes #84
+ * Fixed coffee-script support
+
+0.0.8 / 2011-11-25
+==================
+
+ * Fixed: use `Runner#total` for accurate reporting
+
+0.0.7 / 2011-11-25
+==================
+
+ * Added `Hook`
+ * Added `Runnable`
+ * Changed: `Test` is `Runnable`
+ * Fixed global leak reporting in hooks
+ * Fixed: > 2 calls to done() only report the error once
+ * Fixed: clear timer on failure. Closes #80
+
+0.0.6 / 2011-11-25
+==================
+
+ * Fixed return on immediate async error. Closes #80
+
+0.0.5 / 2011-11-24
+==================
+
+ * Fixed: make mocha.opts whitespace less picky [kkaefer]
+
+0.0.4 / 2011-11-24
+==================
+
+ * Added `--interfaces`
+ * Added `--reporters`
+ * Added `-c, --colors`. Closes #69
+ * Fixed hook timeouts
+
+0.0.3 / 2011-11-23
+==================
+
+ * Added `-C, --no-colors` to explicitly disable
+ * Added coffee-script support
+
+0.0.2 / 2011-11-22
+==================
+
+ * Fixed global leak detection due to Safari bind() change
+ * Fixed: escape html entities in Doc reporter
+ * Fixed: escape html entities in HTML reporter
+ * Fixed pending test support for HTML reporter. Closes #66
+
+0.0.1 / 2011-11-22
+==================
+
+ * Added `--timeout` second shorthand support, ex `--timeout 3s`.
+ * Fixed "test end" event for uncaughtExceptions. Closes #61
+
+0.0.1-alpha6 / 2011-11-19
+==================
+
+ * Added travis CI support (needs enabling when public)
+ * Added preliminary browser support
+ * Added `make mocha.css` target. Closes #45
+ * Added stack trace to TAP errors. Closes #52
+ * Renamed tearDown to teardown. Closes #49
+ * Fixed: cascading hooksc. Closes #30
+ * Fixed some colors for non-tty
+ * Fixed errors thrown in sync test-cases due to nextTick
+ * Fixed Base.window.width... again give precedence to 0.6.x
+
+0.0.1-alpha5 / 2011-11-17
+==================
+
+ * Added `doc` reporter. Closes #33
+ * Added suite merging. Closes #28
+ * Added TextMate bundle and `make tm`. Closes #20
+
+0.0.1-alpha4 / 2011-11-15
+==================
+
+ * Fixed getWindowSize() for 0.4.x
+
+0.0.1-alpha3 / 2011-11-15
+==================
+
+ * Added `-s, --slow <ms>` to specify "slow" test threshold
+ * Added `mocha-debug(1)`
+ * Added `mocha.opts` support. Closes #31
+ * Added: default [files] to _test/*.js_
+ * Added protection against multiple calls to `done()`. Closes #35
+ * Changed: bright yellow for slow Dot reporter tests
+
+0.0.1-alpha1 / 2011-11-08
+==================
+
+ * Missed this one :)
+
+0.0.1-alpha1 / 2011-11-08
+==================
+
+ * Initial release
View
22 node_modules/mocha/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 20011-2012 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
99 node_modules/mocha/Makefile
@@ -0,0 +1,99 @@
+
+REPORTER = dot
+TM_DEST = ~/Library/Application\ Support/TextMate/Bundles
+TM_BUNDLE = JavaScript\ mocha.tmbundle
+SRC = $(shell find lib -name "*.js" -type f)
+SUPPORT = $(wildcard support/*.js)
+
+all: mocha.js mocha.css
+
+mocha.css: test/browser/style.css
+ cp -f $< $@
+
+mocha.js: $(SRC) $(SUPPORT)
+ @node support/compile $(SRC)
+ @cat \
+ support/head.js \
+ _mocha.js \
+ support/{tail,foot}.js \
+ > mocha.js
+
+clean:
+ rm -f mocha.{js,css}
+
+test: test-unit
+
+test-all: test-bdd test-tdd test-qunit test-exports test-unit test-grep
+
+test-unit:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ test/acceptance/*.js \
+ test/*.js
+
+test-bdd:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ --ui bdd \
+ test/acceptance/interfaces/bdd
+
+test-tdd:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ --ui tdd \
+ test/acceptance/interfaces/tdd
+
+test-qunit:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ --ui qunit \
+ test/acceptance/interfaces/qunit
+
+test-exports:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ --ui exports \
+ test/acceptance/interfaces/exports
+
+test-grep:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ --grep fast \
+ test/acceptance/misc/grep
+
+test-bail:
+ @./bin/mocha \
+ --reporter $(REPORTER) \
+ --bail \
+ test/acceptance/misc/bail
+
+non-tty:
+ @./bin/mocha \
+ --reporter dot \
+ test/acceptance/interfaces/bdd 2>&1 > /tmp/dot.out
+
+ @echo dot:
+ @cat /tmp/dot.out
+
+ @./bin/mocha \
+ --reporter list \
+ test/acceptance/interfaces/bdd 2>&1 > /tmp/list.out
+
+ @echo list:
+ @cat /tmp/list.out
+
+ @./bin/mocha \
+ --reporter spec \
+ test/acceptance/interfaces/bdd 2>&1 > /tmp/spec.out
+
+ @echo spec:
+ @cat /tmp/spec.out
+
+watch:
+ @watch -q $(MAKE) mocha.{js,css}
+
+tm:
+ mkdir -p $(TM_DEST)/$(TM_BUNDLE)
+ cp -fr editors/$(TM_BUNDLE) $(TM_DEST)/$(TM_BUNDLE)
+
+.PHONY: watch test test-all test-bdd test-tdd test-qunit test-exports test-unit non-tty test-grep tm clean
View
34 node_modules/mocha/Readme.md
@@ -0,0 +1,34 @@
+ [![Build Status](https://secure.travis-ci.org/visionmedia/mocha.png)](http://travis-ci.org/visionmedia/mocha)
+
+ [![Mocha test framework](http://f.cl.ly/items/3H1W3W3i3W163X0U3127/Screenshot.png)](http://visionmedia.github.com/mocha)
+
+ Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://visionmedia.github.com/mocha).
+
+## Contributors
+
+```
+project: mocha
+commits: 502
+files : 86
+authors:
+ 352 Tj Holowaychuk 70.1%
+ 98 TJ Holowaychuk 19.5%
+ 21 Guillermo Rauch 4.2%
+ 6 James Carr 1.2%
+ 4 Joshua Krall 0.8%
+ 3 Ben Lindsey 0.6%
+ 3 Nathan Rajlich 0.6%
+ 2 FARKAS Máté 0.4%
+ 2 Quang Van 0.4%
+ 1 Steve Mason 0.2%
+ 1 Yuest Wang 0.2%
+ 1 hokaccha 0.2%
+ 1 David Henderson 0.2%
+ 1 Fedor Indutny 0.2%
+ 1 Fredrik Lindin 0.2%
+ 1 Harry Brundage 0.2%
+ 1 Konstantin Käfer 0.2%
+ 1 Maciej Małecki 0.2%
+ 1 Raynos 0.2%
+ 1 Ryunosuke SATO 0.2%
+```
View
3,153 node_modules/mocha/_mocha.js
@@ -0,0 +1,3153 @@
+
+// CommonJS require()
+
+function require(p){
+ var path = require.resolve(p)
+ , mod = require.modules[path];
+ if (!mod) throw new Error('failed to require "' + p + '"');
+ if (!mod.exports) {
+ mod.exports = {};
+ mod.call(mod.exports, mod, mod.exports, require.relative(path));
+ }
+ return mod.exports;
+ }
+
+require.modules = {};
+
+require.resolve = function (path){
+ var orig = path
+ , reg = path + '.js'
+ , index = path + '/index.js';
+ return require.modules[reg] && reg
+ || require.modules[index] && index
+ || orig;
+ };
+
+require.register = function (path, fn){
+ require.modules[path] = fn;
+ };
+
+require.relative = function (parent) {
+ return function(p){
+ if ('.' != p.charAt(0)) return require(p);
+
+ var path = parent.split('/')
+ , segs = p.split('/');
+ path.pop();
+
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i];
+ if ('..' == seg) path.pop();
+ else if ('.' != seg) path.push(seg);
+ }
+
+ return require(path.join('/'));
+ };
+ };
+
+
+require.register("browser/debug.js", function(module, exports, require){
+
+module.exports = function(type){
+ return function(){
+
+ }
+};
+}); // module: browser/debug.js
+
+require.register("browser/events.js", function(module, exports, require){
+
+/**
+ * Module exports.
+ */
+
+exports.EventEmitter = EventEmitter;
+
+/**
+ * Check if `obj` is an array.
+ */
+
+function isArray(obj) {
+ return '[object Array]' == {}.toString.call(obj);
+}
+
+/**
+ * Event emitter constructor.
+ *
+ * @api public.
+ */
+
+function EventEmitter(){};
+
+/**
+ * Adds a listener.
+ *
+ * @api public
+ */
+
+EventEmitter.prototype.on = function (name, fn) {
+ if (!this.$events) {
+ this.$events = {};
+ }
+
+ if (!this.$events[name]) {
+ this.$events[name] = fn;
+ } else if (isArray(this.$events[name])) {
+ this.$events[name].push(fn);
+ } else {
+ this.$events[name] = [this.$events[name], fn];
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.addListener = EventEmitter.prototype.on;
+
+/**
+ * Adds a volatile listener.
+ *
+ * @api public
+ */
+
+EventEmitter.prototype.once = function (name, fn) {
+ var self = this;
+
+ function on () {
+ self.removeListener(name, on);
+ fn.apply(this, arguments);
+ };
+
+ on.listener = fn;
+ this.on(name, on);
+
+ return this;
+};
+
+/**
+ * Removes a listener.
+ *
+ * @api public
+ */
+
+EventEmitter.prototype.removeListener = function (name, fn) {
+ if (this.$events && this.$events[name]) {
+ var list = this.$events[name];
+
+ if (isArray(list)) {
+ var pos = -1;
+
+ for (var i = 0, l = list.length; i < l; i++) {
+ if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
+ pos = i;
+ break;
+ }
+ }
+
+ if (pos < 0) {
+ return this;
+ }
+
+ list.splice(pos, 1);
+
+ if (!list.length) {
+ delete this.$events[name];
+ }
+ } else if (list === fn || (list.listener && list.listener === fn)) {
+ delete this.$events[name];
+ }
+ }
+
+ return this;
+};
+
+/**
+ * Removes all listeners for an event.
+ *
+ * @api public
+ */
+
+EventEmitter.prototype.removeAllListeners = function (name) {
+ if (name === undefined) {
+ this.$events = {};
+ return this;
+ }
+
+ if (this.$events && this.$events[name]) {
+ this.$events[name] = null;
+ }
+
+ return this;
+};
+
+/**
+ * Gets all listeners for a certain event.
+ *
+ * @api publci
+ */
+
+EventEmitter.prototype.listeners = function (name) {
+ if (!this.$events) {
+ this.$events = {};
+ }
+
+ if (!this.$events[name]) {
+ this.$events[name] = [];
+ }
+
+ if (!isArray(this.$events[name])) {
+ this.$events[name] = [this.$events[name]];
+ }
+
+ return this.$events[name];
+};
+
+/**
+ * Emits an event.
+ *
+ * @api public
+ */
+
+EventEmitter.prototype.emit = function (name) {
+ if (!this.$events) {
+ return false;
+ }
+
+ var handler = this.$events[name];
+
+ if (!handler) {
+ return false;
+ }
+
+ var args = [].slice.call(arguments, 1);
+
+ if ('function' == typeof handler) {
+ handler.apply(this, args);
+ } else if (isArray(handler)) {
+ var listeners = handler.slice();
+
+ for (var i = 0, l = listeners.length; i < l; i++) {
+ listeners[i].apply(this, args);
+ }
+ } else {
+ return false;
+ }
+
+ return true;
+};
+}); // module: browser/events.js
+
+require.register("browser/fs.js", function(module, exports, require){
+
+}); // module: browser/fs.js
+
+require.register("browser/path.js", function(module, exports, require){
+
+}); // module: browser/path.js
+
+require.register("browser/progress.js", function(module, exports, require){
+
+/**
+ * Expose `Progress`.
+ */
+
+module.exports = Progress;
+
+/**
+ * Initialize a new `Progress` indicator.
+ */
+
+function Progress() {
+ this.percent = 0;
+ this.size(0);
+ this.fontSize(11);
+ this.font('helvetica, arial, sans-serif');
+}
+
+/**
+ * Set progress size to `n`.
+ *
+ * @param {Number} n
+ * @return {Progress} for chaining
+ * @api public
+ */
+
+Progress.prototype.size = function(n){
+ this._size = n;
+ return this;
+};
+
+/**
+ * Set text to `str`.
+ *
+ * @param {String} str
+ * @return {Progress} for chaining
+ * @api public
+ */
+
+Progress.prototype.text = function(str){
+ this._text = str;
+ return this;
+};
+
+/**
+ * Set font size to `n`.
+ *
+ * @param {Number} n
+ * @return {Progress} for chaining
+ * @api public
+ */
+
+Progress.prototype.fontSize = function(n){
+ this._fontSize = n;
+ return this;
+};
+
+/**
+ * Set font `family`.
+ *
+ * @param {String} family
+ * @return {Progress} for chaining
+ */
+
+Progress.prototype.font = function(family){
+ this._font = family;
+ return this;
+};
+
+/**
+ * Update percentage to `n`.
+ *
+ * @param {Number} n
+ * @return {Progress} for chaining
+ */
+
+Progress.prototype.update = function(n){
+ this.percent = n;
+ return this;
+};
+
+/**
+ * Draw on `ctx`.
+ *
+ * @param {CanvasRenderingContext2d} ctx
+ * @return {Progress} for chaining
+ */
+
+Progress.prototype.draw = function(ctx){
+ var percent = Math.min(this.percent, 100)
+ , size = this._size
+ , half = size / 2
+ , x = half
+ , y = half
+ , rad = half - 1
+ , fontSize = this._fontSize;
+
+ ctx.font = fontSize + 'px ' + this._font;
+
+ var angle = Math.PI * 2 * (percent / 100);
+ ctx.clearRect(0, 0, size, size);
+
+ // outer circle
+ ctx.strokeStyle = '#9f9f9f';
+ ctx.beginPath();
+ ctx.arc(x, y, rad, 0, angle, false);
+ ctx.stroke();
+
+ // inner circle
+ ctx.strokeStyle = '#eee';
+ ctx.beginPath();
+ ctx.arc(x, y, rad - 1, 0, angle, true);
+ ctx.stroke();
+
+ // text
+ var text = this._text || (percent | 0) + '%'
+ , w = ctx.measureText(text).width;
+
+ ctx.fillText(
+ text
+ , x - w / 2 + 1
+ , y + fontSize / 2 - 1);
+
+ return this;
+};
+
+}); // module: browser/progress.js
+
+require.register("browser/tty.js", function(module, exports, require){
+
+exports.isatty = function(){
+ return true;
+};
+
+exports.getWindowSize = function(){
+ return [window.innerHeight, window.innerWidth];
+};
+}); // module: browser/tty.js
+
+require.register("hook.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Runnable = require('./runnable');
+
+/**
+ * Expose `Hook`.
+ */
+
+module.exports = Hook;
+
+/**
+ * Initialize a new `Hook` with the given `title` and callback `fn`.
+ *
+ * @param {String} title
+ * @param {Function} fn
+ * @api private
+ */
+
+function Hook(title, fn) {
+ Runnable.call(this, title, fn);
+}
+
+/**
+ * Inherit from `Runnable.prototype`.
+ */
+
+Hook.prototype = new Runnable;
+Hook.prototype.constructor = Hook;
+
+
+}); // module: hook.js
+
+require.register("interfaces/bdd.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Suite = require('../suite')
+ , Test = require('../test');
+
+/**
+ * BDD-style interface:
+ *
+ * describe('Array', function(){
+ * describe('#indexOf()', function(){
+ * it('should return -1 when not present', function(){
+ *
+ * });
+ *
+ * it('should return the index when present', function(){
+ *
+ * });
+ * });
+ * });
+ *
+ */
+
+module.exports = function(suite){
+ var suites = [suite];
+
+ suite.on('pre-require', function(context){
+
+ /**
+ * Execute before running tests.
+ */
+
+ context.before = function(fn){
+ suites[0].beforeAll(fn);
+ };
+
+ /**
+ * Execute after running tests.
+ */
+
+ context.after = function(fn){
+ suites[0].afterAll(fn);
+ };
+
+ /**
+ * Execute before each test case.
+ */
+
+ context.beforeEach = function(fn){
+ suites[0].beforeEach(fn);
+ };
+
+ /**
+ * Execute after each test case.
+ */
+
+ context.afterEach = function(fn){
+ suites[0].afterEach(fn);
+ };
+
+ /**
+ * Describe a "suite" with the given `title`
+ * and callback `fn` containing nested suites
+ * and/or tests.
+ */
+
+ context.describe = function(title, fn){
+ var suite = Suite.create(suites[0], title);
+ suites.unshift(suite);
+ fn();
+ suites.shift();
+ };
+
+ /**
+ * Describe a specification or test-case
+ * with the given `title` and callback `fn`
+ * acting as a thunk.
+ */
+
+ context.it = function(title, fn){
+ suites[0].addTest(new Test(title, fn));
+ };
+ });
+};
+
+}); // module: interfaces/bdd.js
+
+require.register("interfaces/exports.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Suite = require('../suite')
+ , Test = require('../test');
+
+/**
+ * TDD-style interface:
+ *
+ * exports.Array = {
+ * '#indexOf()': {
+ * 'should return -1 when the value is not present': function(){
+ *
+ * },
+ *
+ * 'should return the correct index when the value is present': function(){
+ *
+ * }
+ * }
+ * };
+ *
+ */
+
+module.exports = function(suite){
+ var suites = [suite];
+
+ suite.on('require', visit);
+
+ function visit(obj) {
+ var suite;
+ for (var key in obj) {
+ if ('function' == typeof obj[key]) {
+ var fn = obj[key];
+ switch (key) {
+ case 'before':
+ suites[0].beforeAll(fn);
+ break;
+ case 'after':
+ suites[0].afterAll(fn);
+ break;
+ case 'beforeEach':
+ suites[0].beforeEach(fn);
+ break;
+ case 'afterEach':
+ suites[0].afterEach(fn);
+ break;
+ default:
+ suites[0].addTest(new Test(key, fn));
+ }
+ } else {
+ var suite = Suite.create(suites[0], key);
+ suites.unshift(suite);
+ visit(obj[key]);
+ suites.shift();
+ }
+ }
+ }
+};
+}); // module: interfaces/exports.js
+
+require.register("interfaces/index.js", function(module, exports, require){
+
+exports.bdd = require('./bdd');
+exports.tdd = require('./tdd');
+exports.qunit = require('./qunit');
+exports.exports = require('./exports');
+
+}); // module: interfaces/index.js
+
+require.register("interfaces/qunit.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Suite = require('../suite')
+ , Test = require('../test');
+
+/**
+ * QUnit-style interface:
+ *
+ * suite('Array');
+ *
+ * test('#length', function(){
+ * var arr = [1,2,3];
+ * ok(arr.length == 3);
+ * });
+ *
+ * test('#indexOf()', function(){
+ * var arr = [1,2,3];
+ * ok(arr.indexOf(1) == 0);
+ * ok(arr.indexOf(2) == 1);
+ * ok(arr.indexOf(3) == 2);
+ * });
+ *
+ * suite('String');
+ *
+ * test('#length', function(){
+ * ok('foo'.length == 3);
+ * });
+ *
+ */
+
+module.exports = function(suite){
+ var suites = [suite];
+
+ suite.on('pre-require', function(context){
+
+ /**
+ * Execute before running tests.
+ */
+
+ context.before = function(fn){
+ suites[0].beforeAll(fn);
+ };
+
+ /**
+ * Execute after running tests.
+ */
+
+ context.after = function(fn){
+ suites[0].afterAll(fn);
+ };
+
+ /**
+ * Execute before each test case.
+ */
+
+ context.beforeEach = function(fn){
+ suites[0].beforeEach(fn);
+ };
+
+ /**
+ * Execute after each test case.
+ */
+
+ context.afterEach = function(fn){
+ suites[0].afterEach(fn);
+ };
+
+ /**
+ * Describe a "suite" with the given `title`.
+ */
+
+ context.suite = function(title){
+ if (suites.length > 1) suites.shift();
+ var suite = Suite.create(suites[0], title);
+ suites.unshift(suite);
+ };
+
+ /**
+ * Describe a specification or test-case
+ * with the given `title` and callback `fn`
+ * acting as a thunk.
+ */
+
+ context.test = function(title, fn){
+ suites[0].addTest(new Test(title, fn));
+ };
+ });
+};
+
+}); // module: interfaces/qunit.js
+
+require.register("interfaces/tdd.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Suite = require('../suite')
+ , Test = require('../test');
+
+/**
+ * TDD-style interface:
+ *
+ * suite('Array', function(){
+ * suite('#indexOf()', function(){
+ * suiteSetup(function(){
+ *
+ * });
+ *
+ * test('should return -1 when not present', function(){
+ *
+ * });
+ *
+ * test('should return the index when present', function(){
+ *
+ * });
+ *
+ * suiteTeardown(function(){
+ *
+ * });
+ * });
+ * });
+ *
+ */
+
+module.exports = function(suite){
+ var suites = [suite];
+
+ suite.on('pre-require', function(context){
+
+ /**
+ * Execute before each test case.
+ */
+
+ context.setup = function(fn){
+ suites[0].beforeEach(fn);
+ };
+
+ /**
+ * Execute after each test case.
+ */
+
+ context.teardown = function(fn){
+ suites[0].afterEach(fn);
+ };
+
+ /**
+ * Execute before the suite.
+ */
+
+ context.suiteSetup = function(fn){
+ suites[0].beforeAll(fn);
+ };
+
+ /**
+ * Execute after the suite.
+ */
+
+ context.suiteTeardown = function(fn){
+ suites[0].afterAll(fn);
+ };
+
+ /**
+ * Describe a "suite" with the given `title`
+ * and callback `fn` containing nested suites
+ * and/or tests.
+ */
+
+ context.suite = function(title, fn){
+ var suite = Suite.create(suites[0], title);
+ suites.unshift(suite);
+ fn();
+ suites.shift();
+ };
+
+ /**
+ * Describe a specification or test-case
+ * with the given `title` and callback `fn`
+ * acting as a thunk.
+ */
+
+ context.test = function(title, fn){
+ suites[0].addTest(new Test(title, fn));
+ };
+ });
+};
+
+}); // module: interfaces/tdd.js
+
+require.register("mocha.js", function(module, exports, require){
+
+/*!
+ * mocha
+ * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Library version.
+ */
+
+exports.version = '0.12.0';
+
+exports.utils = require('./utils');
+exports.interfaces = require('./interfaces');
+exports.reporters = require('./reporters');
+exports.Runnable = require('./runnable');
+exports.Runner = require('./runner');
+exports.Suite = require('./suite');
+exports.Hook = require('./hook');
+exports.Test = require('./test');
+
+}); // module: mocha.js
+
+require.register("reporters/base.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var tty = require('browser/tty');
+
+/**
+ * Check if both stdio streams are associated with a tty.
+ */
+
+var isatty = tty.isatty(1) && tty.isatty(2);
+
+/**
+ * Expose `Base`.
+ */
+
+exports = module.exports = Base;
+
+/**
+ * Enable coloring by default.
+ */
+
+exports.useColors = isatty;
+
+/**
+ * Default color map.
+ */
+
+exports.colors = {
+ 'pass': 90
+ , 'fail': 31
+ , 'bright pass': 92
+ , 'bright fail': 91
+ , 'bright yellow': 93
+ , 'pending': 36
+ , 'suite': 0
+ , 'error title': 0
+ , 'error message': 31
+ , 'error stack': 90
+ , 'checkmark': 32
+ , 'fast': 90
+ , 'medium': 33
+ , 'slow': 31
+ , 'green': 32
+ , 'light': 90
+};
+
+/**
+ * Color `str` with the given `type`,
+ * allowing colors to be disabled,
+ * as well as user-defined color
+ * schemes.
+ *
+ * @param {String} type
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+var color = exports.color = function(type, str) {
+ if (!exports.useColors) return str;
+ return '\033[' + exports.colors[type] + 'm' + str + '\033[0m';
+};
+
+/**
+ * Expose term window size, with some
+ * defaults for when stderr is not a tty.
+ */
+
+exports.window = {
+ width: isatty
+ ? process.stdout.getWindowSize
+ ? process.stdout.getWindowSize(1)[0]
+ : tty.getWindowSize()[1]
+ : 75
+};
+
+/**
+ * Expose some basic cursor interactions
+ * that are common among reporters.
+ */
+
+exports.cursor = {
+ hide: function(){
+ process.stdout.write('\033[?25l');
+ },
+
+ show: function(){
+ process.stdout.write('\033[?25h');
+ },
+
+ deleteLine: function(){
+ process.stdout.write('\033[2K');
+ },
+
+ beginningOfLine: function(){
+ process.stdout.write('\033[0G');
+ },
+
+ CR: function(){
+ exports.cursor.deleteLine();
+ exports.cursor.beginningOfLine();
+ }
+};
+
+/**
+ * A test is considered slow if it
+ * exceeds the following value in milliseconds.
+ */
+
+exports.slow = 75;
+
+/**
+ * Outut the given `failures` as a list.
+ *
+ * @param {Array} failures
+ * @api public
+ */
+
+exports.list = function(failures){
+ console.error();
+ failures.forEach(function(test, i){
+ // format
+ var fmt = color('error title', ' %s) %s:\n')
+ + color('error message', ' %s')
+ + color('error stack', '\n%s\n');
+
+ // msg
+ var err = test.err
+ , message = err.message || ''
+ , stack = err.stack || message
+ , index = stack.indexOf(message) + message.length
+ , msg = stack.slice(0, index);
+
+ // indent stack trace without msg
+ stack = stack.slice(index + 1)
+ .replace(/^/gm, ' ');
+
+ console.error(fmt, (i + 1), test.fullTitle(), msg, stack);
+ });
+};
+
+/**
+ * Initialize a new `Base` reporter.
+ *
+ * All other reporters generally
+ * inherit from this reporter, providing
+ * stats such as test duration, number
+ * of tests passed / failed etc.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function Base(runner) {
+ var self = this
+ , stats = this.stats = { suites: 0, tests: 0, passes: 0, failures: 0 }
+ , failures = this.failures = [];
+
+ if (!runner) return;
+ this.runner = runner;
+
+ runner.on('start', function(){
+ stats.start = new Date;
+ });
+
+ runner.on('suite', function(suite){
+ stats.suites = stats.suites || 0;
+ suite.root || stats.suites++;
+ });
+
+ runner.on('test end', function(test){
+ stats.tests = stats.tests || 0;
+ stats.tests++;
+ });
+
+ runner.on('pass', function(test){
+ stats.passes = stats.passes || 0;
+
+ var medium = exports.slow / 2;
+ test.speed = test.duration > exports.slow
+ ? 'slow'
+ : test.duration > medium
+ ? 'medium'
+ : 'fast';
+
+ stats.passes++;
+ });
+
+ runner.on('fail', function(test, err){
+ stats.failures = stats.failures || 0;
+ stats.failures++;
+ test.err = err;
+ failures.push(test);
+ });
+
+ runner.on('end', function(){
+ stats.end = new Date;
+ stats.duration = new Date - stats.start;
+ });
+}
+
+/**
+ * Output common epilogue used by many of
+ * the bundled reporters.
+ *
+ * @api public
+ */
+
+Base.prototype.epilogue = function(){
+ var stats = this.stats
+ , fmt;
+
+ console.log();
+
+ // failure
+ if (stats.failures) {
+ fmt = color('bright fail', '')
+ + color('fail', ' %d of %d tests failed')
+ + color('light', ':')
+
+ console.error(fmt, stats.failures, this.runner.total);
+ Base.list(this.failures);
+ console.error();
+ return;
+ }
+
+ // pass
+ fmt = color('bright pass', '')
+ + color('green', ' %d tests complete')
+ + color('light', ' (%dms)');
+
+ console.log(fmt, stats.tests || 0, stats.duration);
+ console.log();
+};
+
+}); // module: reporters/base.js
+
+require.register("reporters/doc.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base')
+ , utils = require('../utils');
+
+/**
+ * Expose `Doc`.
+ */
+
+exports = module.exports = Doc;
+
+/**
+ * Initialize a new `Doc` reporter.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function Doc(runner) {
+ Base.call(this, runner);
+
+ var self = this
+ , stats = this.stats
+ , total = runner.total
+ , indents = 2;
+
+ function indent() {
+ return Array(indents).join(' ');
+ }
+
+ runner.on('suite', function(suite){
+ if (suite.root) return;
+ ++indents;
+ console.log('%s<section class="suite">', indent());
+ ++indents;
+ console.log('%s<h1>%s</h1>', indent(), suite.title);
+ console.log('%s<dl>', indent());
+ });
+
+ runner.on('suite end', function(suite){
+ if (suite.root) return;
+ console.log('%s</dl>', indent());
+ --indents;
+ console.log('%s</section>', indent());
+ --indents;
+ });
+
+ runner.on('pass', function(test){
+ console.log('%s <dt>%s</dt>', indent(), test.title);
+ var code = utils.escape(clean(test.fn.toString()));
+ console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
+ });
+}
+
+/**
+ * Strip the function definition from `str`,
+ * and re-indent for pre whitespace.
+ */
+
+function clean(str) {
+ str = str
+ .replace(/^function *\(.*\) *{/, '')
+ .replace(/\s+\}$/, '');
+
+ var spaces = str.match(/^\n?( *)/)[1].length
+ , re = new RegExp('^ {' + spaces + '}', 'gm');
+
+ str = str.replace(re, '');
+
+ return str;
+}
+}); // module: reporters/doc.js
+
+require.register("reporters/dot.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base')
+ , color = Base.color;
+
+/**
+ * Expose `Dot`.
+ */
+
+exports = module.exports = Dot;
+
+/**
+ * Initialize a new `Dot` matrix test reporter.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function Dot(runner) {
+ Base.call(this, runner);
+
+ var self = this
+ , stats = this.stats
+ , width = Base.window.width * .75 | 0
+ , n = 0;
+
+ runner.on('start', function(){
+ process.stdout.write('\n ');
+ });
+
+ runner.on('pending', function(test){
+ process.stdout.write(color('pending', '.'));
+ });
+
+ runner.on('pass', function(test){
+ if (++n % width == 0) process.stdout.write('\n ');
+ if ('slow' == test.speed) {
+ process.stdout.write(color('bright yellow', '.'));
+ } else {
+ process.stdout.write(color(test.speed, '.'));
+ }
+ });
+
+ runner.on('fail', function(test, err){
+ if (++n % width == 0) process.stdout.write('\n ');
+ process.stdout.write(color('fail', '.'));
+ });
+
+ runner.on('end', function(){
+ console.log();
+ self.epilogue();
+ });
+}
+
+/**
+ * Inherit from `Base.prototype`.
+ */
+
+Dot.prototype = new Base;
+Dot.prototype.constructor = Dot;
+
+}); // module: reporters/dot.js
+
+require.register("reporters/html.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base')
+ , utils = require('../utils')
+ , Progress = require('../browser/progress')
+ , escape = utils.escape;
+
+/**
+ * Expose `Doc`.
+ */
+
+exports = module.exports = HTML;
+
+/**
+ * Stats template.
+ */
+
+var statsTemplate = '<ul id="stats">'
+ + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
+ + '<li class="passes">passes: <em>0</em></li>'
+ + '<li class="failures">failures: <em>0</em></li>'
+ + '<li class="duration">duration: <em>0</em>s</li>'
+ + '</ul>';
+
+/**
+ * Initialize a new `Doc` reporter.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function HTML(runner) {
+ Base.call(this, runner);
+
+ // TODO: clean up
+
+ var self = this
+ , stats = this.stats
+ , total = runner.total
+ , root = $('#mocha')
+ , stack = [root]
+ , stat = $(statsTemplate).appendTo(root)
+ , canvas = stat.find('canvas').get(0)
+ , progress
+ , ctx
+
+ if (canvas.getContext) {
+ ctx = canvas.getContext('2d');
+ progress = new Progress;
+ }
+
+ if (!root.length) return error('#mocha div missing, add it to your document');
+
+ if (progress) progress.size(40);
+
+ runner.on('suite', function(suite){
+ if (suite.root) return;
+
+ // suite
+ var el = $('<div class="suite"><h1>' + suite.title + '</h1></div>');
+
+ // container
+ stack[0].append(el);
+ stack.unshift($('<div>'));
+ el.append(stack[0]);
+ });
+
+ runner.on('suite end', function(suite){
+ if (suite.root) return;
+ stack.shift();
+ });
+
+ runner.on('fail', function(test, err){
+ if (err.uncaught) runner.emit('test end', test);
+ });
+
+ runner.on('test end', function(test){
+ // TODO: add to stats
+ var percent = stats.tests / total * 100 | 0;
+
+ if (progress) {
+ progress.update(percent).draw(ctx);
+ }
+
+ // update stats
+ var ms = new Date - stats.start;
+ stat.find('.passes em').text(stats.passes);
+ stat.find('.failures em').text(stats.failures);
+ stat.find('.duration em').text((ms / 1000).toFixed(2));
+
+ // test
+ if (test.passed) {
+ var el = $('<div class="test pass"><h2>' + escape(test.title) + '</h2></div>')
+ } else if (test.pending) {
+ var el = $('<div class="test pass pending"><h2>' + escape(test.title) + '</h2></div>')
+ } else {
+ var el = $('<div class="test fail"><h2>' + escape(test.title) + '</h2></div>');
+ var str = test.err.stack || test.err;
+
+ // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
+ // check for the result of the stringifying.
+ if ('[object Error]' == str) str = test.err.message;
+
+ $('<pre class="error">' + escape(str) + '</pre>').appendTo(el);
+ }
+
+ // toggle code
+ el.find('h2').toggle(function(){
+ pre && pre.slideDown('fast');
+ }, function(){
+ pre && pre.slideUp('fast');
+ });
+
+ // code
+ // TODO: defer
+ if (!test.pending) {
+ var code = escape(clean(test.fn.toString()));
+ var pre = $('<pre><code>' + code + '</code></pre>');
+ pre.appendTo(el).hide();
+ }
+ stack[0].append(el);
+ });
+}
+
+/**
+ * Display error `msg`.
+ */
+
+function error(msg) {
+ $('<div id="error">' + msg + '</div>').appendTo('body');
+}
+
+/**
+ * Strip the function definition from `str`,
+ * and re-indent for pre whitespace.
+ */
+
+function clean(str) {
+ str = str
+ .replace(/^function *\(.*\) *{/, '')
+ .replace(/\s+\}$/, '');
+
+ var spaces = str.match(/^\n?( *)/)[1].length
+ , re = new RegExp('^ {' + spaces + '}', 'gm');
+
+ str = str
+ .replace(re, '')
+ .replace(/^\s+/, '');
+
+ return str;
+}
+
+}); // module: reporters/html.js
+
+require.register("reporters/index.js", function(module, exports, require){
+
+exports.Base = require('./base');
+exports.Dot = require('./dot');
+exports.Doc = require('./doc');
+exports.TAP = require('./tap');
+exports.JSON = require('./json');
+exports.HTML = require('./html');
+exports.List = require('./list');
+exports.Spec = require('./spec');
+exports.Progress = require('./progress');
+exports.Landing = require('./landing');
+exports.JSONStream = require('./json-stream');
+exports.XUnit = require('./xunit')
+
+}); // module: reporters/index.js
+
+require.register("reporters/json-stream.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base')
+ , color = Base.color;
+
+/**
+ * Expose `List`.
+ */
+
+exports = module.exports = List;
+
+/**
+ * Initialize a new `List` test reporter.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function List(runner) {
+ Base.call(this, runner);
+
+ var self = this
+ , stats = this.stats
+ , total = runner.total;
+
+ runner.on('start', function(){
+ console.log(JSON.stringify(['start', { total: total }]));
+ });
+
+ runner.on('pass', function(test){
+ console.log(JSON.stringify(['pass', clean(test)]));
+ });
+
+ runner.on('fail', function(test, err){
+ console.log(JSON.stringify(['fail', clean(test)]));
+ });
+
+ runner.on('end', function(){
+ process.stdout.write(JSON.stringify(['end', self.stats]));
+ });
+}
+
+/**
+ * Return a plain-object representation of `test`
+ * free of cyclic properties etc.
+ *
+ * @param {Object} test
+ * @return {Object}
+ * @api private
+ */
+
+function clean(test) {
+ return {
+ title: test.title
+ , fullTitle: test.fullTitle()
+ , duration: test.duration
+ }
+}
+}); // module: reporters/json-stream.js
+
+require.register("reporters/json.js", function(module, exports, require){
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base')
+ , cursor = Base.cursor
+ , color = Base.color;
+
+/**
+ * Expose `JSON`.
+ */
+
+exports = module.exports = JSONReporter;
+
+/**
+ * Initialize a new `JSON` reporter.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function JSONReporter(runner) {
+ var self = this;
+ Base.call(this, runner);
+
+ var tests = []
+ , failures = []
+ , passes = [];
+
+ runner.on('test end', function(test){
+ tests.push(test);
+ });
+
+ runner.on('pass', function(test){
+ passes.push(test);
+ });
+
+ runner.on('fail', function(test){
+ failures.push(test);
+ });
+
+ runner.on('end', function(){
+ var obj = {
+ stats: self.stats
+ , tests: tests.map(clean)
+ , failures: failures.map(clean)
+ , passes: passes.map(clean)
+ };
+
+ process.stdout.write(JSON.stringify(obj));
+ });
+}
+
+/**
+ * Return a plain-object representation of `test`
+ * free of cyclic properties etc.
+ *
+ * @param {Object} test
+ * @return {Object}
+ * @api private
+ */
+
+function clean(test) {
+ return {
+ title: test.title
+ , fullTitle: test.fullTitle()
+ , duration: test.duration
+ }