Added node modules
This commit is contained in:
		
							
								
								
									
										4
									
								
								node_modules/mocha/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/mocha/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| support | ||||
| test | ||||
| examples | ||||
| *.sock | ||||
							
								
								
									
										5
									
								
								node_modules/mocha/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/mocha/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| language: node_js | ||||
| node_js: | ||||
|   - 0.4 | ||||
|   - 0.6 | ||||
|   - 0.7 | ||||
							
								
								
									
										263
									
								
								node_modules/mocha/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										263
									
								
								node_modules/mocha/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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 | ||||
							
								
								
									
										22
									
								
								node_modules/mocha/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								node_modules/mocha/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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. | ||||
							
								
								
									
										99
									
								
								node_modules/mocha/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								node_modules/mocha/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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 | ||||
							
								
								
									
										34
									
								
								node_modules/mocha/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								node_modules/mocha/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
|  [](http://travis-ci.org/visionmedia/mocha) | ||||
|  | ||||
|   [](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% | ||||
| ``` | ||||
							
								
								
									
										3153
									
								
								node_modules/mocha/_mocha.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3153
									
								
								node_modules/mocha/_mocha.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										320
									
								
								node_modules/mocha/bin/_mocha
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										320
									
								
								node_modules/mocha/bin/_mocha
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,320 @@ | ||||
| #!/usr/bin/env node | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var program = require('commander') | ||||
|   , exec = require('child_process').exec | ||||
|   , path = require('path') | ||||
|   , resolve = path.resolve | ||||
|   , mocha = require('../') | ||||
|   , utils = mocha.utils | ||||
|   , reporters = mocha.reporters | ||||
|   , interfaces = mocha.interfaces | ||||
|   , Runner = mocha.Runner | ||||
|   , Suite = mocha.Suite | ||||
|   , vm = require('vm') | ||||
|   , fs = require('fs') | ||||
|   , join = path.join | ||||
|   , cwd = process.cwd(); | ||||
|  | ||||
| /** | ||||
|  * Files. | ||||
|  */ | ||||
|  | ||||
| var files = []; | ||||
|  | ||||
| /** | ||||
|  * Images. | ||||
|  */ | ||||
|  | ||||
| var images = { | ||||
|     fail: __dirname + '/../images/error.png' | ||||
|   , pass: __dirname + '/../images/ok.png' | ||||
| }; | ||||
|  | ||||
| // options | ||||
|  | ||||
| program | ||||
|   .version(mocha.version) | ||||
|   .usage('[options] [files]') | ||||
|   .option('-r, --require <name>', 'require the given module') | ||||
|   .option('-R, --reporter <name>', 'specify the reporter to use', 'dot') | ||||
|   .option('-u, --ui <name>', 'specify user-interface (bdd|tdd|exports)', 'bdd') | ||||
|   .option('-g, --grep <pattern>', 'only run tests matching <pattern>') | ||||
|   .option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]') | ||||
|   .option('-s, --slow <ms>', '"slow" test threshold in milliseconds [75]', parseInt) | ||||
|   .option('-w, --watch', 'watch files for changes') | ||||
|   .option('-c, --colors', 'force enabling of colors') | ||||
|   .option('-C, --no-colors', 'force disabling of colors') | ||||
|   .option('-G, --growl', 'enable growl notification support') | ||||
|   .option('-d, --debug', "enable node's debugger") | ||||
|   .option('-b, --bail', "bail after first test failure") | ||||
|   .option('--globals <names>', 'allow the given comma-delimited global [names]', list, []) | ||||
|   .option('--ignore-leaks', 'ignore global variable leaks') | ||||
|   .option('--interfaces', 'display available interfaces') | ||||
|   .option('--reporters', 'display available reporters') | ||||
|  | ||||
| program.name = 'mocha'; | ||||
|  | ||||
| // --reporters | ||||
|  | ||||
| program.on('reporters', function(){ | ||||
|   console.log(); | ||||
|   console.log('    dot - dot matrix'); | ||||
|   console.log('    doc - html documentation'); | ||||
|   console.log('    spec - hierarchical spec list'); | ||||
|   console.log('    json - single json object'); | ||||
|   console.log('    progress - progress bar'); | ||||
|   console.log('    list - spec-style listing'); | ||||
|   console.log('    tap - test-anything-protocol'); | ||||
|   console.log('    landing - unicode landing strip'); | ||||
|   console.log('    xunit - xunit reportert'); | ||||
|   console.log('    teamcity - teamcity ci support'); | ||||
|   console.log('    json-stream - newline delimited json events'); | ||||
|   console.log(); | ||||
|   process.exit(); | ||||
| }); | ||||
|  | ||||
| // --interfaces | ||||
|  | ||||
| program.on('interfaces', function(){ | ||||
|   console.log(''); | ||||
|   console.log('    bdd'); | ||||
|   console.log('    tdd'); | ||||
|   console.log('    qunit'); | ||||
|   console.log('    exports'); | ||||
|   console.log(''); | ||||
|   process.exit(); | ||||
| }); | ||||
|  | ||||
| // -r, --require | ||||
|  | ||||
| module.paths.push(cwd, join(cwd, 'node_modules')); | ||||
|  | ||||
| program.on('require', function(mod){ | ||||
|   var abs = path.existsSync(mod) | ||||
|     || path.existsSync(mod + '.js'); | ||||
|  | ||||
|   if (abs) mod = join(cwd, mod); | ||||
|   require(mod); | ||||
| }); | ||||
|  | ||||
| // mocha.opts support | ||||
|  | ||||
| try { | ||||
|   var opts = fs.readFileSync('test/mocha.opts', 'utf8') | ||||
|     .trim() | ||||
|     .split(/\s+/); | ||||
|  | ||||
|   process.argv = process.argv | ||||
|     .slice(0, 2) | ||||
|     .concat(opts.concat(process.argv.slice(2))); | ||||
| } catch (err) { | ||||
|   // ignore | ||||
| } | ||||
|  | ||||
| // parse args | ||||
|  | ||||
| program.parse(process.argv); | ||||
|  | ||||
| // infinite stack traces | ||||
|  | ||||
| Error.stackTraceLimit = Infinity; // TODO: config | ||||
|  | ||||
| // reporter | ||||
|  | ||||
| var suite = new Suite('') | ||||
|   , Base = require('../lib/reporters/base') | ||||
|   , Reporter = require('../lib/reporters/' + program.reporter) | ||||
|   , ui = interfaces[program.ui](suite); | ||||
|  | ||||
| // --no-colors | ||||
|  | ||||
| if (!program.colors) Base.useColors = false; | ||||
|  | ||||
| // --colors | ||||
|  | ||||
| if (~process.argv.indexOf('--colors') || | ||||
|     ~process.argv.indexOf('-c')) { | ||||
|   Base.useColors = true; | ||||
| } | ||||
|  | ||||
| // --slow <ms> | ||||
|  | ||||
| if (program.slow) Base.slow = program.slow; | ||||
|  | ||||
| // --timeout | ||||
|  | ||||
| if (program.timeout) suite.timeout(program.timeout); | ||||
|  | ||||
| // --bail | ||||
|  | ||||
| suite.bail(program.bail); | ||||
|  | ||||
| // files | ||||
|  | ||||
| var files = program.args | ||||
|   , re = /\.js$/; | ||||
|  | ||||
| // coffee-script support | ||||
|  | ||||
| try { | ||||
|   require('coffee-script'); | ||||
|   re = /\.(js|coffee)$/; | ||||
| } catch (err) { | ||||
|   // ignore | ||||
| } | ||||
|  | ||||
| // default files to test/*.{js,coffee} | ||||
|  | ||||
| if (!files.length) { | ||||
|   files = fs.readdirSync('test').filter(function(path){ | ||||
|     return path.match(re); | ||||
|   }).map(function(path){ | ||||
|     return join('test', path); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // resolve | ||||
|  | ||||
| files = files.map(function(path){ | ||||
|   return resolve(path); | ||||
| }); | ||||
|  | ||||
| // --watch | ||||
|  | ||||
| if (program.watch) { | ||||
|   console.log(); | ||||
|   hideCursor(); | ||||
|   process.on('SIGINT', function(){ | ||||
|     showCursor(); | ||||
|     console.log('\n'); | ||||
|     process.exit(); | ||||
|   }); | ||||
|  | ||||
|   var frames = [ | ||||
|       '  \033[96m◜ \033[90mwatching\033[0m' | ||||
|     , '  \033[96m◠ \033[90mwatching\033[0m' | ||||
|     , '  \033[96m◝ \033[90mwatching\033[0m' | ||||
|     , '  \033[96m◞ \033[90mwatching\033[0m' | ||||
|     , '  \033[96m◡ \033[90mwatching\033[0m' | ||||
|     , '  \033[96m◟ \033[90mwatching\033[0m' | ||||
|   ]; | ||||
|  | ||||
|   play(frames); | ||||
|  | ||||
|   utils.watch(utils.files(cwd), function(){ | ||||
|     stop() | ||||
|     suite = suite.clone(); | ||||
|     ui = interfaces[program.ui](suite); | ||||
|     load(files, function(){ | ||||
|       run(suite, function(){ | ||||
|         play(frames); | ||||
|       }); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   return; | ||||
| } | ||||
|  | ||||
| // load | ||||
|  | ||||
| load(files, function(){ | ||||
|   run(suite, process.exit); | ||||
| }); | ||||
|  | ||||
| // require test files before | ||||
| // running the root suite | ||||
|  | ||||
| function load(files, fn) { | ||||
|   var pending = files.length; | ||||
|   files.forEach(function(file){ | ||||
|     delete require.cache[file]; | ||||
|     suite.emit('pre-require', global, file); | ||||
|     suite.emit('require', require(file), file); | ||||
|     suite.emit('post-require', global, file); | ||||
|     --pending || fn(); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // run the given suite | ||||
|  | ||||
| function run(suite, fn) { | ||||
|   suite.emit('run'); | ||||
|   var runner = new Runner(suite); | ||||
|   var reporter = new Reporter(runner); | ||||
|   runner.globals(program.globals); | ||||
|   if (program.ignoreLeaks) runner.ignoreLeaks = true; | ||||
|   if (program.grep) runner.grep(new RegExp(program.grep)); | ||||
|   if (program.growl) growl(runner, reporter); | ||||
|   runner.run(fn); | ||||
| } | ||||
|  | ||||
| // enable growl notifications | ||||
|  | ||||
| function growl(runner, reporter) { | ||||
|   var notify = require('growl'); | ||||
|  | ||||
|   runner.on('end', function(){ | ||||
|     var stats = reporter.stats; | ||||
|     if (stats.failures) { | ||||
|       var msg = stats.failures + ' of ' + runner.total + ' tests failed'; | ||||
|       notify(msg, { title: 'Failed', image: images.fail }); | ||||
|     } else { | ||||
|       notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { | ||||
|           title: 'Passed' | ||||
|         , image: images.pass | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Parse list. | ||||
|  */ | ||||
|  | ||||
| function list(str) { | ||||
|   return str.split(/ *, */); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Hide the cursor. | ||||
|  */ | ||||
|  | ||||
| function hideCursor(){ | ||||
|   process.stdout.write('\033[?25l'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Show the cursor. | ||||
|  */ | ||||
|  | ||||
| function showCursor(){ | ||||
|   process.stdout.write('\033[?25h'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Stop play()ing. | ||||
|  */ | ||||
|  | ||||
| function stop() { | ||||
|   process.stdout.write('\033[2K'); | ||||
|   clearInterval(play.timer); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Play the given array of strings. | ||||
|  */ | ||||
|  | ||||
| function play(arr, interval) { | ||||
|   var len = arr.length | ||||
|     , interval = interval || 100 | ||||
|     , i = 0; | ||||
|  | ||||
|   play.timer = setInterval(function(){ | ||||
|     var str = arr[i++ % len]; | ||||
|     process.stdout.write('\r' + str); | ||||
|   }, interval); | ||||
| } | ||||
							
								
								
									
										28
									
								
								node_modules/mocha/bin/mocha
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								node_modules/mocha/bin/mocha
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #!/usr/bin/env node | ||||
|  | ||||
| /** | ||||
|  * This tiny wrapper file checks for known node flags and appends them | ||||
|  * when found, before invoking the "real" _mocha(1) executable. | ||||
|  */ | ||||
|  | ||||
| var spawn = require('child_process').spawn | ||||
|   , args = [ __dirname + '/_mocha' ]; | ||||
|  | ||||
| process.argv.slice(2).forEach(function (arg) { | ||||
|   switch (arg) { | ||||
|     case '-d': | ||||
|     case '--debug': | ||||
|       args.unshift('debug'); | ||||
|       break; | ||||
|     case '-gc': | ||||
|     case '--expose-gc': | ||||
|       args.unshift('--expose-gc'); | ||||
|       break; | ||||
|     default: | ||||
|       args.push(arg); | ||||
|       break; | ||||
|   } | ||||
| }); | ||||
|  | ||||
| var proc = spawn(process.argv[0], args, { customFds: [0,1,2] }); | ||||
| proc.on('exit', process.exit); | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>content</key> | ||||
| 	<string>afterEach(function(){ | ||||
|   $0 | ||||
| })</string> | ||||
| 	<key>name</key> | ||||
| 	<string>bdd - after each</string> | ||||
| 	<key>tabTrigger</key> | ||||
| 	<string>ae</string> | ||||
| 	<key>uuid</key> | ||||
| 	<string>7B4DA8F4-2064-468B-B252-054148419B4B</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>content</key> | ||||
| 	<string>after(function(){ | ||||
|   $0 | ||||
| })</string> | ||||
| 	<key>name</key> | ||||
| 	<string>bdd - after</string> | ||||
| 	<key>tabTrigger</key> | ||||
| 	<string>a</string> | ||||
| 	<key>uuid</key> | ||||
| 	<string>A49A87F9-399E-4D74-A489-C535BB06D487</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>content</key> | ||||
| 	<string>beforeEach(function(){ | ||||
|   $0 | ||||
| })</string> | ||||
| 	<key>name</key> | ||||
| 	<string>bdd - before each</string> | ||||
| 	<key>tabTrigger</key> | ||||
| 	<string>be</string> | ||||
| 	<key>uuid</key> | ||||
| 	<string>7AB064E3-EFBB-4FA7-98CA-9E87C10CC04E</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>content</key> | ||||
| 	<string>before(function(){ | ||||
|   $0 | ||||
| })</string> | ||||
| 	<key>name</key> | ||||
| 	<string>bdd - before</string> | ||||
| 	<key>tabTrigger</key> | ||||
| 	<string>b</string> | ||||
| 	<key>uuid</key> | ||||
| 	<string>DF6F1F42-F80A-4A24-AF78-376F19070C4C</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>content</key> | ||||
| 	<string>it('should $1', function(){ | ||||
|   $0 | ||||
| })</string> | ||||
| 	<key>name</key> | ||||
| 	<string>bdd - it</string> | ||||
| 	<key>tabTrigger</key> | ||||
| 	<string>it</string> | ||||
| 	<key>uuid</key> | ||||
| 	<string>591AE071-95E4-4E1E-B0F3-A7DAF41595EE</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/untitled.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/untitled.tmSnippet
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>content</key> | ||||
| 	<string>describe('$1', function(){ | ||||
|   $0 | ||||
| })</string> | ||||
| 	<key>name</key> | ||||
| 	<string>bdd - describe</string> | ||||
| 	<key>tabTrigger</key> | ||||
| 	<string>des</string> | ||||
| 	<key>uuid</key> | ||||
| 	<string>4AA1FB50-9BB9-400E-A140-D61C39BDFDF5</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										19
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/info.plist
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								node_modules/mocha/editors/JavaScript mocha.tmbundle/info.plist
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | ||||
| <dict> | ||||
| 	<key>name</key> | ||||
| 	<string>JavaScript mocha</string> | ||||
| 	<key>ordering</key> | ||||
| 	<array> | ||||
| 		<string>4AA1FB50-9BB9-400E-A140-D61C39BDFDF5</string> | ||||
| 		<string>591AE071-95E4-4E1E-B0F3-A7DAF41595EE</string> | ||||
| 		<string>DF6F1F42-F80A-4A24-AF78-376F19070C4C</string> | ||||
| 		<string>A49A87F9-399E-4D74-A489-C535BB06D487</string> | ||||
| 		<string>7AB064E3-EFBB-4FA7-98CA-9E87C10CC04E</string> | ||||
| 		<string>7B4DA8F4-2064-468B-B252-054148419B4B</string> | ||||
| 	</array> | ||||
| 	<key>uuid</key> | ||||
| 	<string>094ACE33-0C0E-422A-B3F7-5B919F5B1239</string> | ||||
| </dict> | ||||
| </plist> | ||||
							
								
								
									
										
											BIN
										
									
								
								node_modules/mocha/images/error.png
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								node_modules/mocha/images/error.png
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.1 KiB | 
							
								
								
									
										
											BIN
										
									
								
								node_modules/mocha/images/ok.png
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								node_modules/mocha/images/ok.png
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 649 B | 
							
								
								
									
										2
									
								
								node_modules/mocha/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/mocha/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
|  | ||||
| module.exports = require('./lib/mocha'); | ||||
							
								
								
									
										6
									
								
								node_modules/mocha/lib/browser/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								node_modules/mocha/lib/browser/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
|  | ||||
| module.exports = function(type){ | ||||
|   return function(){ | ||||
|      | ||||
|   } | ||||
| }; | ||||
							
								
								
									
										178
									
								
								node_modules/mocha/lib/browser/events.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								node_modules/mocha/lib/browser/events.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,178 @@ | ||||
|  | ||||
| /** | ||||
|  * 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; | ||||
| }; | ||||
							
								
								
									
										0
									
								
								node_modules/mocha/lib/browser/fs.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								node_modules/mocha/lib/browser/fs.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								node_modules/mocha/lib/browser/path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								node_modules/mocha/lib/browser/path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
								
								
									
										125
									
								
								node_modules/mocha/lib/browser/progress.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								node_modules/mocha/lib/browser/progress.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,125 @@ | ||||
|  | ||||
| /** | ||||
|  * 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; | ||||
| }; | ||||
							
								
								
									
										8
									
								
								node_modules/mocha/lib/browser/tty.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/mocha/lib/browser/tty.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
|  | ||||
| exports.isatty = function(){ | ||||
|   return true; | ||||
| }; | ||||
|  | ||||
| exports.getWindowSize = function(){ | ||||
|   return [window.innerHeight, window.innerWidth]; | ||||
| }; | ||||
							
								
								
									
										30
									
								
								node_modules/mocha/lib/hook.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/mocha/lib/hook.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
|  | ||||
| /** | ||||
|  * 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.__proto__ = Runnable.prototype; | ||||
							
								
								
									
										86
									
								
								node_modules/mocha/lib/interfaces/bdd.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								node_modules/mocha/lib/interfaces/bdd.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | ||||
|  | ||||
| /** | ||||
|  * 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)); | ||||
|     }; | ||||
|   }); | ||||
| }; | ||||
							
								
								
									
										60
									
								
								node_modules/mocha/lib/interfaces/exports.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								node_modules/mocha/lib/interfaces/exports.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
|  | ||||
| /** | ||||
|  * 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(); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| }; | ||||
							
								
								
									
										5
									
								
								node_modules/mocha/lib/interfaces/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/mocha/lib/interfaces/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| exports.bdd = require('./bdd'); | ||||
| exports.tdd = require('./tdd'); | ||||
| exports.qunit = require('./qunit'); | ||||
| exports.exports = require('./exports'); | ||||
							
								
								
									
										91
									
								
								node_modules/mocha/lib/interfaces/qunit.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								node_modules/mocha/lib/interfaces/qunit.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | ||||
|  | ||||
| /** | ||||
|  * 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)); | ||||
|     }; | ||||
|   }); | ||||
| }; | ||||
							
								
								
									
										94
									
								
								node_modules/mocha/lib/interfaces/tdd.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								node_modules/mocha/lib/interfaces/tdd.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
|  | ||||
| /** | ||||
|  * 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)); | ||||
|     }; | ||||
|   }); | ||||
| }; | ||||
							
								
								
									
										21
									
								
								node_modules/mocha/lib/mocha.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/mocha/lib/mocha.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
|  | ||||
| /*! | ||||
|  * 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'); | ||||
							
								
								
									
										236
									
								
								node_modules/mocha/lib/reporters/base.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										236
									
								
								node_modules/mocha/lib/reporters/base.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,236 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var tty = require('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(); | ||||
| }; | ||||
							
								
								
									
										74
									
								
								node_modules/mocha/lib/reporters/doc.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								node_modules/mocha/lib/reporters/doc.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
|  | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
							
								
								
									
										62
									
								
								node_modules/mocha/lib/reporters/dot.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								node_modules/mocha/lib/reporters/dot.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | ||||
|  | ||||
| /** | ||||
|  * 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.__proto__ = Base.prototype; | ||||
							
								
								
									
										154
									
								
								node_modules/mocha/lib/reporters/html.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										154
									
								
								node_modules/mocha/lib/reporters/html.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,154 @@ | ||||
|  | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
							
								
								
									
										13
									
								
								node_modules/mocha/lib/reporters/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								node_modules/mocha/lib/reporters/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
|  | ||||
| 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') | ||||
							
								
								
									
										61
									
								
								node_modules/mocha/lib/reporters/json-stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								node_modules/mocha/lib/reporters/json-stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
|  | ||||
| /** | ||||
|  * 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 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										70
									
								
								node_modules/mocha/lib/reporters/json.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								node_modules/mocha/lib/reporters/json.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
|  | ||||
| /** | ||||
|  * 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 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										97
									
								
								node_modules/mocha/lib/reporters/landing.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								node_modules/mocha/lib/reporters/landing.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base') | ||||
|   , cursor = Base.cursor | ||||
|   , color = Base.color; | ||||
|  | ||||
| /** | ||||
|  * Expose `Landing`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = Landing; | ||||
|  | ||||
| /** | ||||
|  * Airplane color. | ||||
|  */ | ||||
|  | ||||
| Base.colors.plane = 0; | ||||
|  | ||||
| /** | ||||
|  * Airplane crash color. | ||||
|  */ | ||||
|  | ||||
| Base.colors['plane crash'] = 31; | ||||
|  | ||||
| /** | ||||
|  * Runway color. | ||||
|  */ | ||||
|  | ||||
| Base.colors.runway = 90; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Landing` reporter. | ||||
|  * | ||||
|  * @param {Runner} runner | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Landing(runner) { | ||||
|   Base.call(this, runner); | ||||
|  | ||||
|   var self = this | ||||
|     , stats = this.stats | ||||
|     , width = Base.window.width * .75 | 0 | ||||
|     , total = runner.total | ||||
|     , stream = process.stdout | ||||
|     , plane = color('plane', '✈') | ||||
|     , crashed = -1 | ||||
|     , n = 0; | ||||
|  | ||||
|   function runway() { | ||||
|     var buf = Array(width).join('-'); | ||||
|     return '  ' + color('runway', buf); | ||||
|   } | ||||
|  | ||||
|   runner.on('start', function(){ | ||||
|     stream.write('\n  '); | ||||
|     cursor.hide(); | ||||
|   }); | ||||
|  | ||||
|   runner.on('test end', function(test){ | ||||
|     // check if the plane crashed | ||||
|     var col = -1 == crashed | ||||
|       ? width * ++n / total | 0 | ||||
|       : crashed; | ||||
|  | ||||
|     // show the crash | ||||
|     if (test.failed) { | ||||
|       plane = color('plane crash', '✈'); | ||||
|       crashed = col; | ||||
|     } | ||||
|  | ||||
|     // render landing strip | ||||
|     stream.write('\033[4F\n\n'); | ||||
|     stream.write(runway()); | ||||
|     stream.write('\n  '); | ||||
|     stream.write(color('runway', Array(col).join('⋅'))); | ||||
|     stream.write(plane) | ||||
|     stream.write(color('runway', Array(width - col).join('⋅') + '\n')); | ||||
|     stream.write(runway()); | ||||
|     stream.write('\033[0m'); | ||||
|   }); | ||||
|  | ||||
|   runner.on('end', function(){ | ||||
|     cursor.show(); | ||||
|     console.log(); | ||||
|     self.epilogue(); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `Base.prototype`. | ||||
|  */ | ||||
|  | ||||
| Landing.prototype.__proto__ = Base.prototype; | ||||
							
								
								
									
										64
									
								
								node_modules/mocha/lib/reporters/list.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								node_modules/mocha/lib/reporters/list.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base') | ||||
|   , cursor = Base.cursor | ||||
|   , 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 | ||||
|     , n = 0; | ||||
|  | ||||
|   runner.on('start', function(){ | ||||
|     console.log(); | ||||
|   }); | ||||
|  | ||||
|   runner.on('test', function(test){ | ||||
|     process.stdout.write(color('pass', '    ' + test.fullTitle() + ': ')); | ||||
|   }); | ||||
|  | ||||
|   runner.on('pending', function(test){ | ||||
|     var fmt = color('checkmark', '  -') | ||||
|       + color('pending', ' %s'); | ||||
|     console.log(fmt, test.fullTitle()); | ||||
|   }); | ||||
|  | ||||
|   runner.on('pass', function(test){ | ||||
|     var fmt = color('checkmark', '  ✓') | ||||
|       + color('pass', ' %s: ') | ||||
|       + color(test.speed, '%dms'); | ||||
|     cursor.CR(); | ||||
|     console.log(fmt, test.fullTitle(), test.duration); | ||||
|   }); | ||||
|  | ||||
|   runner.on('fail', function(test, err){ | ||||
|     cursor.CR(); | ||||
|     console.log(color('fail', '  %d) %s'), ++n, test.fullTitle()); | ||||
|   }); | ||||
|  | ||||
|   runner.on('end', self.epilogue.bind(self)); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `Base.prototype`. | ||||
|  */ | ||||
|  | ||||
| List.prototype.__proto__ = Base.prototype; | ||||
							
								
								
									
										85
									
								
								node_modules/mocha/lib/reporters/progress.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								node_modules/mocha/lib/reporters/progress.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base') | ||||
|   , cursor = Base.cursor | ||||
|   , color = Base.color; | ||||
|  | ||||
| /** | ||||
|  * Expose `Progress`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = Progress; | ||||
|  | ||||
| /** | ||||
|  * General progress bar color. | ||||
|  */ | ||||
|  | ||||
| Base.colors.progress = 90; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Progress` bar test reporter. | ||||
|  * | ||||
|  * @param {Runner} runner | ||||
|  * @param {Object} options | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Progress(runner, options) { | ||||
|   Base.call(this, runner); | ||||
|  | ||||
|   var self = this | ||||
|     , options = options || {} | ||||
|     , stats = this.stats | ||||
|     , width = Base.window.width * .50 | 0 | ||||
|     , total = runner.total | ||||
|     , complete = 0 | ||||
|     , max = Math.max; | ||||
|  | ||||
|   // default chars | ||||
|   options.open = options.open || '['; | ||||
|   options.complete = options.complete || '▬'; | ||||
|   options.incomplete = options.incomplete || '⋅'; | ||||
|   options.close = options.close || ']'; | ||||
|   options.verbose = false; | ||||
|  | ||||
|   // tests started | ||||
|   runner.on('start', function(){ | ||||
|     console.log(); | ||||
|     cursor.hide(); | ||||
|   }); | ||||
|  | ||||
|   // tests complete | ||||
|   runner.on('test end', function(){ | ||||
|     var incomplete = total - complete | ||||
|       , percent = complete++ / total | ||||
|       , n = width * percent | 0 | ||||
|       , i = width - n; | ||||
|  | ||||
|     cursor.CR(); | ||||
|     process.stdout.write('\033[J'); | ||||
|     process.stdout.write(color('progress', '  ' + options.open)); | ||||
|     process.stdout.write(Array(n).join(options.complete)); | ||||
|     process.stdout.write(Array(i).join(options.incomplete)); | ||||
|     process.stdout.write(color('progress', options.close)); | ||||
|     if (options.verbose) { | ||||
|       process.stdout.write(color('progress', ' ' + complete + ' of ' + total)); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   // tests are complete, output some stats | ||||
|   // and the failures if any | ||||
|   runner.on('end', function(){ | ||||
|     cursor.show(); | ||||
|     console.log(); | ||||
|     self.epilogue(); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `Base.prototype`. | ||||
|  */ | ||||
|  | ||||
| Progress.prototype.__proto__ = Base.prototype; | ||||
							
								
								
									
										87
									
								
								node_modules/mocha/lib/reporters/spec.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								node_modules/mocha/lib/reporters/spec.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base') | ||||
|   , cursor = Base.cursor | ||||
|   , color = Base.color; | ||||
|  | ||||
| /** | ||||
|  * Expose `Spec`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = Spec; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Spec` test reporter. | ||||
|  * | ||||
|  * @param {Runner} runner | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Spec(runner) { | ||||
|   Base.call(this, runner); | ||||
|  | ||||
|   var self = this | ||||
|     , stats = this.stats | ||||
|     , indents = 0 | ||||
|     , n = 0; | ||||
|  | ||||
|   function indent() { | ||||
|     return Array(indents).join('  ') | ||||
|   } | ||||
|  | ||||
|   runner.on('start', function(){ | ||||
|     console.log(); | ||||
|   }); | ||||
|  | ||||
|   runner.on('suite', function(suite){ | ||||
|     ++indents; | ||||
|     console.log(color('suite', '%s%s'), indent(), suite.title); | ||||
|   }); | ||||
|  | ||||
|   runner.on('suite end', function(suite){ | ||||
|     --indents; | ||||
|     if (1 == indents) console.log(); | ||||
|   }); | ||||
|  | ||||
|   runner.on('test', function(test){ | ||||
|     process.stdout.write(indent() + color('pass', '  ◦ ' + test.title + ': ')); | ||||
|   }); | ||||
|  | ||||
|   runner.on('pending', function(test){ | ||||
|     var fmt = indent() + color('pending', '  - %s'); | ||||
|     console.log(fmt, test.title); | ||||
|   }); | ||||
|  | ||||
|   runner.on('pass', function(test){ | ||||
|     if ('fast' == test.speed) { | ||||
|       var fmt = indent() | ||||
|         + color('checkmark', '  ✓') | ||||
|         + color('pass', ' %s '); | ||||
|       cursor.CR(); | ||||
|       console.log(fmt, test.title); | ||||
|     } else { | ||||
|       var fmt = indent() | ||||
|         + color('checkmark', '  ✓') | ||||
|         + color('pass', ' %s ') | ||||
|         + color(test.speed, '(%dms)'); | ||||
|       cursor.CR(); | ||||
|       console.log(fmt, test.title, test.duration); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   runner.on('fail', function(test, err){ | ||||
|     cursor.CR(); | ||||
|     console.log(indent() + color('fail', '  %d) %s'), ++n, test.title); | ||||
|   }); | ||||
|  | ||||
|   runner.on('end', self.epilogue.bind(self)); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `Base.prototype`. | ||||
|  */ | ||||
|  | ||||
| Spec.prototype.__proto__ = Base.prototype; | ||||
							
								
								
									
										63
									
								
								node_modules/mocha/lib/reporters/tap.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								node_modules/mocha/lib/reporters/tap.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base') | ||||
|   , cursor = Base.cursor | ||||
|   , color = Base.color; | ||||
|  | ||||
| /** | ||||
|  * Expose `TAP`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = TAP; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `TAP` reporter. | ||||
|  * | ||||
|  * @param {Runner} runner | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function TAP(runner) { | ||||
|   Base.call(this, runner); | ||||
|  | ||||
|   var self = this | ||||
|     , stats = this.stats | ||||
|     , total = runner.total | ||||
|     , n = 1; | ||||
|  | ||||
|   runner.on('start', function(){ | ||||
|     console.log('%d..%d', 1, total); | ||||
|   }); | ||||
|  | ||||
|   runner.on('test end', function(){ | ||||
|     ++n; | ||||
|   }); | ||||
|  | ||||
|   runner.on('pending', function(test){ | ||||
|     console.log('ok %d %s # SKIP -', n, title(test)); | ||||
|   }); | ||||
|  | ||||
|   runner.on('pass', function(test){ | ||||
|     console.log('ok %d %s', n, title(test)); | ||||
|   }); | ||||
|  | ||||
|   runner.on('fail', function(test, err){ | ||||
|     console.log('not ok %d %s', n, title(test)); | ||||
|     console.log(err.stack.replace(/^/gm, '  ')); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Return a TAP-safe title of `test` | ||||
|  * | ||||
|  * @param {Object} test | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function title(test) { | ||||
|   return test.fullTitle().replace(/#/g, ''); | ||||
| } | ||||
							
								
								
									
										56
									
								
								node_modules/mocha/lib/reporters/teamcity.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								node_modules/mocha/lib/reporters/teamcity.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base'); | ||||
|  | ||||
| /** | ||||
|  * Expose `Teamcity`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = Teamcity; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Teamcity` reporter. | ||||
|  * | ||||
|  * @param {Runner} runner | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Teamcity(runner) { | ||||
|   Base.call(this, runner); | ||||
|   var stats = this.stats; | ||||
|  | ||||
|   runner.on('start', function() { | ||||
|     console.log("##teamcity[testSuiteStarted name='mocha.suite']"); | ||||
|   }); | ||||
|  | ||||
|   runner.on('test', function(test) { | ||||
|     console.log("##teamcity[testStarted name='%s']", escape(test.fullTitle())); | ||||
|   }); | ||||
|  | ||||
|   runner.on('fail', function(test, err) { | ||||
|     console.log("##teamcity[testFailed name='%s' message='%s']", escape(test.fullTitle()), escape(err.message)); | ||||
|   }); | ||||
|  | ||||
|   runner.on('pending', function(test) { | ||||
|     console.log("##teamcity[testIgnored name='%s' message='pending']", escape(test.fullTitle())); | ||||
|   }); | ||||
|  | ||||
|   runner.on('test end', function(test) { | ||||
|     console.log("##teamcity[testFinished name='%s' duration='%s']", escape(test.fullTitle()), test.duration); | ||||
|   }); | ||||
|  | ||||
|   runner.on('end', function() { | ||||
|     console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='%s']", stats.duration); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Escape the given `str`. | ||||
|  */ | ||||
|  | ||||
| function escape(str) { | ||||
|   return str.replace(/'/g, "|'"); | ||||
| } | ||||
							
								
								
									
										101
									
								
								node_modules/mocha/lib/reporters/xunit.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								node_modules/mocha/lib/reporters/xunit.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,101 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Base = require('./base') | ||||
|   , utils = require('../utils') | ||||
|   , escape = utils.escape; | ||||
|  | ||||
| /** | ||||
|  * Expose `XUnit`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = XUnit; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `XUnit` reporter. | ||||
|  * | ||||
|  * @param {Runner} runner | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function XUnit(runner) { | ||||
|   Base.call(this, runner); | ||||
|   var stats = this.stats | ||||
|     , tests = [] | ||||
|     , self = this; | ||||
|  | ||||
|   runner.on('test end', function(test){ | ||||
|     tests.push(test); | ||||
|   }); | ||||
|  | ||||
|   runner.on('end', function(){ | ||||
|     console.log(tag('testsuite', { | ||||
|         name: 'Mocha Tests' | ||||
|       , tests: stats.tests | ||||
|       , failures: stats.failures | ||||
|       , errors: stats.failures | ||||
|       , skip: stats.tests - stats.failures - stats.passes | ||||
|       , timestamp: (new Date).toUTCString() | ||||
|       , time: stats.duration / 1000 | ||||
|     }, false)); | ||||
|  | ||||
|     tests.forEach(test); | ||||
|     console.log('</testsuite>');     | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `Base.prototype`. | ||||
|  */ | ||||
|  | ||||
| XUnit.prototype.__proto__ = Base.prototype; | ||||
|  | ||||
| /** | ||||
|  * Output tag for the given `test.` | ||||
|  */ | ||||
|  | ||||
| function test(test) { | ||||
|   var attrs = { | ||||
|       classname: test.parent.fullTitle() | ||||
|     , name: test.title | ||||
|     , time: test.duration / 1000 | ||||
|   }; | ||||
|  | ||||
|   if (test.failed) { | ||||
|     var err = test.err; | ||||
|     attrs.message = escape(err.message); | ||||
|     console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); | ||||
|   } else if (test.pending) { | ||||
|     console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); | ||||
|   } else { | ||||
|     console.log(tag('testcase', attrs, true) ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * HTML tag helper. | ||||
|  */ | ||||
|  | ||||
| function tag(name, attrs, close, content) { | ||||
|   var end = close ? '/>' : '>' | ||||
|     , pairs = [] | ||||
|     , tag; | ||||
|  | ||||
|   for (var key in attrs) { | ||||
|     pairs.push(key + '="' + escape(attrs[key]) + '"'); | ||||
|   } | ||||
|  | ||||
|   tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; | ||||
|   if (content) tag += content + '</' + name + end; | ||||
|   return tag; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Return cdata escaped CDATA `str`. | ||||
|  */ | ||||
|  | ||||
| function cdata(str) { | ||||
|   return '<![CDATA[' + escape(str) + ']]>'; | ||||
| } | ||||
							
								
								
									
										163
									
								
								node_modules/mocha/lib/runnable.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								node_modules/mocha/lib/runnable.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,163 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var EventEmitter = require('events').EventEmitter | ||||
|   , debug = require('debug')('runnable'); | ||||
|  | ||||
| /** | ||||
|  * Expose `Runnable`. | ||||
|  */ | ||||
|  | ||||
| module.exports = Runnable; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Runnable` with the given `title` and callback `fn`. | ||||
|  * | ||||
|  * @param {String} title | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function Runnable(title, fn) { | ||||
|   this.title = title; | ||||
|   this.fn = fn; | ||||
|   this.async = fn && fn.length; | ||||
|   this.sync = ! this.async; | ||||
|   this._timeout = 2000; | ||||
|   this.timedOut = false; | ||||
|   this.context = this; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `EventEmitter.prototype`. | ||||
|  */ | ||||
|  | ||||
| Runnable.prototype.__proto__ = EventEmitter.prototype; | ||||
|  | ||||
| /** | ||||
|  * Set & get timeout `ms`. | ||||
|  * | ||||
|  * @param {Number} ms | ||||
|  * @return {Runnable|Number} ms or self | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runnable.prototype.timeout = function(ms){ | ||||
|   if (0 == arguments.length) return this._timeout; | ||||
|   debug('timeout %d', ms); | ||||
|   this._timeout = ms; | ||||
|   if (this.timer) this.resetTimeout(); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return the full title generated by recursively | ||||
|  * concatenating the parent's full title. | ||||
|  * | ||||
|  * @return {String} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Runnable.prototype.fullTitle = function(){ | ||||
|   return this.parent.fullTitle() + ' ' + this.title; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Clear the timeout. | ||||
|  * | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runnable.prototype.clearTimeout = function(){ | ||||
|   clearTimeout(this.timer); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Reset the timeout. | ||||
|  * | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runnable.prototype.resetTimeout = function(){ | ||||
|   var self = this | ||||
|     , ms = this.timeout(); | ||||
|  | ||||
|   this.clearTimeout(); | ||||
|   if (ms) { | ||||
|     this.timer = setTimeout(function(){ | ||||
|       self.callback(new Error('timeout of ' + ms + 'ms exceeded')); | ||||
|       self.timedOut = true; | ||||
|     }, ms); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run the test and invoke `fn(err)`. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runnable.prototype.run = function(fn){ | ||||
|   var self = this | ||||
|     , ms = this.timeout() | ||||
|     , start = new Date | ||||
|     , ctx = this.context | ||||
|     , finished | ||||
|     , emitted; | ||||
|  | ||||
|   // timeout | ||||
|   if (this.async) { | ||||
|     if (ms) { | ||||
|       this.timer = setTimeout(function(){ | ||||
|         done(new Error('timeout of ' + ms + 'ms exceeded')); | ||||
|         self.timedOut = true; | ||||
|       }, ms); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // called multiple times | ||||
|   function multiple() { | ||||
|     if (emitted) return; | ||||
|     emitted = true; | ||||
|     self.emit('error', new Error('done() called multiple times')); | ||||
|   } | ||||
|  | ||||
|   // finished | ||||
|   function done(err) { | ||||
|     if (self.timedOut) return; | ||||
|     if (finished) return multiple(); | ||||
|     self.clearTimeout(); | ||||
|     self.duration = new Date - start; | ||||
|     finished = true; | ||||
|     fn(err); | ||||
|   } | ||||
|  | ||||
|   // for .resetTimeout() | ||||
|   this.callback = done; | ||||
|  | ||||
|   // async | ||||
|   if (this.async) { | ||||
|     try { | ||||
|       this.fn.call(ctx, function(err){ | ||||
|         if (err instanceof Error) return done(err); | ||||
|         if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); | ||||
|         done(); | ||||
|       }); | ||||
|     } catch (err) { | ||||
|       done(err); | ||||
|     } | ||||
|     return; | ||||
|   } | ||||
|    | ||||
|   // sync | ||||
|   try { | ||||
|     if (!this.pending) this.fn.call(ctx); | ||||
|     this.duration = new Date - start; | ||||
|     fn(); | ||||
|   } catch (err) { | ||||
|     fn(err); | ||||
|   } | ||||
| }; | ||||
							
								
								
									
										432
									
								
								node_modules/mocha/lib/runner.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										432
									
								
								node_modules/mocha/lib/runner.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,432 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var EventEmitter = require('events').EventEmitter | ||||
|   , debug = require('debug')('runner') | ||||
|   , Test = require('./test') | ||||
|   , utils = require('./utils') | ||||
|   , noop = function(){}; | ||||
|  | ||||
| /** | ||||
|  * Expose `Runner`. | ||||
|  */ | ||||
|  | ||||
| module.exports = Runner; | ||||
|  | ||||
| /** | ||||
|  * Initialize a `Runner` for the given `suite`. | ||||
|  * | ||||
|  * Events: | ||||
|  * | ||||
|  *   - `start`  execution started | ||||
|  *   - `end`  execution complete | ||||
|  *   - `suite`  (suite) test suite execution started | ||||
|  *   - `suite end`  (suite) all tests (and sub-suites) have finished | ||||
|  *   - `test`  (test) test execution started | ||||
|  *   - `test end`  (test) test completed | ||||
|  *   - `hook`  (hook) hook execution started | ||||
|  *   - `hook end`  (hook) hook complete | ||||
|  *   - `pass`  (test) test passed | ||||
|  *   - `fail`  (test, err) test failed | ||||
|  * | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Runner(suite) { | ||||
|   var self = this; | ||||
|   this._globals = []; | ||||
|   this.suite = suite; | ||||
|   this.total = suite.total(); | ||||
|   this.failures = 0; | ||||
|   this.on('test end', function(test){ self.checkGlobals(test); }); | ||||
|   this.on('hook end', function(hook){ self.checkGlobals(hook); }); | ||||
|   this.grep(/.*/); | ||||
|   this.globals(utils.keys(global).concat(['errno'])); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `EventEmitter.prototype`. | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.__proto__ = EventEmitter.prototype; | ||||
|  | ||||
| /** | ||||
|  * Run tests with full titles matching `re`. | ||||
|  * | ||||
|  * @param {RegExp} re | ||||
|  * @return {Runner} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.grep = function(re){ | ||||
|   debug('grep %s', re); | ||||
|   this._grep = re; | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Allow the given `arr` of globals. | ||||
|  * | ||||
|  * @param {Array} arr | ||||
|  * @return {Runner} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.globals = function(arr){ | ||||
|   if (0 == arguments.length) return this._globals; | ||||
|   debug('globals %j', arr); | ||||
|   utils.forEach(arr, function(arr){ | ||||
|     this._globals.push(arr); | ||||
|   }, this); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Check for global variable leaks. | ||||
|  * | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.checkGlobals = function(test){ | ||||
|   if (this.ignoreLeaks) return; | ||||
|  | ||||
|   var leaks = utils.filter(utils.keys(global), function(key){ | ||||
|     return !~utils.indexOf(this._globals, key) && (!global.navigator || 'onerror' !== key); | ||||
|   }, this); | ||||
|  | ||||
|   this._globals = this._globals.concat(leaks); | ||||
|  | ||||
|   if (leaks.length > 1) { | ||||
|     this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + '')); | ||||
|   } else if (leaks.length) { | ||||
|     this.fail(test, new Error('global leak detected: ' + leaks[0])); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Fail the given `test`. | ||||
|  * | ||||
|  * @param {Test} test | ||||
|  * @param {Error} err | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.fail = function(test, err){ | ||||
|   ++this.failures; | ||||
|   test.failed = true; | ||||
|   this.emit('fail', test, err); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Fail the given `hook` with `err`. | ||||
|  * | ||||
|  * Hook failures (currently) hard-end due | ||||
|  * to that fact that a failing hook will | ||||
|  * surely cause subsequent tests to fail, | ||||
|  * causing jumbled reporting. | ||||
|  * | ||||
|  * @param {Hook} hook | ||||
|  * @param {Error} err | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.failHook = function(hook, err){ | ||||
|   this.fail(hook, err); | ||||
|   this.emit('end'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run hook `name` callbacks and then invoke `fn()`. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @param {Function} function | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.hook = function(name, fn){ | ||||
|   var suite = this.suite | ||||
|     , hooks = suite['_' + name] | ||||
|     , ms = suite._timeout | ||||
|     , self = this | ||||
|     , timer; | ||||
|  | ||||
|   function next(i) { | ||||
|     var hook = hooks[i]; | ||||
|     if (!hook) return fn(); | ||||
|     self.currentRunnable = hook; | ||||
|     hook.context = self.test; | ||||
|  | ||||
|     self.emit('hook', hook); | ||||
|  | ||||
|     hook.on('error', function(err){ | ||||
|       self.failHook(hook, err); | ||||
|     }); | ||||
|  | ||||
|     hook.run(function(err){ | ||||
|       hook.removeAllListeners('error'); | ||||
|       if (err) return self.failHook(hook, err); | ||||
|       self.emit('hook end', hook); | ||||
|       next(++i); | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   process.nextTick(function(){ | ||||
|     next(0); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run hook `name` for the given array of `suites` | ||||
|  * in order, and callback `fn(err)`. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @param {Array} suites | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.hooks = function(name, suites, fn){ | ||||
|   var self = this | ||||
|     , orig = this.suite; | ||||
|  | ||||
|   function next(suite) { | ||||
|     self.suite = suite; | ||||
|  | ||||
|     if (!suite) { | ||||
|       self.suite = orig; | ||||
|       return fn(); | ||||
|     } | ||||
|  | ||||
|     self.hook(name, function(err){ | ||||
|       if (err) { | ||||
|         self.suite = orig; | ||||
|         return fn(err); | ||||
|       } | ||||
|  | ||||
|       next(suites.pop()); | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   next(suites.pop()); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run hooks from the top level down. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.hookUp = function(name, fn){ | ||||
|   var suites = [this.suite].concat(this.parents()).reverse(); | ||||
|   this.hooks(name, suites, fn); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run hooks from the bottom up. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.hookDown = function(name, fn){ | ||||
|   var suites = [this.suite].concat(this.parents()); | ||||
|   this.hooks(name, suites, fn); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return an array of parent Suites from | ||||
|  * closest to furthest. | ||||
|  * | ||||
|  * @return {Array} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.parents = function(){ | ||||
|   var suite = this.suite | ||||
|     , suites = []; | ||||
|   while (suite = suite.parent) suites.push(suite); | ||||
|   return suites; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run the current test and callback `fn(err)`. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.runTest = function(fn){ | ||||
|   var test = this.test | ||||
|     , self = this; | ||||
|  | ||||
|   try { | ||||
|     test.on('error', function(err){ | ||||
|       self.fail(test, err); | ||||
|     }); | ||||
|     test.run(fn); | ||||
|   } catch (err) { | ||||
|     fn(err); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run tests in the given `suite` and invoke | ||||
|  * the callback `fn()` when complete. | ||||
|  * | ||||
|  * @param {Suite} suite | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.runTests = function(suite, fn){ | ||||
|   var self = this | ||||
|     , tests = suite.tests | ||||
|     , test; | ||||
|  | ||||
|   function next(err) { | ||||
|     // if we bail after first err | ||||
|     if (self.failures && suite._bail) return fn(); | ||||
|  | ||||
|     // next test | ||||
|     test = tests.shift(); | ||||
|  | ||||
|     // all done | ||||
|     if (!test) return fn(); | ||||
|  | ||||
|     // grep | ||||
|     if (!self._grep.test(test.fullTitle())) return next(); | ||||
|  | ||||
|     // pending | ||||
|     if (test.pending) { | ||||
|       self.emit('pending', test); | ||||
|       self.emit('test end', test); | ||||
|       return next(); | ||||
|     } | ||||
|  | ||||
|     // execute test and hook(s) | ||||
|     self.emit('test', self.test = test); | ||||
|     self.hookDown('beforeEach', function(){ | ||||
|       self.currentRunnable = self.test; | ||||
|       self.runTest(function(err){ | ||||
|         test = self.test; | ||||
|  | ||||
|         if (err) { | ||||
|           self.fail(test, err); | ||||
|           self.emit('test end', test); | ||||
|           return self.hookUp('afterEach', next); | ||||
|         } | ||||
|  | ||||
|         test.passed = true; | ||||
|         self.emit('pass', test); | ||||
|         self.emit('test end', test); | ||||
|         self.hookUp('afterEach', next); | ||||
|       }); | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   this.next = next; | ||||
|   next(); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run the given `suite` and invoke the | ||||
|  * callback `fn()` when complete. | ||||
|  * | ||||
|  * @param {Suite} suite | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.runSuite = function(suite, fn){ | ||||
|   var self = this | ||||
|     , i = 0; | ||||
|  | ||||
|   debug('run suite %s', suite.fullTitle()); | ||||
|   this.emit('suite', this.suite = suite); | ||||
|  | ||||
|   function next() { | ||||
|     var curr = suite.suites[i++]; | ||||
|     if (!curr) return done(); | ||||
|     self.runSuite(curr, next); | ||||
|   } | ||||
|  | ||||
|   function done() { | ||||
|     self.suite = suite; | ||||
|     self.hook('afterAll', function(){ | ||||
|       self.emit('suite end', suite); | ||||
|       fn(); | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   this.hook('beforeAll', function(){ | ||||
|     self.runTests(suite, next); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Handle uncaught exceptions. | ||||
|  * | ||||
|  * @param {Error} err | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.uncaught = function(err){ | ||||
|   debug('uncaught exception'); | ||||
|   var runnable = this.currentRunnable; | ||||
|   if (runnable.failed) return; | ||||
|   runnable.clearTimeout(); | ||||
|   err.uncaught = true; | ||||
|   this.fail(runnable, err); | ||||
|  | ||||
|   // recover from test | ||||
|   if ('test' == runnable.type) { | ||||
|     this.emit('test end', runnable); | ||||
|     this.hookUp('afterEach', this.next); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   // bail on hooks | ||||
|   this.emit('end'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run the root suite and invoke `fn(failures)` | ||||
|  * on completion. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @return {Runner} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Runner.prototype.run = function(fn){ | ||||
|   var self = this | ||||
|     , fn = fn || function(){}; | ||||
|  | ||||
|   debug('start'); | ||||
|  | ||||
|   // callback | ||||
|   this.on('end', function(){ | ||||
|     debug('end'); | ||||
|     process.removeListener('uncaughtException', this.uncaught); | ||||
|     fn(self.failures); | ||||
|   }); | ||||
|  | ||||
|   // run suites | ||||
|   this.emit('start'); | ||||
|   this.runSuite(this.suite, function(){ | ||||
|     debug('finished running'); | ||||
|     self.emit('end'); | ||||
|   }); | ||||
|  | ||||
|   // uncaught exception | ||||
|   process.on('uncaughtException', function(err){ | ||||
|     self.uncaught(err); | ||||
|   }); | ||||
|  | ||||
|   return this; | ||||
| }; | ||||
							
								
								
									
										238
									
								
								node_modules/mocha/lib/suite.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										238
									
								
								node_modules/mocha/lib/suite.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,238 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var EventEmitter = require('events').EventEmitter | ||||
|   , debug = require('debug')('suite') | ||||
|   , utils = require('./utils') | ||||
|   , Hook = require('./hook'); | ||||
|  | ||||
| /** | ||||
|  * Expose `Suite`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = Suite; | ||||
|  | ||||
| /** | ||||
|  * Create a new `Suite` with the given `title` | ||||
|  * and parent `Suite`. When a suite with the | ||||
|  * same title is already present, that suite | ||||
|  * is returned to provide nicer reporter | ||||
|  * and more flexible meta-testing. | ||||
|  * | ||||
|  * @param {Suite} parent | ||||
|  * @param {String} title | ||||
|  * @return {Suite} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| exports.create = function(parent, title){ | ||||
|   var suite = new Suite(title); | ||||
|   suite.parent = parent; | ||||
|   title = suite.fullTitle(); | ||||
|   parent.addSuite(suite); | ||||
|   return suite; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Suite` with the given `title`. | ||||
|  * | ||||
|  * @param {String} title | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function Suite(title) { | ||||
|   this.title = title; | ||||
|   this.suites = []; | ||||
|   this.tests = []; | ||||
|   this._beforeEach = []; | ||||
|   this._beforeAll = []; | ||||
|   this._afterEach = []; | ||||
|   this._afterAll = []; | ||||
|   this.root = !title; | ||||
|   this._timeout = 2000; | ||||
|   this._bail = false; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `EventEmitter.prototype`. | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.__proto__ = EventEmitter.prototype; | ||||
|  | ||||
| /** | ||||
|  * Return a clone of this `Suite`. | ||||
|  * | ||||
|  * @return {Suite} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.clone = function(){ | ||||
|   var suite = new Suite(this.title); | ||||
|   debug('clone'); | ||||
|   suite.timeout(this.timeout()); | ||||
|   suite.bail(this.bail()); | ||||
|   return suite; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Set timeout `ms` or short-hand such as "2s". | ||||
|  * | ||||
|  * @param {Number|String} ms | ||||
|  * @return {Suite|Number} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.timeout = function(ms){ | ||||
|   if (0 == arguments.length) return this._timeout; | ||||
|   if (String(ms).match(/s$/)) ms = parseFloat(ms) * 1000; | ||||
|   debug('timeout %d', ms); | ||||
|   this._timeout = parseInt(ms, 10); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Sets whether to bail after first error. | ||||
|  * | ||||
|  * @parma {Boolean} bail | ||||
|  * @return {Suite|Number} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.bail = function(bail){ | ||||
|   if (0 == arguments.length) return this._bail; | ||||
|   debug('bail %s', bail); | ||||
|   this._bail = bail; | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run `fn(test[, done])` before running tests. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @return {Suite} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.beforeAll = function(fn){ | ||||
|   var hook = new Hook('"before all" hook', fn); | ||||
|   hook.parent = this; | ||||
|   hook.timeout(this.timeout()); | ||||
|   this._beforeAll.push(hook); | ||||
|   this.emit('beforeAll', hook); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run `fn(test[, done])` after running tests. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @return {Suite} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.afterAll = function(fn){ | ||||
|   var hook = new Hook('"after all" hook', fn); | ||||
|   hook.parent = this; | ||||
|   hook.timeout(this.timeout()); | ||||
|   this._afterAll.push(hook); | ||||
|   this.emit('afterAll', hook); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run `fn(test[, done])` before each test case. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @return {Suite} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.beforeEach = function(fn){ | ||||
|   var hook = new Hook('"before each" hook', fn); | ||||
|   hook.parent = this; | ||||
|   hook.timeout(this.timeout()); | ||||
|   this._beforeEach.push(hook); | ||||
|   this.emit('beforeEach', hook); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run `fn(test[, done])` after each test case. | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @return {Suite} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.afterEach = function(fn){ | ||||
|   var hook = new Hook('"after each" hook', fn); | ||||
|   hook.parent = this; | ||||
|   hook.timeout(this.timeout()); | ||||
|   this._afterEach.push(hook); | ||||
|   this.emit('afterEach', hook); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Add a test `suite`. | ||||
|  * | ||||
|  * @param {Suite} suite | ||||
|  * @return {Suite} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.addSuite = function(suite){ | ||||
|   suite.parent = this; | ||||
|   suite.timeout(this.timeout()); | ||||
|   suite.bail(this.bail()); | ||||
|   this.suites.push(suite); | ||||
|   this.emit('suite', suite); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Add a `test` to this suite. | ||||
|  * | ||||
|  * @param {Test} test | ||||
|  * @return {Suite} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.addTest = function(test){ | ||||
|   test.parent = this; | ||||
|   test.timeout(this.timeout()); | ||||
|   this.tests.push(test); | ||||
|   this.emit('test', test); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return the full title generated by recursively | ||||
|  * concatenating the parent's full title. | ||||
|  * | ||||
|  * @return {String} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.fullTitle = function(){ | ||||
|   if (this.parent) { | ||||
|     var full = this.parent.fullTitle(); | ||||
|     if (full) return full + ' ' + this.title; | ||||
|   } | ||||
|   return this.title; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return the total number of tests. | ||||
|  * | ||||
|  * @return {Number} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Suite.prototype.total = function(){ | ||||
|   return utils.reduce(this.suites, function(sum, suite){ | ||||
|     return sum + suite.total(); | ||||
|   }, 0) + this.tests.length; | ||||
| }; | ||||
							
								
								
									
										32
									
								
								node_modules/mocha/lib/test.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								node_modules/mocha/lib/test.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var Runnable = require('./runnable'); | ||||
|  | ||||
| /** | ||||
|  * Expose `Test`. | ||||
|  */ | ||||
|  | ||||
| module.exports = Test; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Test` with the given `title` and callback `fn`. | ||||
|  * | ||||
|  * @param {String} title | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function Test(title, fn) { | ||||
|   Runnable.call(this, title, fn); | ||||
|   this.pending = !fn; | ||||
|   this.type = 'test'; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `Runnable.prototype`. | ||||
|  */ | ||||
|  | ||||
| Test.prototype.__proto__ = Runnable.prototype; | ||||
							
								
								
									
										175
									
								
								node_modules/mocha/lib/utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										175
									
								
								node_modules/mocha/lib/utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,175 @@ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var fs = require('fs') | ||||
|   , path = require('path') | ||||
|   , join = path.join | ||||
|   , debug = require('debug')('watch'); | ||||
|  | ||||
| /** | ||||
|  * Ignored directories. | ||||
|  */ | ||||
|  | ||||
| var ignore = ['node_modules', '.git']; | ||||
|  | ||||
| /** | ||||
|  * Escape special characters in the given string of html. | ||||
|  * | ||||
|  * @param  {String} html | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.escape = function(html) { | ||||
|   return String(html) | ||||
|     .replace(/&/g, '&') | ||||
|     .replace(/"/g, '"') | ||||
|     .replace(/</g, '<') | ||||
|     .replace(/>/g, '>'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Array#forEach (<=IE8) | ||||
|  * | ||||
|  * @param {Array} array | ||||
|  * @param {Function} fn | ||||
|  * @param {Object} scope | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.forEach = function(arr, fn, scope) { | ||||
|   for (var i = 0, l = arr.length; i < l; i++) | ||||
|     fn.call(scope, arr[i], i); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Array#indexOf (<=IE8) | ||||
|  * | ||||
|  * @parma {Array} arr | ||||
|  * @param {Object} obj to find index of | ||||
|  * @param {Number} start | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.indexOf = function (arr, obj, start) { | ||||
|   for (var i = start || 0, l = arr.length; i < l; i++) { | ||||
|     if (arr[i] === obj) | ||||
|       return i; | ||||
|   } | ||||
|   return -1; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Array#reduce (<=IE8) | ||||
|  *  | ||||
|  * @param {Array} array | ||||
|  * @param {Function} fn | ||||
|  * @param {Object} initial value | ||||
|  * @param {Object} scope | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.reduce = function(arr, fn, val, scope) { | ||||
|   var rval = val; | ||||
|  | ||||
|   for (var i = 0, l = arr.length; i < l; i++) { | ||||
|     rval = fn.call(scope, rval, arr[i], i, arr); | ||||
|   } | ||||
|  | ||||
|   return rval; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Array#filter (<=IE8) | ||||
|  * | ||||
|  * @param {Array} array | ||||
|  * @param {Function} fn | ||||
|  * @param {Object} scope | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.filter = function(arr, fn, scope) { | ||||
|   var ret = []; | ||||
|  | ||||
|   for (var i = 0, l = arr.length; i < l; i++) { | ||||
|     var val = arr[i]; | ||||
|     if (fn.call(scope, val, i, arr)) | ||||
|       ret.push(val); | ||||
|   } | ||||
|  | ||||
|   return ret; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Object.keys (<=IE8) | ||||
|  * | ||||
|  * @param {Object} obj | ||||
|  * @return {Array} keys | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.keys = Object.keys || function(obj) { | ||||
|   var keys = [] | ||||
|     , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 | ||||
|  | ||||
|   for (var i in obj) { | ||||
|     if (has.call(obj, i)) { | ||||
|       keys.push(i); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   return keys; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Watch the given `files` for changes | ||||
|  * and invoke `fn(file)` on modification. | ||||
|  * | ||||
|  * @param {Array} files | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| exports.watch = function(files, fn){ | ||||
|   var options = { interval: 100 }; | ||||
|   files.forEach(function(file){ | ||||
|     debug('file %s', file); | ||||
|     fs.watchFile(file, options, function(curr, prev){ | ||||
|       if (prev.mtime < curr.mtime) fn(file); | ||||
|     }); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Ignored files. | ||||
|  */ | ||||
|  | ||||
| function ignored(path){ | ||||
|   return !~ignore.indexOf(path); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Lookup files in the given `dir`. | ||||
|  * | ||||
|  * @return {Array} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| exports.files = function(dir, ret){ | ||||
|   ret = ret || []; | ||||
|  | ||||
|   fs.readdirSync(dir) | ||||
|   .filter(ignored) | ||||
|   .forEach(function(path){ | ||||
|     path = join(dir, path); | ||||
|     if (fs.statSync(path).isDirectory()) { | ||||
|       exports.files(path, ret); | ||||
|     } else if (path.match(/\.(js|coffee)$/)) { | ||||
|       ret.push(path); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   return ret; | ||||
| }; | ||||
							
								
								
									
										133
									
								
								node_modules/mocha/mocha.css
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								node_modules/mocha/mocha.css
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,133 @@ | ||||
|  | ||||
| body { | ||||
|   font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
|   padding: 60px 50px; | ||||
| } | ||||
|  | ||||
| #mocha h1, h2 { | ||||
|   margin: 0; | ||||
| } | ||||
|  | ||||
| #mocha h1 { | ||||
|   font-size: 1em; | ||||
|   font-weight: 200; | ||||
| } | ||||
|  | ||||
| #mocha .suite .suite h1 { | ||||
|   font-size: .8em; | ||||
| } | ||||
|  | ||||
| #mocha h2 { | ||||
|   font-size: 12px; | ||||
|   font-weight: normal; | ||||
|   cursor: pointer; | ||||
| } | ||||
|  | ||||
| #mocha .suite { | ||||
|   margin-left: 15px; | ||||
| } | ||||
|  | ||||
| #mocha .test { | ||||
|   margin-left: 15px; | ||||
| } | ||||
|  | ||||
| #mocha .test:hover h2::after { | ||||
|   position: relative; | ||||
|   top: 0; | ||||
|   right: -10px; | ||||
|   content: '(view source)'; | ||||
|   font-size: 12px; | ||||
|   color: #888; | ||||
| } | ||||
|  | ||||
| #mocha .test.pending:hover h2::after { | ||||
|   content: '(pending)'; | ||||
| } | ||||
|  | ||||
| #mocha .test.pass::before { | ||||
|   content: '✓'; | ||||
|   font-size: 12px; | ||||
|   display: block; | ||||
|   float: left; | ||||
|   margin-right: 5px; | ||||
|   color: #00c41c; | ||||
| } | ||||
|  | ||||
| #mocha .test.pending { | ||||
|   color: #0b97c4; | ||||
| } | ||||
|  | ||||
| #mocha .test.pending::before { | ||||
|   content: '◦'; | ||||
|   color: #0b97c4; | ||||
| } | ||||
|  | ||||
| #mocha .test.fail { | ||||
|   color: #c00; | ||||
| } | ||||
|  | ||||
| #mocha .test.fail pre { | ||||
|   color: black; | ||||
| } | ||||
|  | ||||
| #mocha .test.fail::before { | ||||
|   content: '✖'; | ||||
|   font-size: 12px; | ||||
|   display: block; | ||||
|   float: left; | ||||
|   margin-right: 5px; | ||||
|   color: #c00; | ||||
| } | ||||
|  | ||||
| #mocha .test pre.error { | ||||
|   color: #c00; | ||||
| } | ||||
|  | ||||
| #mocha .test pre { | ||||
|   display: inline-block; | ||||
|   font: 12px/1.5 monaco, monospace; | ||||
|   margin: 5px; | ||||
|   padding: 15px; | ||||
|   border: 1px solid #eee; | ||||
|   border-bottom-color: #ddd; | ||||
|   -webkit-border-radius: 3px; | ||||
|   -webkit-box-shadow: 0 1px 3px #eee; | ||||
| } | ||||
|  | ||||
| #error { | ||||
|   color: #c00; | ||||
|   font-size: 1.5  em; | ||||
|   font-weight: 100; | ||||
|   letter-spacing: 1px; | ||||
| } | ||||
|  | ||||
| #stats { | ||||
|   position: fixed; | ||||
|   top: 15px; | ||||
|   right: 10px; | ||||
|   font-size: 12px; | ||||
|   margin: 0; | ||||
|   color: #888; | ||||
| } | ||||
|  | ||||
| #stats .progress { | ||||
|   float: right; | ||||
|   padding-top: 0; | ||||
| } | ||||
|  | ||||
| #stats em { | ||||
|   color: black; | ||||
| } | ||||
|  | ||||
| #stats li { | ||||
|   display: inline-block; | ||||
|   margin: 0 5px; | ||||
|   list-style: none; | ||||
|   padding-top: 11px; | ||||
| } | ||||
|  | ||||
| code .comment { color: #ddd } | ||||
| code .init { color: #2F6FAD } | ||||
| code .string { color: #5890AD } | ||||
| code .keyword { color: #8A6343 } | ||||
| code .number { color: #2F6FAD } | ||||
							
								
								
									
										3290
									
								
								node_modules/mocha/mocha.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3290
									
								
								node_modules/mocha/mocha.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4
									
								
								node_modules/mocha/node_modules/commander/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/mocha/node_modules/commander/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| support | ||||
| test | ||||
| examples | ||||
| *.sock | ||||
							
								
								
									
										4
									
								
								node_modules/mocha/node_modules/commander/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/mocha/node_modules/commander/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| language: node_js | ||||
| node_js: | ||||
|   - 0.4 | ||||
|   - 0.6 | ||||
							
								
								
									
										99
									
								
								node_modules/mocha/node_modules/commander/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								node_modules/mocha/node_modules/commander/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,99 @@ | ||||
|  | ||||
| 0.5.2 / 2012-01-17  | ||||
| ================== | ||||
|  | ||||
|   * Added support for 0.7.x | ||||
|  | ||||
| 0.5.1 / 2011-12-20  | ||||
| ================== | ||||
|  | ||||
|   * Fixed `password()` for recent nodes. Closes #36 | ||||
|  | ||||
| 0.5.0 / 2011-12-04  | ||||
| ================== | ||||
|  | ||||
|   * Added sub-command option support [itay] | ||||
|  | ||||
| 0.4.3 / 2011-12-04  | ||||
| ================== | ||||
|  | ||||
|   * Fixed custom help ordering. Closes #32 | ||||
|  | ||||
| 0.4.2 / 2011-11-24  | ||||
| ================== | ||||
|  | ||||
|   * Added travis support | ||||
|   * Fixed: line-buffered input automatically trimmed. Closes #31 | ||||
|  | ||||
| 0.4.1 / 2011-11-18  | ||||
| ================== | ||||
|  | ||||
|   * Removed listening for "close" on --help | ||||
|  | ||||
| 0.4.0 / 2011-11-15  | ||||
| ================== | ||||
|  | ||||
|   * Added support for `--`. Closes #24 | ||||
|  | ||||
| 0.3.3 / 2011-11-14  | ||||
| ================== | ||||
|  | ||||
|   * Fixed: wait for close event when writing help info [Jerry Hamlet] | ||||
|  | ||||
| 0.3.2 / 2011-11-01  | ||||
| ================== | ||||
|  | ||||
|   * Fixed long flag definitions with values [felixge] | ||||
|  | ||||
| 0.3.1 / 2011-10-31  | ||||
| ================== | ||||
|  | ||||
|   * Changed `--version` short flag to `-V` from `-v` | ||||
|   * Changed `.version()` so it's configurable [felixge] | ||||
|  | ||||
| 0.3.0 / 2011-10-31  | ||||
| ================== | ||||
|  | ||||
|   * Added support for long flags only. Closes #18 | ||||
|  | ||||
| 0.2.1 / 2011-10-24  | ||||
| ================== | ||||
|  | ||||
|   * "node": ">= 0.4.x < 0.7.0". Closes #20 | ||||
|  | ||||
| 0.2.0 / 2011-09-26  | ||||
| ================== | ||||
|  | ||||
|   * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] | ||||
|  | ||||
| 0.1.0 / 2011-08-24  | ||||
| ================== | ||||
|  | ||||
|   * Added support for custom `--help` output | ||||
|  | ||||
| 0.0.5 / 2011-08-18  | ||||
| ================== | ||||
|  | ||||
|   * Changed: when the user enters nothing prompt for password again | ||||
|   * Fixed issue with passwords beginning with numbers [NuckChorris] | ||||
|  | ||||
| 0.0.4 / 2011-08-15  | ||||
| ================== | ||||
|  | ||||
|   * Fixed `Commander#args` | ||||
|  | ||||
| 0.0.3 / 2011-08-15  | ||||
| ================== | ||||
|  | ||||
|   * Added default option value support | ||||
|  | ||||
| 0.0.2 / 2011-08-15  | ||||
| ================== | ||||
|  | ||||
|   * Added mask support to `Command#password(str[, mask], fn)` | ||||
|   * Added `Command#password(str, fn)` | ||||
|  | ||||
| 0.0.1 / 2010-01-03 | ||||
| ================== | ||||
|  | ||||
|   * Initial release | ||||
							
								
								
									
										7
									
								
								node_modules/mocha/node_modules/commander/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/mocha/node_modules/commander/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
|  | ||||
| TESTS = $(shell find test/test.*.js) | ||||
|  | ||||
| test: | ||||
| 	@./test/run $(TESTS) | ||||
|  | ||||
| .PHONY: test | ||||
							
								
								
									
										263
									
								
								node_modules/mocha/node_modules/commander/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										263
									
								
								node_modules/mocha/node_modules/commander/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,263 @@ | ||||
|  | ||||
| # Commander.js | ||||
|  | ||||
|   The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). | ||||
|  | ||||
|  [](http://travis-ci.org/visionmedia/commander.js) | ||||
|  | ||||
| ## Installation | ||||
|  | ||||
|     $ npm install commander | ||||
|  | ||||
| ## Option parsing | ||||
|  | ||||
|  Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. | ||||
|  | ||||
| ```js | ||||
| #!/usr/bin/env node | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var program = require('commander'); | ||||
|  | ||||
| program | ||||
|   .version('0.0.1') | ||||
|   .option('-p, --peppers', 'Add peppers') | ||||
|   .option('-P, --pineapple', 'Add pineapple') | ||||
|   .option('-b, --bbq', 'Add bbq sauce') | ||||
|   .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') | ||||
|   .parse(process.argv); | ||||
|  | ||||
| console.log('you ordered a pizza with:'); | ||||
| if (program.peppers) console.log('  - peppers'); | ||||
| if (program.pineapple) console.log('  - pineappe'); | ||||
| if (program.bbq) console.log('  - bbq'); | ||||
| console.log('  - %s cheese', program.cheese); | ||||
| ``` | ||||
|  | ||||
|  Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. | ||||
|  | ||||
| ## Automated --help | ||||
|  | ||||
|  The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: | ||||
|  | ||||
| ```   | ||||
|  $ ./examples/pizza --help | ||||
|  | ||||
|    Usage: pizza [options] | ||||
|  | ||||
|    Options: | ||||
|  | ||||
|      -v, --version        output the version number | ||||
|      -p, --peppers        Add peppers | ||||
|      -P, --pineapple      Add pineappe | ||||
|      -b, --bbq            Add bbq sauce | ||||
|      -c, --cheese <type>  Add the specified type of cheese [marble] | ||||
|      -h, --help           output usage information | ||||
|  | ||||
| ``` | ||||
|  | ||||
| ## Coercion | ||||
|  | ||||
| ```js | ||||
| function range(val) { | ||||
|   return val.split('..').map(Number); | ||||
| } | ||||
|  | ||||
| function list(val) { | ||||
|   return val.split(','); | ||||
| } | ||||
|  | ||||
| program | ||||
|   .version('0.0.1') | ||||
|   .usage('[options] <file ...>') | ||||
|   .option('-i, --integer <n>', 'An integer argument', parseInt) | ||||
|   .option('-f, --float <n>', 'A float argument', parseFloat) | ||||
|   .option('-r, --range <a>..<b>', 'A range', range) | ||||
|   .option('-l, --list <items>', 'A list', list) | ||||
|   .option('-o, --optional [value]', 'An optional value') | ||||
|   .parse(process.argv); | ||||
|  | ||||
| console.log(' int: %j', program.integer); | ||||
| console.log(' float: %j', program.float); | ||||
| console.log(' optional: %j', program.optional); | ||||
| program.range = program.range || []; | ||||
| console.log(' range: %j..%j', program.range[0], program.range[1]); | ||||
| console.log(' list: %j', program.list); | ||||
| console.log(' args: %j', program.args); | ||||
| ``` | ||||
|  | ||||
| ## Custom help | ||||
|  | ||||
|  You can display arbitrary `-h, --help` information | ||||
|  by listening for "--help". Commander will automatically | ||||
|  exit once you are done so that the remainder of your program | ||||
|  does not execute causing undesired behaviours, for example | ||||
|  in the following executable "stuff" will not output when | ||||
|  `--help` is used. | ||||
|  | ||||
| ```js | ||||
| #!/usr/bin/env node | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var program = require('../'); | ||||
|  | ||||
| function list(val) { | ||||
|   return val.split(',').map(Number); | ||||
| } | ||||
|  | ||||
| program | ||||
|   .version('0.0.1') | ||||
|   .option('-f, --foo', 'enable some foo') | ||||
|   .option('-b, --bar', 'enable some bar') | ||||
|   .option('-B, --baz', 'enable some baz'); | ||||
|  | ||||
| // must be before .parse() since | ||||
| // node's emit() is immediate | ||||
|  | ||||
| program.on('--help', function(){ | ||||
|   console.log('  Examples:'); | ||||
|   console.log(''); | ||||
|   console.log('    $ custom-help --help'); | ||||
|   console.log('    $ custom-help -h'); | ||||
|   console.log(''); | ||||
| }); | ||||
|  | ||||
| program.parse(process.argv); | ||||
|  | ||||
| console.log('stuff'); | ||||
| ``` | ||||
|  | ||||
| yielding the following help output: | ||||
|  | ||||
| ``` | ||||
|  | ||||
| Usage: custom-help [options] | ||||
|  | ||||
| Options: | ||||
|  | ||||
|   -h, --help     output usage information | ||||
|   -v, --version  output the version number | ||||
|   -f, --foo      enable some foo | ||||
|   -b, --bar      enable some bar | ||||
|   -B, --baz      enable some baz | ||||
|  | ||||
| Examples: | ||||
|  | ||||
|   $ custom-help --help | ||||
|   $ custom-help -h | ||||
|  | ||||
| ``` | ||||
|  | ||||
| ## .prompt(msg, fn) | ||||
|  | ||||
|  Single-line prompt: | ||||
|  | ||||
| ```js | ||||
| program.prompt('name: ', function(name){ | ||||
|   console.log('hi %s', name); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
|  Multi-line prompt: | ||||
|  | ||||
| ```js | ||||
| program.prompt('description:', function(name){ | ||||
|   console.log('hi %s', name); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
|  Coercion: | ||||
|  | ||||
| ```js | ||||
| program.prompt('Age: ', Number, function(age){ | ||||
|   console.log('age: %j', age); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| ```js | ||||
| program.prompt('Birthdate: ', Date, function(date){ | ||||
|   console.log('date: %s', date); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| ## .password(msg[, mask], fn) | ||||
|  | ||||
| Prompt for password without echoing: | ||||
|  | ||||
| ```js | ||||
| program.password('Password: ', function(pass){ | ||||
|   console.log('got "%s"', pass); | ||||
|   process.stdin.destroy(); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| Prompt for password with mask char "*": | ||||
|  | ||||
| ```js | ||||
| program.password('Password: ', '*', function(pass){ | ||||
|   console.log('got "%s"', pass); | ||||
|   process.stdin.destroy(); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| ## .confirm(msg, fn) | ||||
|  | ||||
|  Confirm with the given `msg`: | ||||
|  | ||||
| ```js | ||||
| program.confirm('continue? ', function(ok){ | ||||
|   console.log(' got %j', ok); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| ## .choose(list, fn) | ||||
|  | ||||
|  Let the user choose from a `list`: | ||||
|  | ||||
| ```js | ||||
| var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; | ||||
|  | ||||
| console.log('Choose the coolest pet:'); | ||||
| program.choose(list, function(i){ | ||||
|   console.log('you chose %d "%s"', i, list[i]); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| ## Links | ||||
|  | ||||
|  - [API documentation](http://visionmedia.github.com/commander.js/) | ||||
|  - [ascii tables](https://github.com/LearnBoost/cli-table) | ||||
|  - [progress bars](https://github.com/visionmedia/node-progress) | ||||
|  - [more progress bars](https://github.com/substack/node-multimeter) | ||||
|  - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) | ||||
|  | ||||
| ## License  | ||||
|  | ||||
| (The MIT License) | ||||
|  | ||||
| Copyright (c) 2011 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. | ||||
							
								
								
									
										2
									
								
								node_modules/mocha/node_modules/commander/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/mocha/node_modules/commander/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
|  | ||||
| module.exports = require('./lib/commander'); | ||||
							
								
								
									
										992
									
								
								node_modules/mocha/node_modules/commander/lib/commander.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										992
									
								
								node_modules/mocha/node_modules/commander/lib/commander.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,992 @@ | ||||
|  | ||||
| /*! | ||||
|  * commander | ||||
|  * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca> | ||||
|  * MIT Licensed | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var EventEmitter = require('events').EventEmitter | ||||
|   , path = require('path') | ||||
|   , tty = require('tty') | ||||
|   , basename = path.basename; | ||||
|  | ||||
| /** | ||||
|  * Expose the root command. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = new Command; | ||||
|  | ||||
| /** | ||||
|  * Expose `Command`. | ||||
|  */ | ||||
|  | ||||
| exports.Command = Command; | ||||
|  | ||||
| /** | ||||
|  * Expose `Option`. | ||||
|  */ | ||||
|  | ||||
| exports.Option = Option; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Option` with the given `flags` and `description`. | ||||
|  * | ||||
|  * @param {String} flags | ||||
|  * @param {String} description | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Option(flags, description) { | ||||
|   this.flags = flags; | ||||
|   this.required = ~flags.indexOf('<'); | ||||
|   this.optional = ~flags.indexOf('['); | ||||
|   this.bool = !~flags.indexOf('-no-'); | ||||
|   flags = flags.split(/[ ,|]+/); | ||||
|   if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); | ||||
|   this.long = flags.shift(); | ||||
|   this.description = description; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Return option name. | ||||
|  * | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Option.prototype.name = function(){ | ||||
|   return this.long | ||||
|     .replace('--', '') | ||||
|     .replace('no-', ''); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Check if `arg` matches the short or long flag. | ||||
|  * | ||||
|  * @param {String} arg | ||||
|  * @return {Boolean} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Option.prototype.is = function(arg){ | ||||
|   return arg == this.short | ||||
|     || arg == this.long; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Initialize a new `Command`. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function Command(name) { | ||||
|   this.commands = []; | ||||
|   this.options = []; | ||||
|   this.args = []; | ||||
|   this.name = name; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Inherit from `EventEmitter.prototype`. | ||||
|  */ | ||||
|  | ||||
| Command.prototype.__proto__ = EventEmitter.prototype; | ||||
|  | ||||
| /** | ||||
|  * Add command `name`. | ||||
|  * | ||||
|  * The `.action()` callback is invoked when the | ||||
|  * command `name` is specified via __ARGV__, | ||||
|  * and the remaining arguments are applied to the | ||||
|  * function for access. | ||||
|  * | ||||
|  * When the `name` is "*" an un-matched command | ||||
|  * will be passed as the first arg, followed by | ||||
|  * the rest of __ARGV__ remaining. | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *      program | ||||
|  *        .version('0.0.1') | ||||
|  *        .option('-C, --chdir <path>', 'change the working directory') | ||||
|  *        .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf') | ||||
|  *        .option('-T, --no-tests', 'ignore test hook') | ||||
|  *      | ||||
|  *      program | ||||
|  *        .command('setup') | ||||
|  *        .description('run remote setup commands') | ||||
|  *        .action(function(){ | ||||
|  *          console.log('setup'); | ||||
|  *        }); | ||||
|  *      | ||||
|  *      program | ||||
|  *        .command('exec <cmd>') | ||||
|  *        .description('run the given remote command') | ||||
|  *        .action(function(cmd){ | ||||
|  *          console.log('exec "%s"', cmd); | ||||
|  *        }); | ||||
|  *      | ||||
|  *      program | ||||
|  *        .command('*') | ||||
|  *        .description('deploy the given env') | ||||
|  *        .action(function(env){ | ||||
|  *          console.log('deploying "%s"', env); | ||||
|  *        }); | ||||
|  *      | ||||
|  *      program.parse(process.argv); | ||||
|   * | ||||
|  * @param {String} name | ||||
|  * @return {Command} the new command | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.command = function(name){ | ||||
|   var args = name.split(/ +/); | ||||
|   var cmd = new Command(args.shift()); | ||||
|   this.commands.push(cmd); | ||||
|   cmd.parseExpectedArgs(args); | ||||
|   cmd.parent = this; | ||||
|   return cmd; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Parse expected `args`. | ||||
|  * | ||||
|  * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. | ||||
|  * | ||||
|  * @param {Array} args | ||||
|  * @return {Command} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.parseExpectedArgs = function(args){ | ||||
|   if (!args.length) return; | ||||
|   var self = this; | ||||
|   args.forEach(function(arg){ | ||||
|     switch (arg[0]) { | ||||
|       case '<': | ||||
|         self.args.push({ required: true, name: arg.slice(1, -1) }); | ||||
|         break; | ||||
|       case '[': | ||||
|         self.args.push({ required: false, name: arg.slice(1, -1) }); | ||||
|         break; | ||||
|     } | ||||
|   }); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Register callback `fn` for the command. | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *      program | ||||
|  *        .command('help') | ||||
|  *        .description('display verbose help') | ||||
|  *        .action(function(){ | ||||
|  *           // output help here | ||||
|  *        }); | ||||
|  * | ||||
|  * @param {Function} fn | ||||
|  * @return {Command} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.action = function(fn){ | ||||
|   var self = this; | ||||
|   this.parent.on(this.name, function(args, unknown){     | ||||
|     // Parse any so-far unknown options | ||||
|     unknown = unknown || []; | ||||
|     var parsed = self.parseOptions(unknown); | ||||
|      | ||||
|     // Output help if necessary | ||||
|     outputHelpIfNecessary(self, parsed.unknown); | ||||
|      | ||||
|     // If there are still any unknown options, then we simply  | ||||
|     // die, unless someone asked for help, in which case we give it | ||||
|     // to them, and then we die. | ||||
|     if (parsed.unknown.length > 0) {       | ||||
|       self.unknownOption(parsed.unknown[0]); | ||||
|     } | ||||
|      | ||||
|     self.args.forEach(function(arg, i){ | ||||
|       if (arg.required && null == args[i]) { | ||||
|         self.missingArgument(arg.name); | ||||
|       } | ||||
|     }); | ||||
|      | ||||
|     // Always append ourselves to the end of the arguments, | ||||
|     // to make sure we match the number of arguments the user | ||||
|     // expects | ||||
|     if (self.args.length) { | ||||
|       args[self.args.length] = self; | ||||
|     } else { | ||||
|       args.push(self); | ||||
|     } | ||||
|      | ||||
|     fn.apply(this, args); | ||||
|   }); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Define option with `flags`, `description` and optional | ||||
|  * coercion `fn`.  | ||||
|  * | ||||
|  * The `flags` string should contain both the short and long flags, | ||||
|  * separated by comma, a pipe or space. The following are all valid | ||||
|  * all will output this way when `--help` is used. | ||||
|  * | ||||
|  *    "-p, --pepper" | ||||
|  *    "-p|--pepper" | ||||
|  *    "-p --pepper" | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *     // simple boolean defaulting to false | ||||
|  *     program.option('-p, --pepper', 'add pepper'); | ||||
|  * | ||||
|  *     --pepper | ||||
|  *     program.pepper | ||||
|  *     // => Boolean | ||||
|  * | ||||
|  *     // simple boolean defaulting to false | ||||
|  *     program.option('-C, --no-cheese', 'remove cheese'); | ||||
|  * | ||||
|  *     program.cheese | ||||
|  *     // => true | ||||
|  * | ||||
|  *     --no-cheese | ||||
|  *     program.cheese | ||||
|  *     // => true | ||||
|  * | ||||
|  *     // required argument | ||||
|  *     program.option('-C, --chdir <path>', 'change the working directory'); | ||||
|  * | ||||
|  *     --chdir /tmp | ||||
|  *     program.chdir | ||||
|  *     // => "/tmp" | ||||
|  * | ||||
|  *     // optional argument | ||||
|  *     program.option('-c, --cheese [type]', 'add cheese [marble]'); | ||||
|  * | ||||
|  * @param {String} flags | ||||
|  * @param {String} description | ||||
|  * @param {Function|Mixed} fn or default | ||||
|  * @param {Mixed} defaultValue | ||||
|  * @return {Command} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.option = function(flags, description, fn, defaultValue){ | ||||
|   var self = this | ||||
|     , option = new Option(flags, description) | ||||
|     , oname = option.name() | ||||
|     , name = camelcase(oname); | ||||
|  | ||||
|   // default as 3rd arg | ||||
|   if ('function' != typeof fn) defaultValue = fn, fn = null; | ||||
|  | ||||
|   // preassign default value only for --no-*, [optional], or <required> | ||||
|   if (false == option.bool || option.optional || option.required) { | ||||
|     // when --no-* we make sure default is true | ||||
|     if (false == option.bool) defaultValue = true; | ||||
|     // preassign only if we have a default | ||||
|     if (undefined !== defaultValue) self[name] = defaultValue; | ||||
|   } | ||||
|  | ||||
|   // register the option | ||||
|   this.options.push(option); | ||||
|  | ||||
|   // when it's passed assign the value | ||||
|   // and conditionally invoke the callback | ||||
|   this.on(oname, function(val){ | ||||
|     // coercion | ||||
|     if (null != val && fn) val = fn(val); | ||||
|  | ||||
|     // unassigned or bool | ||||
|     if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { | ||||
|       // if no value, bool true, and we have a default, then use it! | ||||
|       if (null == val) { | ||||
|         self[name] = option.bool | ||||
|           ? defaultValue || true | ||||
|           : false; | ||||
|       } else { | ||||
|         self[name] = val; | ||||
|       } | ||||
|     } else if (null !== val) { | ||||
|       // reassign | ||||
|       self[name] = val; | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Parse `argv`, settings options and invoking commands when defined. | ||||
|  * | ||||
|  * @param {Array} argv | ||||
|  * @return {Command} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.parse = function(argv){ | ||||
|   // store raw args | ||||
|   this.rawArgs = argv; | ||||
|  | ||||
|   // guess name | ||||
|   if (!this.name) this.name = basename(argv[1]); | ||||
|  | ||||
|   // process argv | ||||
|   var parsed = this.parseOptions(this.normalize(argv.slice(2))); | ||||
|   this.args = parsed.args; | ||||
|   return this.parseArgs(this.args, parsed.unknown); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Normalize `args`, splitting joined short flags. For example | ||||
|  * the arg "-abc" is equivalent to "-a -b -c". | ||||
|  * | ||||
|  * @param {Array} args | ||||
|  * @return {Array} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.normalize = function(args){ | ||||
|   var ret = [] | ||||
|     , arg; | ||||
|  | ||||
|   for (var i = 0, len = args.length; i < len; ++i) { | ||||
|     arg = args[i]; | ||||
|     if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { | ||||
|       arg.slice(1).split('').forEach(function(c){ | ||||
|         ret.push('-' + c); | ||||
|       }); | ||||
|     } else { | ||||
|       ret.push(arg); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   return ret; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Parse command `args`. | ||||
|  * | ||||
|  * When listener(s) are available those | ||||
|  * callbacks are invoked, otherwise the "*" | ||||
|  * event is emitted and those actions are invoked. | ||||
|  * | ||||
|  * @param {Array} args | ||||
|  * @return {Command} for chaining | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.parseArgs = function(args, unknown){ | ||||
|   var cmds = this.commands | ||||
|     , len = cmds.length | ||||
|     , name; | ||||
|  | ||||
|   if (args.length) { | ||||
|     name = args[0]; | ||||
|     if (this.listeners(name).length) { | ||||
|       this.emit(args.shift(), args, unknown); | ||||
|     } else { | ||||
|       this.emit('*', args); | ||||
|     } | ||||
|   } else { | ||||
|     outputHelpIfNecessary(this, unknown); | ||||
|      | ||||
|     // If there were no args and we have unknown options, | ||||
|     // then they are extraneous and we need to error. | ||||
|     if (unknown.length > 0) {       | ||||
|       this.unknownOption(unknown[0]); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return an option matching `arg` if any. | ||||
|  * | ||||
|  * @param {String} arg | ||||
|  * @return {Option} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.optionFor = function(arg){ | ||||
|   for (var i = 0, len = this.options.length; i < len; ++i) { | ||||
|     if (this.options[i].is(arg)) { | ||||
|       return this.options[i]; | ||||
|     } | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Parse options from `argv` returning `argv` | ||||
|  * void of these options. | ||||
|  * | ||||
|  * @param {Array} argv | ||||
|  * @return {Array} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.parseOptions = function(argv){ | ||||
|   var args = [] | ||||
|     , len = argv.length | ||||
|     , literal | ||||
|     , option | ||||
|     , arg; | ||||
|  | ||||
|   var unknownOptions = []; | ||||
|  | ||||
|   // parse options | ||||
|   for (var i = 0; i < len; ++i) { | ||||
|     arg = argv[i]; | ||||
|  | ||||
|     // literal args after -- | ||||
|     if ('--' == arg) { | ||||
|       literal = true; | ||||
|       continue; | ||||
|     } | ||||
|  | ||||
|     if (literal) { | ||||
|       args.push(arg); | ||||
|       continue; | ||||
|     } | ||||
|  | ||||
|     // find matching Option | ||||
|     option = this.optionFor(arg); | ||||
|  | ||||
|     // option is defined | ||||
|     if (option) { | ||||
|       // requires arg | ||||
|       if (option.required) { | ||||
|         arg = argv[++i]; | ||||
|         if (null == arg) return this.optionMissingArgument(option); | ||||
|         if ('-' == arg[0]) return this.optionMissingArgument(option, arg); | ||||
|         this.emit(option.name(), arg); | ||||
|       // optional arg | ||||
|       } else if (option.optional) { | ||||
|         arg = argv[i+1]; | ||||
|         if (null == arg || '-' == arg[0]) { | ||||
|           arg = null; | ||||
|         } else { | ||||
|           ++i; | ||||
|         } | ||||
|         this.emit(option.name(), arg); | ||||
|       // bool | ||||
|       } else { | ||||
|         this.emit(option.name()); | ||||
|       } | ||||
|       continue; | ||||
|     } | ||||
|      | ||||
|     // looks like an option | ||||
|     if (arg.length > 1 && '-' == arg[0]) { | ||||
|       unknownOptions.push(arg); | ||||
|        | ||||
|       // If the next argument looks like it might be | ||||
|       // an argument for this option, we pass it on. | ||||
|       // If it isn't, then it'll simply be ignored | ||||
|       if (argv[i+1] && '-' != argv[i+1][0]) { | ||||
|         unknownOptions.push(argv[++i]); | ||||
|       } | ||||
|       continue; | ||||
|     } | ||||
|      | ||||
|     // arg | ||||
|     args.push(arg); | ||||
|   } | ||||
|    | ||||
|   return { args: args, unknown: unknownOptions }; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Argument `name` is missing. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.missingArgument = function(name){ | ||||
|   console.error(); | ||||
|   console.error("  error: missing required argument `%s'", name); | ||||
|   console.error(); | ||||
|   process.exit(1); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * `Option` is missing an argument, but received `flag` or nothing. | ||||
|  * | ||||
|  * @param {String} option | ||||
|  * @param {String} flag | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.optionMissingArgument = function(option, flag){ | ||||
|   console.error(); | ||||
|   if (flag) { | ||||
|     console.error("  error: option `%s' argument missing, got `%s'", option.flags, flag); | ||||
|   } else { | ||||
|     console.error("  error: option `%s' argument missing", option.flags); | ||||
|   } | ||||
|   console.error(); | ||||
|   process.exit(1); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Unknown option `flag`. | ||||
|  * | ||||
|  * @param {String} flag | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.unknownOption = function(flag){ | ||||
|   console.error(); | ||||
|   console.error("  error: unknown option `%s'", flag); | ||||
|   console.error(); | ||||
|   process.exit(1); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Set the program version to `str`. | ||||
|  * | ||||
|  * This method auto-registers the "-V, --version" flag | ||||
|  * which will print the version number when passed. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {String} flags | ||||
|  * @return {Command} for chaining | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.version = function(str, flags){ | ||||
|   if (0 == arguments.length) return this._version; | ||||
|   this._version = str; | ||||
|   flags = flags || '-V, --version'; | ||||
|   this.option(flags, 'output the version number'); | ||||
|   this.on('version', function(){ | ||||
|     console.log(str); | ||||
|     process.exit(0); | ||||
|   }); | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Set the description `str`. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @return {String|Command} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.description = function(str){ | ||||
|   if (0 == arguments.length) return this._description; | ||||
|   this._description = str; | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Set / get the command usage `str`. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @return {String|Command} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.usage = function(str){ | ||||
|   var args = this.args.map(function(arg){ | ||||
|     return arg.required | ||||
|       ? '<' + arg.name + '>' | ||||
|       : '[' + arg.name + ']'; | ||||
|   }); | ||||
|  | ||||
|   var usage = '[options' | ||||
|     + (this.commands.length ? '] [command' : '') | ||||
|     + ']' | ||||
|     + (this.args.length ? ' ' + args : ''); | ||||
|   if (0 == arguments.length) return this._usage || usage; | ||||
|   this._usage = str; | ||||
|  | ||||
|   return this; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return the largest option length. | ||||
|  * | ||||
|  * @return {Number} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.largestOptionLength = function(){ | ||||
|   return this.options.reduce(function(max, option){ | ||||
|     return Math.max(max, option.flags.length); | ||||
|   }, 0); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return help for options. | ||||
|  * | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.optionHelp = function(){ | ||||
|   var width = this.largestOptionLength(); | ||||
|    | ||||
|   // Prepend the help information | ||||
|   return [pad('-h, --help', width) + '  ' + 'output usage information'] | ||||
|     .concat(this.options.map(function(option){ | ||||
|       return pad(option.flags, width) | ||||
|         + '  ' + option.description; | ||||
|       })) | ||||
|     .join('\n'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return command help documentation. | ||||
|  * | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.commandHelp = function(){ | ||||
|   if (!this.commands.length) return ''; | ||||
|   return [ | ||||
|       '' | ||||
|     , '  Commands:' | ||||
|     , '' | ||||
|     , this.commands.map(function(cmd){ | ||||
|       var args = cmd.args.map(function(arg){ | ||||
|         return arg.required | ||||
|           ? '<' + arg.name + '>' | ||||
|           : '[' + arg.name + ']'; | ||||
|       }).join(' '); | ||||
|  | ||||
|       return cmd.name  | ||||
|         + (cmd.options.length  | ||||
|           ? ' [options]' | ||||
|           : '') + ' ' + args | ||||
|         + (cmd.description() | ||||
|           ? '\n' + cmd.description() | ||||
|           : ''); | ||||
|     }).join('\n\n').replace(/^/gm, '    ') | ||||
|     , '' | ||||
|   ].join('\n'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Return program help documentation. | ||||
|  * | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.helpInformation = function(){ | ||||
|   return [ | ||||
|       '' | ||||
|     , '  Usage: ' + this.name + ' ' + this.usage() | ||||
|     , '' + this.commandHelp() | ||||
|     , '  Options:' | ||||
|     , '' | ||||
|     , '' + this.optionHelp().replace(/^/gm, '    ') | ||||
|     , '' | ||||
|     , '' | ||||
|   ].join('\n'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Prompt for a `Number`. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.promptForNumber = function(str, fn){ | ||||
|   var self = this; | ||||
|   this.promptSingleLine(str, function parseNumber(val){ | ||||
|     val = Number(val); | ||||
|     if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); | ||||
|     fn(val); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Prompt for a `Date`. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.promptForDate = function(str, fn){ | ||||
|   var self = this; | ||||
|   this.promptSingleLine(str, function parseDate(val){ | ||||
|     val = new Date(val); | ||||
|     if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); | ||||
|     fn(val); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Single-line prompt. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.promptSingleLine = function(str, fn){ | ||||
|   if ('function' == typeof arguments[2]) { | ||||
|     return this['promptFor' + (fn.name || fn)](str, arguments[2]); | ||||
|   } | ||||
|  | ||||
|   process.stdout.write(str); | ||||
|   process.stdin.setEncoding('utf8'); | ||||
|   process.stdin.once('data', function(val){ | ||||
|     fn(val.trim()); | ||||
|   }).resume(); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Multi-line prompt. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Function} fn | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| Command.prototype.promptMultiLine = function(str, fn){ | ||||
|   var buf = []; | ||||
|   console.log(str); | ||||
|   process.stdin.setEncoding('utf8'); | ||||
|   process.stdin.on('data', function(val){ | ||||
|     if ('\n' == val || '\r\n' == val) { | ||||
|       process.stdin.removeAllListeners('data'); | ||||
|       fn(buf.join('\n')); | ||||
|     } else { | ||||
|       buf.push(val.trimRight()); | ||||
|     } | ||||
|   }).resume(); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Prompt `str` and callback `fn(val)` | ||||
|  * | ||||
|  * Commander supports single-line and multi-line prompts. | ||||
|  * To issue a single-line prompt simply add white-space | ||||
|  * to the end of `str`, something like "name: ", whereas | ||||
|  * for a multi-line prompt omit this "description:". | ||||
|  * | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *     program.prompt('Username: ', function(name){ | ||||
|  *       console.log('hi %s', name); | ||||
|  *     }); | ||||
|  *      | ||||
|  *     program.prompt('Description:', function(desc){ | ||||
|  *       console.log('description was "%s"', desc.trim()); | ||||
|  *     }); | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Function} fn | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.prompt = function(str, fn){ | ||||
|   if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); | ||||
|   this.promptMultiLine(str, fn); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Prompt for password with `str`, `mask` char and callback `fn(val)`. | ||||
|  * | ||||
|  * The mask string defaults to '', aka no output is | ||||
|  * written while typing, you may want to use "*" etc. | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *     program.password('Password: ', function(pass){ | ||||
|  *       console.log('got "%s"', pass); | ||||
|  *       process.stdin.destroy(); | ||||
|  *     }); | ||||
|  * | ||||
|  *     program.password('Password: ', '*', function(pass){ | ||||
|  *       console.log('got "%s"', pass); | ||||
|  *       process.stdin.destroy(); | ||||
|  *     }); | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {String} mask | ||||
|  * @param {Function} fn | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.password = function(str, mask, fn){ | ||||
|   var self = this | ||||
|     , buf = ''; | ||||
|  | ||||
|   // default mask | ||||
|   if ('function' == typeof mask) { | ||||
|     fn = mask; | ||||
|     mask = ''; | ||||
|   } | ||||
|  | ||||
|   process.stdin.resume(); | ||||
|   tty.setRawMode(true); | ||||
|   process.stdout.write(str); | ||||
|  | ||||
|   // keypress | ||||
|   process.stdin.on('keypress', function(c, key){ | ||||
|     if (key && 'enter' == key.name) { | ||||
|       console.log(); | ||||
|       process.stdin.removeAllListeners('keypress'); | ||||
|       tty.setRawMode(false); | ||||
|       if (!buf.trim().length) return self.password(str, mask, fn); | ||||
|       fn(buf); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|     if (key && key.ctrl && 'c' == key.name) { | ||||
|       console.log('%s', buf); | ||||
|       process.exit(); | ||||
|     } | ||||
|  | ||||
|     process.stdout.write(mask); | ||||
|     buf += c; | ||||
|   }).resume(); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Confirmation prompt with `str` and callback `fn(bool)` | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *      program.confirm('continue? ', function(ok){ | ||||
|  *        console.log(' got %j', ok); | ||||
|  *        process.stdin.destroy(); | ||||
|  *      }); | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Function} fn | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
|  | ||||
| Command.prototype.confirm = function(str, fn){ | ||||
|   var self = this; | ||||
|   this.prompt(str, function(ok){ | ||||
|     if (!ok.trim()) { | ||||
|       return self.confirm(str, fn); | ||||
|     } | ||||
|     fn(parseBool(ok)); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Choice prompt with `list` of items and callback `fn(index, item)` | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *      var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; | ||||
|  *       | ||||
|  *      console.log('Choose the coolest pet:'); | ||||
|  *      program.choose(list, function(i){ | ||||
|  *        console.log('you chose %d "%s"', i, list[i]); | ||||
|  *        process.stdin.destroy(); | ||||
|  *      }); | ||||
|  * | ||||
|  * @param {Array} list | ||||
|  * @param {Function} fn | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| Command.prototype.choose = function(list, fn){ | ||||
|   var self = this; | ||||
|  | ||||
|   list.forEach(function(item, i){ | ||||
|     console.log('  %d) %s', i + 1, item); | ||||
|   }); | ||||
|  | ||||
|   function again() { | ||||
|     self.prompt('  : ', function(val){ | ||||
|       val = parseInt(val, 10) - 1; | ||||
|       if (null == list[val]) { | ||||
|         again(); | ||||
|       } else { | ||||
|         fn(val, list[val]); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   again(); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Camel-case the given `flag` | ||||
|  * | ||||
|  * @param {String} flag | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function camelcase(flag) { | ||||
|   return flag.split('-').reduce(function(str, word){ | ||||
|     return str + word[0].toUpperCase() + word.slice(1); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Parse a boolean `str`. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @return {Boolean} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function parseBool(str) { | ||||
|   return /^y|yes|ok|true$/i.test(str); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Pad `str` to `width`. | ||||
|  * | ||||
|  * @param {String} str | ||||
|  * @param {Number} width | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function pad(str, width) { | ||||
|   var len = Math.max(0, width - str.length); | ||||
|   return str + Array(len + 1).join(' '); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Output help information if necessary | ||||
|  * | ||||
|  * @param {Command} command to output help for | ||||
|  * @param {Array} array of options to search for -h or --help | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function outputHelpIfNecessary(cmd, options) { | ||||
|   options = options || []; | ||||
|   for (var i = 0; i < options.length; i++) { | ||||
|     if (options[i] == '--help' || options[i] == '-h') { | ||||
|       process.stdout.write(cmd.helpInformation()); | ||||
|       cmd.emit('--help'); | ||||
|       process.exit(0); | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										13
									
								
								node_modules/mocha/node_modules/commander/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								node_modules/mocha/node_modules/commander/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { | ||||
|     "name": "commander" | ||||
|   , "version": "0.5.2" | ||||
|   , "description": "the complete solution for node.js command-line programs" | ||||
|   , "keywords": ["command", "option", "parser", "prompt", "stdin"] | ||||
|   , "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||||
|   , "repository": { "type": "git", "url": "https://github.com/visionmedia/commander.js.git" }   | ||||
|   , "dependencies": {} | ||||
|   , "devDependencies": { "should": ">= 0.0.1" } | ||||
|   , "scripts": { "test": "make test" } | ||||
|   , "main": "index" | ||||
|   , "engines": { "node": ">= 0.4.x < 0.8.0" } | ||||
| } | ||||
							
								
								
									
										4
									
								
								node_modules/mocha/node_modules/debug/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/mocha/node_modules/debug/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| support | ||||
| test | ||||
| examples | ||||
| *.sock | ||||
							
								
								
									
										35
									
								
								node_modules/mocha/node_modules/debug/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								node_modules/mocha/node_modules/debug/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
|  | ||||
| 0.5.0 / 2012-02-02  | ||||
| ================== | ||||
|  | ||||
|   * Added: humanize diffs. Closes #8 | ||||
|   * Added `debug.disable()` to the CS variant | ||||
|   * Removed padding. Closes #10 | ||||
|   * Fixed: persist client-side variant again. Closes #9 | ||||
|  | ||||
| 0.4.0 / 2012-02-01  | ||||
| ================== | ||||
|  | ||||
|   * Added browser variant support for older browsers [TooTallNate] | ||||
|   * Added `debug.enable('project:*')` to browser variant [TooTallNate] | ||||
|   * Added padding to diff (moved it to the right) | ||||
|  | ||||
| 0.3.0 / 2012-01-26  | ||||
| ================== | ||||
|  | ||||
|   * Added millisecond diff when isatty, otherwise UTC string | ||||
|  | ||||
| 0.2.0 / 2012-01-22  | ||||
| ================== | ||||
|  | ||||
|   * Added wildcard support | ||||
|  | ||||
| 0.1.0 / 2011-12-02  | ||||
| ================== | ||||
|  | ||||
|   * Added: remove colors unless stderr isatty [TooTallNate] | ||||
|  | ||||
| 0.0.1 / 2010-01-03 | ||||
| ================== | ||||
|  | ||||
|   * Initial release | ||||
							
								
								
									
										5
									
								
								node_modules/mocha/node_modules/debug/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/mocha/node_modules/debug/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
|  | ||||
| test: | ||||
| 	@echo "populate me" | ||||
|  | ||||
| .PHONY: test | ||||
							
								
								
									
										128
									
								
								node_modules/mocha/node_modules/debug/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								node_modules/mocha/node_modules/debug/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,128 @@ | ||||
|  | ||||
| # debug | ||||
|  | ||||
|   tiny node.js debugging utility. | ||||
|  | ||||
| ## Installation | ||||
|  | ||||
| ``` | ||||
| $ npm install debug | ||||
| ``` | ||||
|  | ||||
| ## Example | ||||
|  | ||||
|   This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules: | ||||
|  | ||||
| ```js | ||||
| var debug; | ||||
| if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) { | ||||
|   debug = function(x) { | ||||
|     var prefix = process.pid + ',' + | ||||
|         (process.env.NODE_WORKER_ID ? 'Worker' : 'Master'); | ||||
|     console.error(prefix, x); | ||||
|   }; | ||||
| } else { | ||||
|   debug = function() { }; | ||||
| } | ||||
| ``` | ||||
|  | ||||
|  This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. | ||||
|   | ||||
| Example _app.js_: | ||||
|  | ||||
| ```js | ||||
| var debug = require('debug')('http') | ||||
|   , http = require('http') | ||||
|   , name = 'My App'; | ||||
|  | ||||
| // fake app | ||||
|  | ||||
| debug('booting %s', name); | ||||
|  | ||||
| http.createServer(function(req, res){ | ||||
|   debug(req.method + ' ' + req.url); | ||||
|   res.end('hello\n'); | ||||
| }).listen(3000, function(){ | ||||
|   debug('listening'); | ||||
| }); | ||||
|  | ||||
| // fake worker of some kind | ||||
|  | ||||
| require('./worker'); | ||||
| ``` | ||||
|  | ||||
| Example _worker.js_: | ||||
|  | ||||
| ```js | ||||
| var debug = require('debug')('worker'); | ||||
|  | ||||
| setInterval(function(){ | ||||
|   debug('doing some work'); | ||||
| }, 1000); | ||||
| ``` | ||||
|  | ||||
|  The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: | ||||
|  | ||||
|    | ||||
|  | ||||
|    | ||||
|  | ||||
| ## Millisecond diff | ||||
|  | ||||
|   When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. | ||||
|  | ||||
|    | ||||
|  | ||||
|   When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: | ||||
|    | ||||
|    | ||||
|  | ||||
| ## Conventions | ||||
|  | ||||
|  If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".  | ||||
|  | ||||
| ## Wildcards | ||||
|  | ||||
|   The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. | ||||
|  | ||||
| ## Browser support | ||||
|  | ||||
|  Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.  | ||||
|  | ||||
| ```js | ||||
| a = debug('worker:a'); | ||||
| b = debug('worker:b'); | ||||
|  | ||||
| setInterval(function(){ | ||||
|   a('doing some work'); | ||||
| }, 1000); | ||||
|  | ||||
| setInterval(function(){ | ||||
|   a('doing some work'); | ||||
| }, 1200); | ||||
| ``` | ||||
|  | ||||
| ## License  | ||||
|  | ||||
| (The MIT License) | ||||
|  | ||||
| Copyright (c) 2011 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. | ||||
							
								
								
									
										111
									
								
								node_modules/mocha/node_modules/debug/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								node_modules/mocha/node_modules/debug/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | ||||
|  | ||||
| /*! | ||||
|  * debug | ||||
|  * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca> | ||||
|  * MIT Licensed | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Create a debugger with the given `name`. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @return {Type} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function debug(name) { | ||||
|   if (!debug.enabled(name)) return function(){}; | ||||
|  | ||||
|   return function(fmt){ | ||||
|     var curr = new Date; | ||||
|     var ms = curr - (debug[name] || curr); | ||||
|     debug[name] = curr; | ||||
|  | ||||
|     fmt = name | ||||
|       + ' ' | ||||
|       + fmt | ||||
|       + ' +' + debug.humanize(ms); | ||||
|  | ||||
|     // This hackery is required for IE8 | ||||
|     // where `console.log` doesn't have 'apply' | ||||
|     window.console | ||||
|       && console.log | ||||
|       && Function.prototype.apply.call(console.log, console, arguments); | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * The currently active debug mode names. | ||||
|  */ | ||||
|  | ||||
| debug.names = []; | ||||
|  | ||||
| /** | ||||
|  * Enables a debug mode by name. This can include modes | ||||
|  * separated by a colon and wildcards. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| debug.enable = function(name) { | ||||
|   localStorage.debug = name; | ||||
|  | ||||
|   var split = (name || '').split(/[\s,]+/) | ||||
|     , len = split.length; | ||||
|  | ||||
|   for (var i = 0; i < len; i++) { | ||||
|     name = split[i].replace('*', '.*?'); | ||||
|     debug.names.push(new RegExp('^' + name + '$')); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Disable debug output. | ||||
|  * | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| debug.disable = function(){ | ||||
|   debug.enable(''); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Humanize the given `ms`. | ||||
|  * | ||||
|  * @param {Number} m | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| debug.humanize = function(ms) { | ||||
|   var sec = 1000 | ||||
|     , min = 60 * 1000 | ||||
|     , hour = 60 * min; | ||||
|  | ||||
|   if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; | ||||
|   if (ms >= min) return (ms / min).toFixed(1) + 'm'; | ||||
|   if (ms >= sec) return (ms / sec | 0) + 's'; | ||||
|   return ms + 'ms'; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Returns true if the given mode name is enabled, false otherwise. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @return {Boolean} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| debug.enabled = function(name) { | ||||
|   for (var i = 0, len = debug.names.length; i < len; i++) { | ||||
|     if (debug.names[i].test(name)) { | ||||
|       return true; | ||||
|     } | ||||
|   } | ||||
|   return false; | ||||
| }; | ||||
|  | ||||
| // persist | ||||
|  | ||||
| if (window.localStorage) debug.enable(localStorage.debug); | ||||
							
								
								
									
										19
									
								
								node_modules/mocha/node_modules/debug/example/app.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								node_modules/mocha/node_modules/debug/example/app.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
|  | ||||
| var debug = require('../')('http') | ||||
|   , http = require('http') | ||||
|   , name = 'My App'; | ||||
|  | ||||
| // fake app | ||||
|  | ||||
| debug('booting %s', name); | ||||
|  | ||||
| http.createServer(function(req, res){ | ||||
|   debug(req.method + ' ' + req.url); | ||||
|   res.end('hello\n'); | ||||
| }).listen(3000, function(){ | ||||
|   debug('listening'); | ||||
| }); | ||||
|  | ||||
| // fake worker of some kind | ||||
|  | ||||
| require('./worker'); | ||||
							
								
								
									
										24
									
								
								node_modules/mocha/node_modules/debug/example/browser.html
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								node_modules/mocha/node_modules/debug/example/browser.html
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| <html> | ||||
|   <head> | ||||
|     <title>debug()</title> | ||||
|     <script src="../debug.js"></script> | ||||
|     <script> | ||||
|       // type debug.enable('*') in | ||||
|       // the console and refresh :) | ||||
|  | ||||
|       a = debug('worker:a'); | ||||
|       b = debug('worker:b'); | ||||
|  | ||||
|       setInterval(function(){ | ||||
|         a('doing some work'); | ||||
|       }, 1000); | ||||
|  | ||||
|       setInterval(function(){ | ||||
|         a('doing some work'); | ||||
|       }, 1200); | ||||
|     </script> | ||||
|   </head> | ||||
|   <body> | ||||
|      | ||||
|   </body> | ||||
| </html> | ||||
							
								
								
									
										10
									
								
								node_modules/mocha/node_modules/debug/example/wildcards.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								node_modules/mocha/node_modules/debug/example/wildcards.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
|  | ||||
| var debug = { | ||||
|   foo: require('../')('test:foo'), | ||||
|   bar: require('../')('test:bar'), | ||||
|   baz: require('../')('test:baz') | ||||
| }; | ||||
|  | ||||
| debug.foo('foo') | ||||
| debug.bar('bar') | ||||
| debug.baz('baz') | ||||
							
								
								
									
										22
									
								
								node_modules/mocha/node_modules/debug/example/worker.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								node_modules/mocha/node_modules/debug/example/worker.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
|  | ||||
| // DEBUG=* node example/worker | ||||
| // DEBUG=worker:* node example/worker | ||||
| // DEBUG=worker:a node example/worker | ||||
| // DEBUG=worker:b node example/worker | ||||
|  | ||||
| var a = require('../')('worker:a') | ||||
|   , b = require('../')('worker:b'); | ||||
|  | ||||
| function work() { | ||||
|   a('doing lots of uninteresting work'); | ||||
|   setTimeout(work, Math.random() * 1000); | ||||
| } | ||||
|  | ||||
| work(); | ||||
|  | ||||
| function workb() { | ||||
|   b('doing some work'); | ||||
|   setTimeout(workb, Math.random() * 2000); | ||||
| } | ||||
|  | ||||
| workb(); | ||||
							
								
								
									
										2
									
								
								node_modules/mocha/node_modules/debug/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/mocha/node_modules/debug/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
|  | ||||
| module.exports = require('./lib/debug'); | ||||
							
								
								
									
										129
									
								
								node_modules/mocha/node_modules/debug/lib/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								node_modules/mocha/node_modules/debug/lib/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,129 @@ | ||||
|  | ||||
| /*! | ||||
|  * debug | ||||
|  * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca> | ||||
|  * MIT Licensed | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var tty = require('tty'); | ||||
|  | ||||
| /** | ||||
|  * Expose `debug()` as the module. | ||||
|  */ | ||||
|  | ||||
| module.exports = debug; | ||||
|  | ||||
| /** | ||||
|  * Library version. | ||||
|  */ | ||||
|  | ||||
| exports.version = '0.5.0'; | ||||
|  | ||||
| /** | ||||
|  * Enabled debuggers. | ||||
|  */ | ||||
|  | ||||
| var names = (process.env.DEBUG || '') | ||||
|   .split(/[\s,]+/) | ||||
|   .map(function(name){ | ||||
|     name = name.replace('*', '.*?'); | ||||
|     return new RegExp('^' + name + '$'); | ||||
|   }); | ||||
|  | ||||
| /** | ||||
|  * Colors. | ||||
|  */ | ||||
|  | ||||
| var colors = [6, 2, 3, 4, 5, 1]; | ||||
|  | ||||
| /** | ||||
|  * Previous debug() call. | ||||
|  */ | ||||
|  | ||||
| var prev = {}; | ||||
|  | ||||
| /** | ||||
|  * Previously assigned color. | ||||
|  */ | ||||
|  | ||||
| var prevColor = 0; | ||||
|  | ||||
| /** | ||||
|  * Is stdout a TTY? Colored output is disabled when `true`. | ||||
|  */ | ||||
|  | ||||
| var isatty = tty.isatty(2); | ||||
|  | ||||
| /** | ||||
|  * Select a color. | ||||
|  * | ||||
|  * @return {Number} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function color() { | ||||
|   return colors[prevColor++ % colors.length]; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Humanize the given `ms`. | ||||
|  * | ||||
|  * @param {Number} m | ||||
|  * @return {String} | ||||
|  * @api private | ||||
|  */ | ||||
|  | ||||
| function humanize(ms) { | ||||
|   var sec = 1000 | ||||
|     , min = 60 * 1000 | ||||
|     , hour = 60 * min; | ||||
|  | ||||
|   if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; | ||||
|   if (ms >= min) return (ms / min).toFixed(1) + 'm'; | ||||
|   if (ms >= sec) return (ms / sec | 0) + 's'; | ||||
|   return ms + 'ms'; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Create a debugger with the given `name`. | ||||
|  * | ||||
|  * @param {String} name | ||||
|  * @return {Type} | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function debug(name) { | ||||
|   var match = names.some(function(re){ | ||||
|     return re.test(name); | ||||
|   }); | ||||
|  | ||||
|   if (!match) return function(){}; | ||||
|   var c = color(); | ||||
|  | ||||
|   function colored(fmt) { | ||||
|     var curr = new Date; | ||||
|     var ms = curr - (prev[name] || curr); | ||||
|     prev[name] = curr; | ||||
|  | ||||
|     fmt = '  \033[9' + c + 'm' + name + ' ' | ||||
|       + '\033[3' + c + 'm\033[90m' | ||||
|       + fmt + '\033[3' + c + 'm' | ||||
|       + ' +' + humanize(ms) + '\033[0m'; | ||||
|  | ||||
|     console.error.apply(this, arguments); | ||||
|   } | ||||
|  | ||||
|   function plain(fmt) { | ||||
|     fmt = new Date().toUTCString() | ||||
|       + ' ' + name + ' ' + fmt; | ||||
|     console.error.apply(this, arguments); | ||||
|   } | ||||
|  | ||||
|   return isatty | ||||
|     ? colored | ||||
|     : plain; | ||||
| } | ||||
							
								
								
									
										11
									
								
								node_modules/mocha/node_modules/debug/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								node_modules/mocha/node_modules/debug/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| { | ||||
|     "name": "debug" | ||||
|   , "version": "0.5.0" | ||||
|   , "description": "small debugging utility" | ||||
|   , "keywords": ["debug", "log", "debugger"] | ||||
|   , "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||||
|   , "dependencies": {} | ||||
|   , "devDependencies": { "mocha": "*" } | ||||
|   , "main": "index" | ||||
|   , "engines": { "node": "*" } | ||||
| } | ||||
							
								
								
									
										37
									
								
								node_modules/mocha/node_modules/growl/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								node_modules/mocha/node_modules/growl/History.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
|  | ||||
| 1.4.1 / 2011-12-28  | ||||
| ================== | ||||
|  | ||||
|   * Fixed: dont exit(). Closes #9 | ||||
|  | ||||
| 1.4.0 / 2011-12-17  | ||||
| ================== | ||||
|  | ||||
|   * Changed API: `growl.notify()` -> `growl()` | ||||
|  | ||||
| 1.3.0 / 2011-12-17  | ||||
| ================== | ||||
|  | ||||
|   * Added support for Ubuntu/Debian/Linux users [niftylettuce] | ||||
|   * Fixed: send notifications even if title not specified [alessioalex] | ||||
|  | ||||
| 1.2.0 / 2011-10-06  | ||||
| ================== | ||||
|  | ||||
|   * Add support for priority. | ||||
|  | ||||
| 1.1.0 / 2011-03-15  | ||||
| ================== | ||||
|  | ||||
|   * Added optional callbacks | ||||
|   * Added parsing of version | ||||
|  | ||||
| 1.0.1 / 2010-03-26 | ||||
| ================== | ||||
|  | ||||
|   * Fixed; sys.exec -> child_process.exec to support latest node | ||||
|  | ||||
| 1.0.0 / 2010-03-19 | ||||
| ================== | ||||
|    | ||||
|   * Initial release | ||||
							
								
								
									
										83
									
								
								node_modules/mocha/node_modules/growl/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								node_modules/mocha/node_modules/growl/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| # Growl for nodejs | ||||
|  | ||||
| Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl).  Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce). | ||||
|  | ||||
| ## Installation | ||||
|  | ||||
| ### Mac OS X (Darwin): | ||||
|  | ||||
|   Install [npm](http://npmjs.org/) and run: | ||||
|    | ||||
|       $ npm install growl | ||||
|  | ||||
| ### Ubuntu (Linux): | ||||
|  | ||||
|   Install `notify-send` through the [libnotify-bin](packages.ubuntu.com/libnotify-bin) package: | ||||
|  | ||||
|       $ sudo apt-get install libnotify-bin | ||||
|  | ||||
|   Install [npm](http://npmjs.org/) and run: | ||||
|    | ||||
|       $ npm install growl | ||||
|  | ||||
| ## Examples | ||||
|  | ||||
| Callback functions are optional | ||||
|  | ||||
|     var growl = require('growl') | ||||
|     growl('You have mail!') | ||||
|     growl('5 new messages', { sticky: true }) | ||||
|     growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true }) | ||||
|     growl('Message with title', { title: 'Title'}) | ||||
|     growl('Set priority', { priority: 2 }) | ||||
|     growl('Show Safari icon', { image: 'Safari' }) | ||||
|     growl('Show icon', { image: 'path/to/icon.icns' }) | ||||
|     growl('Show image', { image: 'path/to/my.image.png' }) | ||||
|     growl('Show png filesystem icon', { image: 'png' }) | ||||
|     growl('Show pdf filesystem icon', { image: 'article.pdf' }) | ||||
|     growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(err){ | ||||
|       // ... notified | ||||
|     }) | ||||
|  | ||||
| ## Options | ||||
|  | ||||
|   - title | ||||
|     - notification title | ||||
|   - name | ||||
|     - application name | ||||
|   - priority | ||||
|     - priority for the notification (default is 0) | ||||
|   - sticky | ||||
|     - weither or not the notification should remainin until closed | ||||
|   - image | ||||
|     - Auto-detects the context: | ||||
|       - path to an icon sets --iconpath | ||||
|       - path to an image sets --image | ||||
|       - capitalized word sets --appIcon | ||||
|       - filename uses extname as --icon | ||||
|       - otherwise treated as --icon | ||||
|        | ||||
| ## License  | ||||
|  | ||||
| (The MIT License) | ||||
|  | ||||
| Copyright (c) 2009 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. | ||||
							
								
								
									
										159
									
								
								node_modules/mocha/node_modules/growl/lib/growl.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										159
									
								
								node_modules/mocha/node_modules/growl/lib/growl.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,159 @@ | ||||
|  | ||||
| // Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed) | ||||
|  | ||||
| /** | ||||
|  * Module dependencies. | ||||
|  */ | ||||
|  | ||||
| var exec = require('child_process').exec | ||||
|   , path = require('path') | ||||
|   , os = require('os') | ||||
|   , cmd; | ||||
|  | ||||
| switch(os.type()) { | ||||
|   case 'Darwin': | ||||
|     cmd = { | ||||
|         type: "Darwin" | ||||
|       , pkg: "growlnotify" | ||||
|       , msg: '-m' | ||||
|       , sticky: '--sticky' | ||||
|       , priority: { | ||||
|             cmd: '--priority' | ||||
|           , range: [ | ||||
|               -2 | ||||
|             , -1 | ||||
|             , 0 | ||||
|             , 1 | ||||
|             , 2 | ||||
|             , "Very Low" | ||||
|             , "Moderate" | ||||
|             , "Normal" | ||||
|             , "High" | ||||
|             , "Emergency" | ||||
|           ] | ||||
|         } | ||||
|     }; | ||||
|     break; | ||||
|   case 'Linux': | ||||
|     cmd = { | ||||
|         type: "Linux" | ||||
|       , pkg: "notify-send" | ||||
|       , msg: '' | ||||
|       , sticky: '-t 0' | ||||
|       , priority: { | ||||
|           cmd: '-u' | ||||
|         , range: [ | ||||
|             "low" | ||||
|           , "normal" | ||||
|           , "critical" | ||||
|         ] | ||||
|       } | ||||
|     }; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Expose `growl`. | ||||
|  */ | ||||
|  | ||||
| exports = module.exports = growl; | ||||
|  | ||||
| /** | ||||
|  * Node-growl version. | ||||
|  */ | ||||
|  | ||||
| exports.version = '1.4.1' | ||||
|  | ||||
| /** | ||||
|  * Send growl notification _msg_ with _options_. | ||||
|  * | ||||
|  * Options: | ||||
|  * | ||||
|  *  - title   Notification title | ||||
|  *  - sticky  Make the notification stick (defaults to false) | ||||
|  *  - priority  Specify an int or named key (default is 0) | ||||
|  *  - name    Application name (defaults to growlnotify) | ||||
|  *  - image | ||||
|  *    - path to an icon sets --iconpath | ||||
|  *    - path to an image sets --image | ||||
|  *    - capitalized word sets --appIcon | ||||
|  *    - filename uses extname as --icon | ||||
|  *    - otherwise treated as --icon | ||||
|  * | ||||
|  * Examples: | ||||
|  * | ||||
|  *   growl('New email') | ||||
|  *   growl('5 new emails', { title: 'Thunderbird' }) | ||||
|  *   growl('Email sent', function(){ | ||||
|  *     // ... notification sent | ||||
|  *   }) | ||||
|  * | ||||
|  * @param {string} msg | ||||
|  * @param {object} options | ||||
|  * @param {function} fn | ||||
|  * @api public | ||||
|  */ | ||||
|  | ||||
| function growl(msg, options, fn) { | ||||
|   var image | ||||
|     , args = [cmd.pkg] | ||||
|     , options = options || {} | ||||
|     , fn = fn || function(){}; | ||||
|  | ||||
|   // noop | ||||
|   if (!cmd) return fn(new Error('growl not supported on this platform')); | ||||
|  | ||||
|   // image | ||||
|   if (image = options.image) { | ||||
|     switch(cmd.type) { | ||||
|       case 'Darwin': | ||||
|         var flag, ext = path.extname(image).substr(1) | ||||
|         flag = flag || ext == 'icns' && 'iconpath' | ||||
|         flag = flag || /^[A-Z]/.test(image) && 'appIcon' | ||||
|         flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image' | ||||
|         flag = flag || ext && (image = ext) && 'icon' | ||||
|         flag = flag || 'icon' | ||||
|         args.push('--' + flag, image) | ||||
|         break; | ||||
|       case 'Linux': | ||||
|         args.push('-i ' + image); | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // sticky | ||||
|   if (options.sticky) args.push(cmd.sticky); | ||||
|  | ||||
|   // priority | ||||
|   if (options.priority) { | ||||
|     var priority = options.priority + ''; | ||||
|     var checkindexOf = cmd.priority.range.indexOf(priority); | ||||
|     if (~cmd.priority.range.indexOf(priority)) { | ||||
|       args.push(cmd.priority, options.priority); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // name | ||||
|   if (options.name && cmd.type === "Darwin") { | ||||
|     args.push('--name', options.name); | ||||
|   } | ||||
|  | ||||
|   switch(cmd.type) { | ||||
|     case 'Darwin': | ||||
|       args.push(cmd.msg); | ||||
|       args.push('"' + msg + '"'); | ||||
|       if (options.title) args.push(options.title); | ||||
|       break; | ||||
|     case 'Linux': | ||||
|       if (options.title) { | ||||
|         args.push("'" + options.title + "'"); | ||||
|         args.push(cmd.msg); | ||||
|         args.push("'" + msg + "'"); | ||||
|       } else { | ||||
|         args.push("'" + msg + "'"); | ||||
|       } | ||||
|       break; | ||||
|   } | ||||
|  | ||||
|   // execute | ||||
|   exec(args.join(' '), fn); | ||||
| }; | ||||
							
								
								
									
										6
									
								
								node_modules/mocha/node_modules/growl/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								node_modules/mocha/node_modules/growl/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| { "name": "growl", | ||||
|   "version": "1.4.1", | ||||
|   "description": "Growl unobtrusive notifications", | ||||
|   "author": "TJ Holowaychuk <tj@vision-media.ca>", | ||||
|   "main": "./lib/growl.js" | ||||
| } | ||||
							
								
								
									
										16
									
								
								node_modules/mocha/node_modules/growl/test.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/mocha/node_modules/growl/test.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
|  | ||||
| var growl = require('./lib/growl') | ||||
|  | ||||
| growl('You have mail!') | ||||
| growl('5 new messages', { sticky: true }) | ||||
| growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true }) | ||||
| growl('Message with title', { title: 'Title'}) | ||||
| growl('Set priority', { priority: 2 }) | ||||
| growl('Show Safari icon', { image: 'Safari' }) | ||||
| growl('Show icon', { image: 'path/to/icon.icns' }) | ||||
| growl('Show image', { image: 'path/to/my.image.png' }) | ||||
| growl('Show png filesystem icon', { image: 'png' }) | ||||
| growl('Show pdf filesystem icon', { image: 'article.pdf' }) | ||||
| growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(){ | ||||
|   console.log('callback'); | ||||
| }) | ||||
							
								
								
									
										21
									
								
								node_modules/mocha/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/mocha/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| { | ||||
|     "name": "mocha" | ||||
|   , "version": "0.11.0" | ||||
|   , "description": "simple, flexible, fun test framework" | ||||
|   , "keywords": ["test", "bdd", "tdd", "tap"] | ||||
|   , "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||||
|   , "main": "index" | ||||
|   , "bin": { "mocha": "./bin/mocha", "_mocha": "./bin/_mocha" } | ||||
|   , "engines": { "node": ">= 0.4.x < 0.8.0" } | ||||
|   , "scripts": { | ||||
|     "test": "make test" | ||||
|   } | ||||
|   , "dependencies":{ | ||||
|       "commander": "0.5.x" | ||||
|     , "growl": "1.4.x" | ||||
|     , "debug": "*" | ||||
|   } | ||||
|   , "devDependencies": { | ||||
|     "should": "*" | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user