├── .travis.yml ├── README.md ├── examples ├── switch.css ├── switch.html └── switch.js ├── package.json ├── statelet.js └── tests ├── index.js └── node_modules ├── .bin └── tap └── tap ├── .npmignore ├── AUTHORS ├── LICENSE ├── README.md ├── bin ├── tap-http.js ├── tap-reader.js └── tap.js ├── coverage-example ├── lib │ ├── bar.js │ └── foo.js └── test │ ├── bar.test.js │ ├── baz.test.js │ └── foo.test.js ├── example ├── lib │ └── math.js └── test │ └── test-example.js ├── lib ├── harness.js ├── main.js ├── tap-assert.js ├── tap-browser-harness.js ├── tap-consumer.js ├── tap-cov-html.js ├── tap-global-harness.js ├── tap-harness.js ├── tap-producer.js ├── tap-results.js ├── tap-runner.js └── tap-test.js ├── node_modules ├── .bin │ └── nopt ├── deep-equal │ ├── README.markdown │ ├── example │ │ └── cmp.js │ ├── index.js │ ├── package.json │ └── test │ │ └── cmp.js ├── difflet │ ├── .travis.yml │ ├── README.markdown │ ├── example │ │ ├── cmp_array.js │ │ ├── cmp_object.js │ │ ├── colors.js │ │ ├── comma_first.js │ │ ├── html.js │ │ └── string.js │ ├── fail.js │ ├── index.js │ ├── node_modules │ │ ├── charm │ │ │ ├── README.markdown │ │ │ ├── example │ │ │ │ ├── column.js │ │ │ │ ├── cursor.js │ │ │ │ ├── http_spin.js │ │ │ │ ├── lucky.js │ │ │ │ ├── position.js │ │ │ │ ├── progress.js │ │ │ │ └── spin.js │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ └── encode.js │ │ │ └── package.json │ │ └── traverse │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.markdown │ │ │ ├── examples │ │ │ ├── json.js │ │ │ ├── leaves.js │ │ │ ├── negative.js │ │ │ ├── scrub.js │ │ │ └── stringify.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── test │ │ │ ├── circular.js │ │ │ ├── date.js │ │ │ ├── equal.js │ │ │ ├── has.js │ │ │ ├── instance.js │ │ │ ├── interface.js │ │ │ ├── json.js │ │ │ ├── keys.js │ │ │ ├── leaves.js │ │ │ ├── lib │ │ │ │ └── deep_equal.js │ │ │ ├── mutability.js │ │ │ ├── negative.js │ │ │ ├── obj.js │ │ │ ├── siblings.js │ │ │ ├── stop.js │ │ │ ├── stringify.js │ │ │ ├── subexpr.js │ │ │ └── super_deep.js │ │ │ └── testling │ │ │ └── leaves.js │ ├── package.json │ └── test │ │ └── html.js ├── inherits │ ├── LICENSE │ ├── README.md │ ├── inherits-old.js │ ├── inherits.js │ └── package.json ├── mkdirp │ ├── .gitignore.orig │ ├── .gitignore.rej │ ├── .npmignore │ ├── LICENSE │ ├── README.markdown │ ├── examples │ │ ├── pow.js │ │ ├── pow.js.orig │ │ └── pow.js.rej │ ├── index.js │ ├── package.json │ └── test │ │ ├── chmod.js │ │ ├── clobber.js │ │ ├── mkdirp.js │ │ ├── perm.js │ │ ├── perm_sync.js │ │ ├── race.js │ │ ├── rel.js │ │ ├── sync.js │ │ ├── umask.js │ │ └── umask_sync.js ├── nopt │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── bin │ │ └── nopt.js │ ├── examples │ │ └── my-program.js │ ├── lib │ │ └── nopt.js │ ├── node_modules │ │ └── abbrev │ │ │ ├── README.md │ │ │ ├── lib │ │ │ └── abbrev.js │ │ │ └── package.json │ └── package.json ├── runforcover │ ├── README.markdown │ ├── index.js │ ├── node_modules │ │ └── bunker │ │ │ ├── .npmignore │ │ │ ├── README.markdown │ │ │ ├── example │ │ │ ├── prof.js │ │ │ ├── tiny.js │ │ │ └── top │ │ │ │ ├── run.js │ │ │ │ └── src.js │ │ │ ├── index.js │ │ │ ├── node_modules │ │ │ └── burrito │ │ │ │ ├── .npmignore │ │ │ │ ├── README.markdown │ │ │ │ ├── browserify.js │ │ │ │ ├── example │ │ │ │ ├── microwave.js │ │ │ │ ├── web │ │ │ │ │ ├── bs.js │ │ │ │ │ ├── index.html │ │ │ │ │ ├── main.js │ │ │ │ │ └── server.js │ │ │ │ └── wrap.js │ │ │ │ ├── index.html │ │ │ │ ├── index.js │ │ │ │ ├── main.js │ │ │ │ ├── node_modules │ │ │ │ ├── .bin │ │ │ │ │ └── uglifyjs │ │ │ │ ├── traverse │ │ │ │ │ ├── .npmignore │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README.markdown │ │ │ │ │ ├── examples │ │ │ │ │ │ ├── json.js │ │ │ │ │ │ ├── leaves.js │ │ │ │ │ │ ├── negative.js │ │ │ │ │ │ ├── scrub.js │ │ │ │ │ │ └── stringify.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── main.js │ │ │ │ │ ├── package.json │ │ │ │ │ └── test │ │ │ │ │ │ ├── circular.js │ │ │ │ │ │ ├── date.js │ │ │ │ │ │ ├── equal.js │ │ │ │ │ │ ├── instance.js │ │ │ │ │ │ ├── interface.js │ │ │ │ │ │ ├── json.js │ │ │ │ │ │ ├── keys.js │ │ │ │ │ │ ├── leaves.js │ │ │ │ │ │ ├── lib │ │ │ │ │ │ └── deep_equal.js │ │ │ │ │ │ ├── mutability.js │ │ │ │ │ │ ├── negative.js │ │ │ │ │ │ ├── obj.js │ │ │ │ │ │ ├── siblings.js │ │ │ │ │ │ ├── stop.js │ │ │ │ │ │ ├── stringify.js │ │ │ │ │ │ ├── subexpr.js │ │ │ │ │ │ └── super_deep.js │ │ │ │ └── uglify-js │ │ │ │ │ ├── .npmignore │ │ │ │ │ ├── README.html │ │ │ │ │ ├── README.org │ │ │ │ │ ├── bin │ │ │ │ │ └── uglifyjs │ │ │ │ │ ├── docstyle.css │ │ │ │ │ ├── lib │ │ │ │ │ ├── object-ast.js │ │ │ │ │ ├── parse-js.js │ │ │ │ │ ├── process.js │ │ │ │ │ └── squeeze-more.js │ │ │ │ │ ├── package.json │ │ │ │ │ ├── test │ │ │ │ │ ├── beautify.js │ │ │ │ │ ├── testparser.js │ │ │ │ │ └── unit │ │ │ │ │ │ ├── compress │ │ │ │ │ │ ├── expected │ │ │ │ │ │ │ ├── array1.js │ │ │ │ │ │ │ ├── array2.js │ │ │ │ │ │ │ ├── array3.js │ │ │ │ │ │ │ ├── array4.js │ │ │ │ │ │ │ ├── assignment.js │ │ │ │ │ │ │ ├── concatstring.js │ │ │ │ │ │ │ ├── const.js │ │ │ │ │ │ │ ├── empty-blocks.js │ │ │ │ │ │ │ ├── forstatement.js │ │ │ │ │ │ │ ├── if.js │ │ │ │ │ │ │ ├── ifreturn.js │ │ │ │ │ │ │ ├── ifreturn2.js │ │ │ │ │ │ │ ├── issue10.js │ │ │ │ │ │ │ ├── issue11.js │ │ │ │ │ │ │ ├── issue13.js │ │ │ │ │ │ │ ├── issue14.js │ │ │ │ │ │ │ ├── issue16.js │ │ │ │ │ │ │ ├── issue17.js │ │ │ │ │ │ │ ├── issue20.js │ │ │ │ │ │ │ ├── issue21.js │ │ │ │ │ │ │ ├── issue25.js │ │ │ │ │ │ │ ├── issue27.js │ │ │ │ │ │ │ ├── issue28.js │ │ │ │ │ │ │ ├── issue29.js │ │ │ │ │ │ │ ├── issue30.js │ │ │ │ │ │ │ ├── issue34.js │ │ │ │ │ │ │ ├── issue4.js │ │ │ │ │ │ │ ├── issue48.js │ │ │ │ │ │ │ ├── issue50.js │ │ │ │ │ │ │ ├── issue53.js │ │ │ │ │ │ │ ├── issue54.1.js │ │ │ │ │ │ │ ├── issue68.js │ │ │ │ │ │ │ ├── issue69.js │ │ │ │ │ │ │ ├── issue9.js │ │ │ │ │ │ │ ├── mangle.js │ │ │ │ │ │ │ ├── strict-equals.js │ │ │ │ │ │ │ ├── var.js │ │ │ │ │ │ │ └── with.js │ │ │ │ │ │ └── test │ │ │ │ │ │ │ ├── array1.js │ │ │ │ │ │ │ ├── array2.js │ │ │ │ │ │ │ ├── array3.js │ │ │ │ │ │ │ ├── array4.js │ │ │ │ │ │ │ ├── assignment.js │ │ │ │ │ │ │ ├── concatstring.js │ │ │ │ │ │ │ ├── const.js │ │ │ │ │ │ │ ├── empty-blocks.js │ │ │ │ │ │ │ ├── forstatement.js │ │ │ │ │ │ │ ├── if.js │ │ │ │ │ │ │ ├── ifreturn.js │ │ │ │ │ │ │ ├── ifreturn2.js │ │ │ │ │ │ │ ├── issue10.js │ │ │ │ │ │ │ ├── issue11.js │ │ │ │ │ │ │ ├── issue13.js │ │ │ │ │ │ │ ├── issue14.js │ │ │ │ │ │ │ ├── issue16.js │ │ │ │ │ │ │ ├── issue17.js │ │ │ │ │ │ │ ├── issue20.js │ │ │ │ │ │ │ ├── issue21.js │ │ │ │ │ │ │ ├── issue25.js │ │ │ │ │ │ │ ├── issue27.js │ │ │ │ │ │ │ ├── issue28.js │ │ │ │ │ │ │ ├── issue29.js │ │ │ │ │ │ │ ├── issue30.js │ │ │ │ │ │ │ ├── issue34.js │ │ │ │ │ │ │ ├── issue4.js │ │ │ │ │ │ │ ├── issue48.js │ │ │ │ │ │ │ ├── issue50.js │ │ │ │ │ │ │ ├── issue53.js │ │ │ │ │ │ │ ├── issue54.1.js │ │ │ │ │ │ │ ├── issue68.js │ │ │ │ │ │ │ ├── issue69.js │ │ │ │ │ │ │ ├── issue9.js │ │ │ │ │ │ │ ├── mangle.js │ │ │ │ │ │ │ ├── strict-equals.js │ │ │ │ │ │ │ ├── var.js │ │ │ │ │ │ │ └── with.js │ │ │ │ │ │ └── scripts.js │ │ │ │ │ ├── tmp │ │ │ │ │ ├── hoist.js │ │ │ │ │ ├── instrument.js │ │ │ │ │ ├── instrument2.js │ │ │ │ │ └── test.js │ │ │ │ │ └── uglify-js.js │ │ │ │ ├── package.json │ │ │ │ ├── server.js │ │ │ │ └── test │ │ │ │ ├── ast.js │ │ │ │ ├── err.js │ │ │ │ ├── fail.js │ │ │ │ ├── fail │ │ │ │ └── src.js │ │ │ │ ├── label.js │ │ │ │ ├── microwave.js │ │ │ │ ├── parent.js │ │ │ │ └── wrap.js │ │ │ ├── package.json │ │ │ └── test │ │ │ ├── cover.js │ │ │ └── src │ │ │ └── cover.js │ ├── package.json │ └── test │ │ ├── index.js │ │ ├── interface.js │ │ └── src │ │ └── coverage.js ├── slide │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── async-map-ordered.js │ │ ├── async-map.js │ │ ├── bind-actor.js │ │ ├── chain.js │ │ └── slide.js │ ├── nodejs-controlling-flow.pdf │ └── package.json └── yamlish │ ├── LICENSE │ ├── README.md │ ├── package.json │ └── yamlish.js ├── package.json ├── test-disabled ├── bailout.js ├── foo.js └── t.js └── test ├── common.js ├── deep.js ├── independent-timeouts.js ├── isolated-conf-test.js ├── meta-test.js ├── nested-test.js ├── non-tap-output.js ├── result-trap.js ├── simple-harness-test-with-plan.js ├── simple-harness-test.js ├── test-test.js ├── timeout.js └── trivial-success.js /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | - 0.8 5 | - 0.10 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Statelet 2 | 3 | [![Build Status](https://secure.travis-ci.org/joshwnj/statelet.png)](http://travis-ci.org/joshwnj/statelet) 4 | 5 | Sometimes we have a pattern like: 6 | 7 | ```js 8 | if (is_ready) { 9 | // do the thing 10 | } 11 | else { 12 | // put into a queue and execute when is_ready=true 13 | } 14 | ``` 15 | 16 | Events make it better: 17 | 18 | ```js 19 | emitter.on('ready', function () { 20 | // do the thing 21 | }); 22 | ``` 23 | 24 | But what if you start listening too late and you miss the event? You'll be waiting forever... 25 | 26 | `statelet` takes a different approach where instead of listening for events we're watching for changes in state: 27 | 28 | ```js 29 | is_ready.when(true, function () { 30 | // do the thing 31 | }); 32 | ``` 33 | 34 | ## Combining States 35 | 36 | Sometimes you want to know when multiple states align in a certain way. 37 | 38 | ```js 39 | var State = require('statelet'); 40 | 41 | var is_happy = new State(); 42 | var knows_it = new State(); 43 | var action = new State(); 44 | 45 | function onChange () { 46 | var youre_happy = is_happy.get(); 47 | var you_know_it = knows_it.get(); 48 | 49 | if (youre_happy && you_know_it) { 50 | action.set('clap your hands'); 51 | } 52 | } 53 | is_happy.watch(onChange); 54 | knows_it.watch(onChange); 55 | ``` 56 | 57 | ## Where can I use it? 58 | 59 | Works in both node.js and browser. 60 | You can use it as either AMD or CommonJS style module. 61 | 62 | ## Install 63 | 64 | ``` 65 | npm install statelet 66 | ``` 67 | 68 | ## To do 69 | 70 | * make sure examples have decent cross-browser support 71 | * more examples 72 | 73 | ## License 74 | 75 | MIT 76 | -------------------------------------------------------------------------------- /examples/switch.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica, sans-serif; 3 | } 4 | 5 | #switch { 6 | position: relative; 7 | width: 200px; 8 | height: 50px; 9 | border-radius: 50px; 10 | background: #666; 11 | border: 3px solid black; 12 | cursor: pointer; 13 | } 14 | 15 | #switch .label { 16 | position: absolute; 17 | display: block; 18 | height: 100%; 19 | color: #333; 20 | font-size: 32px; 21 | top: 0; 22 | line-height: 50px; 23 | text-transform: uppercase; 24 | text-align: center; 25 | background: #666; 26 | border-radius: 50px; 27 | width: 100px; 28 | } 29 | 30 | #switch .label.on { 31 | left: 0px; 32 | } 33 | 34 | #switch .label.off { 35 | right: 0px; 36 | } 37 | 38 | #switch .thumb { 39 | position: absolute; 40 | background: #FFF; 41 | top: 0; 42 | left: 0; 43 | width: 100px; 44 | height: 100%; 45 | border-radius: 50px; 46 | 47 | -webkit-transition: left 0.1s; 48 | } 49 | 50 | 51 | #switch.is_on .thumb { 52 | left: 50%; 53 | } 54 | 55 | #switch .label { z-index: 100; } 56 | #switch .thumb { z-index: 200; } -------------------------------------------------------------------------------- /examples/switch.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Example: switch 5 | 6 | 7 | 8 |
9 | On 10 | Off 11 | 12 |
13 |

Switch is

14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/switch.js: -------------------------------------------------------------------------------- 1 | /*global State, $*/ 2 | var is_on = new State(false); 3 | var button = $('#switch'); 4 | var text_elm = $('#text .value'); 5 | 6 | is_on.watch(function (value) { 7 | text_elm.text(value ? 'on' : 'off'); 8 | button.toggleClass('is_on', value); 9 | }); 10 | 11 | button.on('click', function () { 12 | is_on.set(!is_on.get()); 13 | }); 14 | 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "statelet", 3 | "version": "0.3.0", 4 | "author": "Josh Johnston (@joshwnj)", 5 | "description": "Little state objects", 6 | "contributors": [ 7 | "Kamil Ogórek (@kamilogorek)", 8 | "Weston Ruter (@westonruter)" 9 | ], 10 | "repository": "git://github.com/joshwnj/statelet.git", 11 | "engines": { 12 | "node": ">=0.6" 13 | }, 14 | "scripts": { 15 | "test": "node tests" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/index.js: -------------------------------------------------------------------------------- 1 | var State = require('../statelet'); 2 | var test = require('tap').test; 3 | 4 | test('Only notify if state changes', function (t) { 5 | var s = new State(); 6 | 7 | var times = 0; 8 | s.watch(function (value) { 9 | times += 1; 10 | t.ok(times === 1, 'Watcher should only be called once'); 11 | }); 12 | 13 | s.set(true); 14 | s.set(true); 15 | 16 | t.end(); 17 | }); 18 | 19 | test('Ensure unwatch removes watcher', function (t) { 20 | var s = new State(); 21 | 22 | var times = 0; 23 | var watcher = function (value) { 24 | times += 1; 25 | }; 26 | 27 | s.watch(watcher); 28 | s.set('1st'); 29 | s.set('2nd'); 30 | s.unwatch(watcher); 31 | s.set('3rd'); 32 | 33 | process.nextTick(function () { 34 | t.ok(times === 2, 'Watcher should only be called twice'); 35 | }); 36 | 37 | t.end(); 38 | }); 39 | -------------------------------------------------------------------------------- /tests/node_modules/.bin/tap: -------------------------------------------------------------------------------- 1 | ../tap/bin/tap.js -------------------------------------------------------------------------------- /tests/node_modules/tap/.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshwnj/statelet/1a7316f6ffbd091d528ad23844812e5334510f6d/tests/node_modules/tap/.npmignore -------------------------------------------------------------------------------- /tests/node_modules/tap/AUTHORS: -------------------------------------------------------------------------------- 1 | # contributors sorted by whether or not they're me 2 | Isaac Z. Schlueter 3 | baudehlo 4 | James Halliday 5 | Jason Smith (air) 6 | Pedro P. Candel 7 | Stein Martin Hustad 8 | Trent Mick 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter. 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /tests/node_modules/tap/bin/tap-http.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // just an example, really 4 | // Run with `node tap-http.js path/to/tests/` 5 | 6 | var argv = process.argv.slice(2) 7 | , path = require("path") 8 | , Runner = require("../lib/tap-runner") 9 | 10 | , http = require("http") 11 | , server = http.createServer(function (req, res) { 12 | // it'd be nice to return a non-200 if the tests fail, but we don't 13 | // know the status until it's done, so that would mean not being able 14 | // to pipe the output 15 | res.writeHead(200, {'content-type': 'text/plain'}) 16 | new Runner(argv, null).pipe(res) 17 | }) 18 | 19 | server.listen(1337) 20 | -------------------------------------------------------------------------------- /tests/node_modules/tap/bin/tap-reader.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // read a tap stream from stdin. 4 | 5 | var TapConsumer = require("../lib/tap-consumer") 6 | , TapProducer = require("../lib/tap-producer") 7 | 8 | var tc = new TapConsumer 9 | , tp = new TapProducer 10 | 11 | //process.stdin.pipe(tc) 12 | process.stdin.on("data", function (c) { 13 | c = c + "" 14 | // console.error(JSON.stringify(c).substr(0, 100)) 15 | tc.write(c) 16 | }) 17 | process.stdin.on("end", function () { tc.end() }) 18 | process.stdin.resume() 19 | //tc.pipe(tp) 20 | tc.on("data", function (c) { 21 | tp.write(c) 22 | }) 23 | tc.on("end", function () { tp.end() }) 24 | 25 | tp.on("data", function (c) { 26 | console.error(["output write", c]) 27 | process.stdout.write(c) 28 | }) 29 | 30 | tp.on("end", function (er, total, ok) { 31 | if (er) throw er 32 | process.exit(total - ok) 33 | }) 34 | -------------------------------------------------------------------------------- /tests/node_modules/tap/coverage-example/lib/bar.js: -------------------------------------------------------------------------------- 1 | var Bar = module.exports = function(str) { 2 | this.bar = str; 3 | this.str = str; 4 | }; 5 | 6 | Bar.prototype.foo = function() { 7 | var self = this; 8 | return self.bar; 9 | }; 10 | 11 | Bar.prototype.baz = function() { 12 | var self = this; 13 | return self.str; 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /tests/node_modules/tap/coverage-example/lib/foo.js: -------------------------------------------------------------------------------- 1 | var Foo = module.exports = function(str) { 2 | this.foo = str; 3 | this.str = str; 4 | }; 5 | 6 | Foo.prototype.bar = function() { 7 | var self = this; 8 | return self.foo; 9 | }; 10 | 11 | Foo.prototype.baz = function() { 12 | var self = this; 13 | return self.str; 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /tests/node_modules/tap/coverage-example/test/bar.test.js: -------------------------------------------------------------------------------- 1 | var test = require('tap').test, 2 | Bar = require('../lib/bar'), 3 | bar; 4 | 5 | test('setup', function(t) { 6 | bar = new Bar('baz'); 7 | t.ok(bar); 8 | t.end(); 9 | }); 10 | 11 | test('bar', function(t) { 12 | t.equal('baz', bar.foo()); 13 | t.end(); 14 | }); 15 | 16 | test('teardown', function(t) { 17 | t.ok(true); 18 | t.end(); 19 | }); 20 | 21 | -------------------------------------------------------------------------------- /tests/node_modules/tap/coverage-example/test/baz.test.js: -------------------------------------------------------------------------------- 1 | var test = require('tap').test, 2 | Foo = require('../lib/foo'), 3 | Bar = require('../lib/bar'), 4 | foo, bar; 5 | 6 | test('setup', function(t) { 7 | foo = new Foo('baz'); 8 | t.ok(foo); 9 | bar = new Bar('baz'); 10 | t.ok(bar); 11 | t.end(); 12 | }); 13 | 14 | test('baz from Foo', function(t) { 15 | t.equal('baz', foo.baz()); 16 | t.end(); 17 | }); 18 | 19 | test('baz from Bar', function(t) { 20 | t.equal('baz', bar.baz()); 21 | t.end(); 22 | }); 23 | 24 | 25 | test('teardown', function(t) { 26 | t.ok(true); 27 | t.end(); 28 | }); 29 | 30 | -------------------------------------------------------------------------------- /tests/node_modules/tap/coverage-example/test/foo.test.js: -------------------------------------------------------------------------------- 1 | var test = require('tap').test, 2 | Foo = require('../lib/foo'), 3 | foo; 4 | 5 | test('setup', function(t) { 6 | foo = new Foo('baz'); 7 | t.ok(foo); 8 | t.end(); 9 | }); 10 | 11 | test('bar', function(t) { 12 | t.equal('baz', foo.bar()); 13 | t.end(); 14 | }); 15 | 16 | test('teardown', function(t) { 17 | t.ok(true); 18 | t.end(); 19 | }); 20 | 21 | -------------------------------------------------------------------------------- /tests/node_modules/tap/example/lib/math.js: -------------------------------------------------------------------------------- 1 | module.exports = Math 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/lib/main.js: -------------------------------------------------------------------------------- 1 | 2 | var GlobalHarness = require("./tap-global-harness") 3 | 4 | // this lets you do stuff like: 5 | // var test = require("tap").test 6 | // test(...) 7 | // to run stuff in the global harness. 8 | exports = module.exports = new GlobalHarness() 9 | 10 | exports.createProducer = exports.Producer = require("./tap-producer") 11 | exports.createConsumer = exports.Consumer = require("./tap-consumer") 12 | exports.yamlish = require("yamlish") 13 | exports.createTest = exports.Test = require("./tap-test") 14 | exports.createHarness = exports.Harness = require("./tap-harness") 15 | exports.createRunner = exports.Runner = require("./tap-runner") 16 | exports.assert = require("./tap-assert") 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/lib/tap-browser-harness.js: -------------------------------------------------------------------------------- 1 | // this is just a harness that pipes to stdout. 2 | // It's the default one. 3 | module.exports = BrowserHarness 4 | 5 | var BrowserHarness = global.TAP_Browser_Harness 6 | , inherits = require("inherits") 7 | , Results = require("./tap-results") 8 | , Harness = require("./tap-harness") 9 | , Test = require("./tap-test") 10 | 11 | inherits(BrowserHarness, Harness) 12 | function BrowserHarness (outPipe) { 13 | //console.error("calling BrowserHarness") 14 | if (browserHarness) return browserHarness 15 | if (!(this instanceof BrowserHarness)) { 16 | return browserHarness = new BrowserHarness 17 | } 18 | browserHarness = global.TAP_Browser_Harness = this 19 | BrowserHarness.super.call(this, Test) 20 | 21 | if (outPipe) this.output.pipe(outPipe) 22 | 23 | this.test = this.test.bind(this) 24 | 25 | this.plan = this.plan.bind(this) 26 | 27 | var output = this.output 28 | this.on("childEnd", function (child) { 29 | //console.error("childEnd in global harness") 30 | //console.error(child.results) 31 | // write out the stuff for this child. 32 | //console.error("child.conf", child.conf) 33 | output.write(child.conf.name || "(unnamed test)") 34 | // maybe write some other stuff about the number of tests in this 35 | // thing, etc. I dunno. 36 | //console.error("child results", child.results) 37 | this.results.list.forEach(function (res) { 38 | //delete res.error 39 | //console.error("child resuilt", res) 40 | output.write(res) 41 | }) 42 | //console.error("wrote child results") 43 | this.results.list.length = 0 44 | }) 45 | 46 | var streamEnded = false 47 | this.on("end", function () { 48 | //console.error("global ending the stream") 49 | if (!streamEnded) { 50 | this.results.list.forEach(function (res) { 51 | output.write(res) 52 | }) 53 | this.results.list.length = 0 54 | output.end() 55 | streamEnded = true 56 | } 57 | }) 58 | 59 | // TODO: handle global errors 60 | // process.on("unhandledException", function (e) { 61 | // this.bailout("unhandled exception: " + e.message) 62 | // }) 63 | } 64 | -------------------------------------------------------------------------------- /tests/node_modules/tap/lib/tap-cov-html.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'), 2 | path = require('path'), 3 | asyncMap = require("slide").asyncMap, 4 | util = require('util'); 5 | 6 | var CovHtml = module.exports = function(cov_stats, cov_dir, cb) { 7 | var index = []; 8 | 9 | asyncMap( 10 | Object.keys(cov_stats), 11 | function(f, cb) { 12 | var st = cov_stats[f], 13 | missing_lines = st.missing.map(function(l) { 14 | return l.number; 15 | }), 16 | out = '\n\n\n ' + 17 | '\n ' + 18 | 19 | f + ' (' + st.loc + ')\n' + 20 | '\n' + 26 | '\n\n' + 27 | '

' + f + ' (' + st.loc + ')' + '

' + 28 | '

Run: ' + (st.missing.length ? st.loc - st.missing.length : st.loc) + ', Missing: ' + 29 | st.missing.length + ', Percentage: ' + st.percentage + '

' + 30 | '

Source:

\n' + 31 | '
    \n' + 32 | st.lines.map(function(line) { 33 | var number = line.number, 34 | color = (missing_lines.indexOf(number) !== -1) ? '#fcc' : '#cfc'; 35 | return '
  1. ' + line.source.replace(/'; 37 | }).join('\n') + 38 | '
\n' + 39 | '

Data

\n'+ 40 | '
' + util.inspect(st, true, Infinity, false).replace(/\n';
41 | 
42 |       fs.writeFile(
43 |         cov_dir + '/' + 
44 |         f.replace(process.cwd() + '/', '').replace(/\//g, '+') + '.html',
45 |         out,
46 |         'utf8',
47 |         function(err) {
48 |           if (err) {
49 |             throw err;
50 |           }
51 |           index.push(f);
52 |           cb();
53 |         });
54 |     },
55 |     function(err) {
56 |       if (err) {
57 |         throw err;
58 |       }
59 |       var out = '\n\n\n  ' +
60 |           '\n  Coverage Index\n\n' +
61 |           '\n

Code Coverage Information

\n
    ' + 62 | index.map(function(fname) { 63 | return '
  • ' + fname + '
  • '; 66 | }).join('\n') + '
\n\n'; 67 | 68 | fs.writeFile(cov_dir + '/index.html', out, 'utf8', function(err) { 69 | if (err) { 70 | throw err; 71 | } 72 | cb(); 73 | }); 74 | } 75 | ); 76 | }; 77 | 78 | 79 | -------------------------------------------------------------------------------- /tests/node_modules/tap/lib/tap-global-harness.js: -------------------------------------------------------------------------------- 1 | // this is just a harness that pipes to stdout. 2 | // It's the default one. 3 | module.exports = GlobalHarness 4 | 5 | var globalHarness = global.TAP_Global_Harness 6 | , inherits = require("inherits") 7 | , Results = require("./tap-results") 8 | , Harness = require("./tap-harness") 9 | , Test = require("./tap-test") 10 | 11 | inherits(GlobalHarness, Harness) 12 | function GlobalHarness () { 13 | //console.error("calling GlobalHarness") 14 | if (globalHarness) return globalHarness 15 | if (!(this instanceof GlobalHarness)) { 16 | return globalHarness = new GlobalHarness 17 | } 18 | 19 | globalHarness = global.TAP_Global_Harness = this 20 | GlobalHarness.super.call(this, Test) 21 | 22 | this.output.pipe(process.stdout) 23 | //this.output.on("data", function () { 24 | // process.nextTick(process.stdout.flush.bind(process.stdout)) 25 | //}) 26 | 27 | this.test = this.test.bind(this) 28 | 29 | this.plan = this.plan.bind(this) 30 | 31 | var output = this.output 32 | this.on("childEnd", function (child) { 33 | //console.error("childEnd in global harness") 34 | //console.error(child.results) 35 | // write out the stuff for this child. 36 | //console.error("child.conf", child.conf) 37 | output.write(child.conf.name || "(unnamed test)") 38 | // maybe write some other stuff about the number of tests in this 39 | // thing, etc. I dunno. 40 | //console.error("child results", child.results) 41 | this.results.list.forEach(function (res) { 42 | //delete res.error 43 | //console.error("child resuilt", res) 44 | output.write(res) 45 | }) 46 | //console.error("wrote child results") 47 | this.results.list.length = 0 48 | }) 49 | 50 | var streamEnded = false 51 | this.on("end", function () { 52 | //console.error("global ending the stream") 53 | if (!streamEnded) { 54 | this.results.list.forEach(function (res) { 55 | output.write(res) 56 | }) 57 | this.results.list.length = 0 58 | output.end() 59 | streamEnded = true 60 | } 61 | }) 62 | 63 | //this.on("end", this.output.end.bind(this.output)) 64 | 65 | process.on("unhandledException", function (e) { 66 | this.bailout("unhandled exception: " + e.message) 67 | }) 68 | } 69 | -------------------------------------------------------------------------------- /tests/node_modules/tap/lib/tap-results.js: -------------------------------------------------------------------------------- 1 | // A class for counting up results in a test harness. 2 | 3 | module.exports = Results 4 | 5 | var inherits = require("inherits") 6 | , EventEmitter = require("events").EventEmitter 7 | 8 | inherits(Results, EventEmitter) 9 | 10 | function Results (r) { 11 | //console.error("result constructor", r) 12 | this.ok = true 13 | this.addSet(r) 14 | } 15 | 16 | Results.prototype.addSet = function (r) { 17 | //console.error("add set of results", r) 18 | r = r || {ok: true} 19 | ; [ "todo" 20 | , "todoPass" 21 | , "todoFail" 22 | , "skip" 23 | , "skipPass" 24 | , "skipFail" 25 | , "pass" 26 | , "passTotal" 27 | , "fail" 28 | , "failTotal" 29 | , "tests" 30 | , "testsTotal" ].forEach(function (k) { 31 | this[k] = (this[k] || 0) + (r[k] || 0) 32 | //console.error([k, this[k]]) 33 | }, this) 34 | 35 | this.ok = this.ok && r.ok && true 36 | this.bailedOut = this.bailedOut || r.bailedOut || false 37 | this.list = (this.list || []).concat(r.list || []) 38 | this.emit("set", this.list) 39 | //console.error("after addSet", this) 40 | } 41 | 42 | Results.prototype.add = function (r, addToList) { 43 | //console.error("add result", r) 44 | var pf = r.ok ? "pass" : "fail" 45 | , PF = r.ok ? "Pass" : "Fail" 46 | 47 | this.testsTotal ++ 48 | this[pf + "Total"] ++ 49 | 50 | if (r.skip) { 51 | this["skip" + PF] ++ 52 | this.skip ++ 53 | } else if (r.todo) { 54 | this["todo" + PF] ++ 55 | this.todo ++ 56 | } else { 57 | this.tests ++ 58 | this[pf] ++ 59 | } 60 | 61 | if (r.bailout || typeof r.bailout === "string") { 62 | // console.error("Bailing out in result") 63 | this.bailedOut = true 64 | } 65 | this.ok = !!(this.ok && r.ok) 66 | 67 | if (addToList === false) return 68 | this.list = this.list || [] 69 | this.list.push(r) 70 | this.emit("result", r) 71 | } 72 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/.bin/nopt: -------------------------------------------------------------------------------- 1 | ../nopt/bin/nopt.js -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/deep-equal/README.markdown: -------------------------------------------------------------------------------- 1 | deep-equal 2 | ========== 3 | 4 | Node's `assert.deepEqual() algorithm` as a standalone module. 5 | 6 | example 7 | ======= 8 | 9 | ``` js 10 | var equal = require('deep-equal'); 11 | console.dir([ 12 | equal( 13 | { a : [ 2, 3 ], b : [ 4 ] }, 14 | { a : [ 2, 3 ], b : [ 4 ] } 15 | ), 16 | equal( 17 | { x : 5, y : [6] }, 18 | { x : 5, y : 6 } 19 | ) 20 | ]); 21 | ``` 22 | 23 | methods 24 | ======= 25 | 26 | var deepEqual = require('deep-equal') 27 | 28 | deepEqual(a, b) 29 | --------------- 30 | 31 | Compare objects `a` and `b`, returning whether they are equal according to a 32 | recursive equality algorithm. 33 | 34 | install 35 | ======= 36 | 37 | With [npm](http://npmjs.org) do: 38 | 39 | ``` 40 | npm install deep-equal 41 | ``` 42 | 43 | test 44 | ==== 45 | 46 | With [npm](http://npmjs.org) do: 47 | 48 | ``` 49 | npm test 50 | ``` 51 | 52 | license 53 | ======= 54 | 55 | MIT. Derived largely from node's assert module. 56 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/deep-equal/example/cmp.js: -------------------------------------------------------------------------------- 1 | var equal = require('../'); 2 | console.dir([ 3 | equal( 4 | { a : [ 2, 3 ], b : [ 4 ] }, 5 | { a : [ 2, 3 ], b : [ 4 ] } 6 | ), 7 | equal( 8 | { x : 5, y : [6] }, 9 | { x : 5, y : 6 } 10 | ) 11 | ]); 12 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/deep-equal/index.js: -------------------------------------------------------------------------------- 1 | var pSlice = Array.prototype.slice; 2 | var Object_keys = typeof Object.keys === 'function' 3 | ? Object.keys 4 | : function (obj) { 5 | var keys = []; 6 | for (var key in obj) keys.push(key); 7 | return keys; 8 | } 9 | ; 10 | 11 | var deepEqual = module.exports = function (actual, expected) { 12 | // 7.1. All identical values are equivalent, as determined by ===. 13 | if (actual === expected) { 14 | return true; 15 | 16 | } else if (actual instanceof Date && expected instanceof Date) { 17 | return actual.getTime() === expected.getTime(); 18 | 19 | // 7.3. Other pairs that do not both pass typeof value == 'object', 20 | // equivalence is determined by ==. 21 | } else if (typeof actual != 'object' && typeof expected != 'object') { 22 | return actual == expected; 23 | 24 | // 7.4. For all other Object pairs, including Array objects, equivalence is 25 | // determined by having the same number of owned properties (as verified 26 | // with Object.prototype.hasOwnProperty.call), the same set of keys 27 | // (although not necessarily the same order), equivalent values for every 28 | // corresponding key, and an identical 'prototype' property. Note: this 29 | // accounts for both named and indexed properties on Arrays. 30 | } else { 31 | return objEquiv(actual, expected); 32 | } 33 | } 34 | 35 | function isUndefinedOrNull(value) { 36 | return value === null || value === undefined; 37 | } 38 | 39 | function isArguments(object) { 40 | return Object.prototype.toString.call(object) == '[object Arguments]'; 41 | } 42 | 43 | function objEquiv(a, b) { 44 | if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) 45 | return false; 46 | // an identical 'prototype' property. 47 | if (a.prototype !== b.prototype) return false; 48 | //~~~I've managed to break Object.keys through screwy arguments passing. 49 | // Converting to array solves the problem. 50 | if (isArguments(a)) { 51 | if (!isArguments(b)) { 52 | return false; 53 | } 54 | a = pSlice.call(a); 55 | b = pSlice.call(b); 56 | return deepEqual(a, b); 57 | } 58 | try { 59 | var ka = Object_keys(a), 60 | kb = Object_keys(b), 61 | key, i; 62 | } catch (e) {//happens when one is a string literal and the other isn't 63 | return false; 64 | } 65 | // having the same number of owned properties (keys incorporates 66 | // hasOwnProperty) 67 | if (ka.length != kb.length) 68 | return false; 69 | //the same set of keys (although not necessarily the same order), 70 | ka.sort(); 71 | kb.sort(); 72 | //~~~cheap key test 73 | for (i = ka.length - 1; i >= 0; i--) { 74 | if (ka[i] != kb[i]) 75 | return false; 76 | } 77 | //equivalent values for every corresponding key, and 78 | //~~~possibly expensive deep test 79 | for (i = ka.length - 1; i >= 0; i--) { 80 | key = ka[i]; 81 | if (!deepEqual(a[key], b[key])) return false; 82 | } 83 | return true; 84 | } 85 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/deep-equal/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "deep-equal", 3 | "version" : "0.0.0", 4 | "description" : "node's assert.deepEqual algorithm", 5 | "main" : "index.js", 6 | "directories" : { 7 | "lib" : ".", 8 | "example" : "example", 9 | "test" : "test" 10 | }, 11 | "scripts" : { 12 | "test" : "tap test/*.js" 13 | }, 14 | "devDependencies" : { 15 | "tap" : "0.0.x" 16 | }, 17 | "repository" : { 18 | "type" : "git", 19 | "url" : "http://github.com/substack/node-deep-equal.git" 20 | }, 21 | "keywords" : [ 22 | "equality", 23 | "equal", 24 | "compare" 25 | ], 26 | "author" : { 27 | "name" : "James Halliday", 28 | "email" : "mail@substack.net", 29 | "url" : "http://substack.net" 30 | }, 31 | "license" : "MIT/X11", 32 | "engine" : { "node" : ">=0.4" } 33 | } 34 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/deep-equal/test/cmp.js: -------------------------------------------------------------------------------- 1 | var test = require('tap').test; 2 | var equal = require('../'); 3 | 4 | test('equal', function (t) { 5 | t.ok(equal( 6 | { a : [ 2, 3 ], b : [ 4 ] }, 7 | { a : [ 2, 3 ], b : [ 4 ] } 8 | )); 9 | t.end(); 10 | }); 11 | 12 | test('not equal', function (t) { 13 | t.notOk(equal( 14 | { x : 5, y : [6] }, 15 | { x : 5, y : 6 } 16 | )); 17 | t.end(); 18 | }); 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.4 4 | - 0.6 5 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/README.markdown: -------------------------------------------------------------------------------- 1 | difflet 2 | ======= 3 | 4 | Create colorful diffs for javascript objects. 5 | 6 | example 7 | ======= 8 | 9 | string.js 10 | --------- 11 | 12 | ``` js 13 | var difflet = require('difflet'); 14 | 15 | var s = difflet.compare({ a : 2, c : 5 }, { a : 3, b : 4 }); 16 | process.stdout.write(s); 17 | ``` 18 | 19 | output: 20 | 21 | ![colorful output](http://substack.net/images/screenshots/difflet_string.png) 22 | 23 | colors.js 24 | --------- 25 | 26 | ``` js 27 | var diff = require('difflet')({ indent : 2 }); 28 | 29 | var prev = { 30 | yy : 6, 31 | zz : 5, 32 | a : [1,2,3], 33 | fn : 'beep', 34 | c : { x : 7, z : 3 } 35 | }; 36 | 37 | var next = { 38 | a : [ 1, 2, "z", /beep/, new Buffer(3) ], 39 | fn : function qqq () {}, 40 | b : [5,6,7], 41 | c : { x : 8, y : 5 } 42 | }; 43 | 44 | diff(prev, next).pipe(process.stdout); 45 | ``` 46 | 47 | output: 48 | 49 | ![colorful output](http://substack.net/images/screenshots/difflet_colors.png) 50 | 51 | green for inserts, blue for updates, red for deletes 52 | 53 | methods 54 | ======= 55 | 56 | var difflet = require('difflet') 57 | 58 | var diff = difflet(opts={}) 59 | --------------------------- 60 | 61 | Create a difflet from optional options `opts`. 62 | 63 | With `opts.start(type, stream)` and `opts.stop(type, stream)`, 64 | you can write custom handlers for all the types of differences: 65 | `'inserted'`, `'updated'`, and `'deleted'`. 66 | By default green is used for insertions, blue for updates, and red for 67 | deletions. 68 | 69 | If `opts.indent` is set, output will span multiple lines and `opts.indent` 70 | spaces will be used for leading whitespace. 71 | 72 | If `opts.comma === 'first'` then commas will be placed at the start of lines. 73 | 74 | Setting `opts.comment` to `true` will turn on comments with the previous 75 | contents like this: 76 | 77 | ![object comments](http://substack.net/images/screenshots/difflet_object_comments.png) 78 | 79 | diff(prev, next) 80 | ---------------- 81 | 82 | Return a stream with the colorful changes between objects `prev` and `next`. 83 | 84 | diff.compare(prev, next) 85 | ------------------------ 86 | 87 | Return a string with the colorful changes between `prev` and `next`. 88 | 89 | difflet.compare(prev, next) 90 | --------------------------- 91 | 92 | Return a string with the colorful changes between `prev` and `next` with the 93 | default options. 94 | 95 | install 96 | ======= 97 | 98 | With [npm](http://npmjs.org) do: 99 | 100 | ``` 101 | npm install difflet 102 | ``` 103 | 104 | test 105 | ==== 106 | 107 | With [npm](http://npmjs.org) do: 108 | 109 | ``` 110 | npm test 111 | ``` 112 | 113 | license 114 | ======= 115 | 116 | MIT/X11 117 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/example/cmp_array.js: -------------------------------------------------------------------------------- 1 | var difflet = require('../'); 2 | var s = difflet({ indent : 2, comment : true }).compare( 3 | [ 1, [2,3,{a:4}], 3 ], 4 | [ 1, [[5],6,7], 4 ] 5 | ); 6 | process.stdout.write(s); 7 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/example/cmp_object.js: -------------------------------------------------------------------------------- 1 | var difflet = require('../'); 2 | var s = difflet({ indent : 2, comment : true }).compare( 3 | { z : [6,7], a : 'abcdefgh', b : [ 31, 'xxt' ] }, 4 | { x : 5, a : 'abdcefg', b : [ 51, 'xxs' ] } 5 | ); 6 | process.stdout.write(s); 7 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/example/colors.js: -------------------------------------------------------------------------------- 1 | var diff = require('../')({ indent : 2 }); 2 | 3 | var prev = { 4 | yy : 6, 5 | zz : 5, 6 | a : [1,2,3], 7 | fn : 'beep', 8 | c : { x : 7, z : 3 } 9 | }; 10 | 11 | var next = { 12 | a : [ 1, 2, "z", /beep/, new Buffer(3) ], 13 | fn : function qqq () {}, 14 | b : [5,6,7], 15 | c : { x : 8, y : 5 } 16 | }; 17 | 18 | diff(prev, next).pipe(process.stdout); 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/example/comma_first.js: -------------------------------------------------------------------------------- 1 | var diff = require('../')({ 2 | indent : 2, 3 | comma : 'first', 4 | }); 5 | 6 | var prev = { yy : 6, zz : 5, a : [1,2,3] }; 7 | var next = { 8 | a : [ 1, 2, 3, [4], "z", /beep/, new Buffer(3) ], 9 | fn : 8, 10 | b : [5,6,7] 11 | }; 12 | diff(prev, next).pipe(process.stdout); 13 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/example/html.js: -------------------------------------------------------------------------------- 1 | var difflet = require('../'); 2 | var ent = require('ent'); 3 | 4 | var tags = { 5 | inserted : '', 6 | updated : '', 7 | deleted : '', 8 | }; 9 | var diff = difflet({ 10 | start : function (t, s) { 11 | s.write(tags[t]); 12 | }, 13 | stop : function (t, s) { 14 | s.write(''); 15 | }, 16 | write : function (buf) { 17 | stream.write(ent.encode(buf)) 18 | }, 19 | }); 20 | 21 | var prev = { 22 | yy : 6, 23 | zz : 5, 24 | a : [1,2,3], 25 | fn : function qq () {} 26 | }; 27 | var next = { 28 | a : [ 1, 2, 3, [4], "z", /beep/, new Buffer([0,1,2]) ], 29 | fn : 'I <3 robots', 30 | b : [5,6,7] 31 | }; 32 | 33 | var stream = diff(prev, next); 34 | stream.pipe(process.stdout, { end : false }); 35 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/example/string.js: -------------------------------------------------------------------------------- 1 | var difflet = require('../'); 2 | 3 | var s = difflet.compare({ a : 2, c : 5 }, { a : 3, b : 4 }); 4 | process.stdout.write(s); 5 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/fail.js: -------------------------------------------------------------------------------- 1 | var test = require('tap').test; 2 | 3 | test('beep', function (t) { 4 | t.deepEqual( 5 | { x : 'abcdefghijklmnopqrstuvwxyz' }, 6 | { x : 'abcdefghijzzznopqrstuvwxyz' } 7 | ); 8 | t.end(); 9 | }); 10 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/column.js: -------------------------------------------------------------------------------- 1 | var charm = require('charm')(process); 2 | 3 | charm 4 | .column(16) 5 | .write('beep') 6 | .down() 7 | .column(32) 8 | .write('boop\n') 9 | .destroy() 10 | ; 11 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/cursor.js: -------------------------------------------------------------------------------- 1 | var charm = require('charm')(process); 2 | 3 | charm.position(5, 10); 4 | 5 | charm.position(function (x, y) { 6 | console.dir([ x, y ]); 7 | 8 | charm.move(7,2); 9 | charm.push(); 10 | process.stdout.write('lul'); 11 | 12 | charm.left(3).up(1).foreground('magenta'); 13 | process.stdout.write('v'); 14 | charm.left(1).up(1).display('reset'); 15 | process.stdout.write('|'); 16 | 17 | charm.down(3); 18 | charm.pop().background('blue'); 19 | process.stdout.write('popped\npow'); 20 | charm.display('reset').erase('line'); 21 | charm.destroy(); 22 | }); 23 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/http_spin.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var charmer = require('charm'); 3 | 4 | http.createServer(function (req, res) { 5 | res.setHeader('content-type', 'text/ansi'); 6 | 7 | var charm = charmer(res); 8 | charm.reset(); 9 | 10 | var radius = 10; 11 | var theta = 0; 12 | var points = []; 13 | 14 | var iv = setInterval(function () { 15 | var x = 2 + (radius + Math.cos(theta) * radius) * 2; 16 | var y = 2 + radius + Math.sin(theta) * radius; 17 | 18 | points.unshift([ x, y ]); 19 | var colors = [ 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta' ]; 20 | 21 | points.forEach(function (p, i) { 22 | charm.position(p[0], p[1]); 23 | var c = colors[Math.floor(i / 12)]; 24 | charm.background(c).write(' ') 25 | }); 26 | points = points.slice(0, 12 * colors.length - 1); 27 | 28 | theta += Math.PI / 40; 29 | }, 50); 30 | 31 | req.connection.on('end', function () { 32 | clearInterval(iv); 33 | charm.destroy(); 34 | }); 35 | }).listen(8081); 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/lucky.js: -------------------------------------------------------------------------------- 1 | var charm = require('charm')(process); 2 | charm.reset(); 3 | 4 | var colors = [ 'red', 'cyan', 'yellow', 'green', 'blue' ]; 5 | var text = 'Always after me lucky charms.'; 6 | 7 | var offset = 0; 8 | var iv = setInterval(function () { 9 | var y = 0, dy = 1; 10 | for (var i = 0; i < 40; i++) { 11 | var color = colors[(i + offset) % colors.length]; 12 | var c = text[(i + offset) % text.length]; 13 | charm 14 | .move(1, dy) 15 | .foreground(color) 16 | .write(c) 17 | ; 18 | y += dy; 19 | if (y <= 0 || y >= 5) dy *= -1; 20 | } 21 | charm.position(0, 1); 22 | offset ++; 23 | }, 150); 24 | 25 | charm.on('data', function (buf) { 26 | if (buf[0] === 3) { 27 | clearInterval(iv); 28 | charm.destroy(); 29 | } 30 | }); 31 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/position.js: -------------------------------------------------------------------------------- 1 | var charm = require('charm')(process); 2 | 3 | charm.on('^C', process.exit); 4 | 5 | charm.position(function (x, y) { 6 | console.log('(%d, %d)', x, y); 7 | }); 8 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/progress.js: -------------------------------------------------------------------------------- 1 | var charm = require('charm')(process); 2 | 3 | charm.write("Progress: 0 %"); 4 | var i = 0; 5 | 6 | var increment = function () { 7 | charm.left(i.toString().length + 2); 8 | i = i + 1; 9 | charm.write(i + " %"); 10 | if (i === 100) { 11 | charm.write("\nDone!\n"); 12 | process.exit(); 13 | } 14 | }; 15 | 16 | var loop = setInterval(increment, 50); 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/example/spin.js: -------------------------------------------------------------------------------- 1 | var charm = require('charm')(process); 2 | charm.reset(); 3 | 4 | var radius = 10; 5 | var theta = 0; 6 | var points = []; 7 | 8 | var iv = setInterval(function () { 9 | var x = 2 + (radius + Math.cos(theta) * radius) * 2; 10 | var y = 2 + radius + Math.sin(theta) * radius; 11 | 12 | points.unshift([ x, y ]); 13 | var colors = [ 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta' ]; 14 | 15 | points.forEach(function (p, i) { 16 | charm.position(p[0], p[1]); 17 | var c = colors[Math.floor(i / 12)]; 18 | charm.background(c).write(' ') 19 | }); 20 | points = points.slice(0, 12 * colors.length - 1); 21 | 22 | theta += Math.PI / 40; 23 | }, 50); 24 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/lib/encode.js: -------------------------------------------------------------------------------- 1 | var encode = module.exports = function (xs) { 2 | function bytes (s) { 3 | if (typeof s === 'string') { 4 | return s.split('').map(ord); 5 | } 6 | else if (Array.isArray(s)) { 7 | return s.reduce(function (acc, c) { 8 | return acc.concat(bytes(c)); 9 | }, []); 10 | } 11 | } 12 | 13 | return new Buffer([ 0x1b ].concat(bytes(xs))); 14 | }; 15 | 16 | var ord = encode.ord = function ord (c) { 17 | return c.charCodeAt(0) 18 | }; 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/charm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "charm", 3 | "version" : "0.0.6", 4 | "description" : "ansi control sequences for terminal cursor hopping and colors", 5 | "main" : "index.js", 6 | "directories" : { 7 | "lib" : ".", 8 | "example" : "example", 9 | "test" : "test" 10 | }, 11 | "repository" : { 12 | "type" : "git", 13 | "url" : "http://github.com/substack/node-charm.git" 14 | }, 15 | "keywords" : [ 16 | "terminal", 17 | "ansi", 18 | "cursor", 19 | "color", 20 | "console", 21 | "control", 22 | "escape", 23 | "sequence" 24 | ], 25 | "author" : { 26 | "name" : "James Halliday", 27 | "email" : "mail@substack.net", 28 | "url" : "http://substack.net" 29 | }, 30 | "license" : "MIT/X11", 31 | "engine" : { "node" : ">=0.4" } 32 | } 33 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 James Halliday (mail@substack.net) 2 | 3 | This project is free software released under the MIT/X11 license: 4 | http://www.opensource.org/licenses/mit-license.php 5 | 6 | Copyright 2010 James Halliday (mail@substack.net) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/examples/json.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | 3 | var id = 54; 4 | var callbacks = {}; 5 | var obj = { moo : function () {}, foo : [2,3,4, function () {}] }; 6 | 7 | var scrubbed = traverse(obj).map(function (x) { 8 | if (typeof x === 'function') { 9 | callbacks[id] = { id : id, f : x, path : this.path }; 10 | this.update('[Function]'); 11 | id++; 12 | } 13 | }); 14 | 15 | console.dir(scrubbed); 16 | console.dir(callbacks); 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/examples/leaves.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | 3 | var obj = { 4 | a : [1,2,3], 5 | b : 4, 6 | c : [5,6], 7 | d : { e : [7,8], f : 9 }, 8 | }; 9 | 10 | var leaves = traverse(obj).reduce(function (acc, x) { 11 | if (this.isLeaf) acc.push(x); 12 | return acc; 13 | }, []); 14 | 15 | console.dir(leaves); 16 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/examples/negative.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 3 | 4 | traverse(obj).forEach(function (x) { 5 | if (x < 0) this.update(x + 128); 6 | }); 7 | 8 | console.dir(obj); 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/examples/scrub.js: -------------------------------------------------------------------------------- 1 | // scrub out circular references 2 | var traverse = require('traverse'); 3 | 4 | var obj = { a : 1, b : 2, c : [ 3, 4 ] }; 5 | obj.c.push(obj); 6 | 7 | var scrubbed = traverse(obj).map(function (x) { 8 | if (this.circular) this.remove() 9 | }); 10 | console.dir(scrubbed); 11 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/examples/stringify.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var traverse = require('traverse'); 3 | 4 | var obj = [ 'five', 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 5 | 6 | var s = ''; 7 | traverse(obj).forEach(function to_s (node) { 8 | if (Array.isArray(node)) { 9 | this.before(function () { s += '[' }); 10 | this.post(function (child) { 11 | if (!child.isLast) s += ','; 12 | }); 13 | this.after(function () { s += ']' }); 14 | } 15 | else if (typeof node == 'object') { 16 | this.before(function () { s += '{' }); 17 | this.pre(function (x, key) { 18 | to_s(key); 19 | s += ':'; 20 | }); 21 | this.post(function (child) { 22 | if (!child.isLast) s += ','; 23 | }); 24 | this.after(function () { s += '}' }); 25 | } 26 | else if (typeof node == 'string') { 27 | s += '"' + node.toString().replace(/"/g, '\\"') + '"'; 28 | } 29 | else if (typeof node == 'function') { 30 | s += 'null'; 31 | } 32 | else { 33 | s += node.toString(); 34 | } 35 | }); 36 | 37 | console.log('JSON.stringify: ' + JSON.stringify(obj)); 38 | console.log('this stringify: ' + s); 39 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "traverse", 3 | "version" : "0.6.0", 4 | "description" : "Traverse and transform objects by visiting every node on a recursive walk", 5 | "author" : "James Halliday", 6 | "license" : "MIT/X11", 7 | "main" : "./index", 8 | "repository" : { 9 | "type" : "git", 10 | "url" : "http://github.com/substack/js-traverse.git" 11 | }, 12 | "devDependencies" : { 13 | "expresso" : "0.7.x" 14 | }, 15 | "scripts" : { 16 | "test" : "expresso" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/date.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports.dateEach = function () { 5 | var obj = { x : new Date, y : 10, z : 5 }; 6 | 7 | var counts = {}; 8 | 9 | Traverse(obj).forEach(function (node) { 10 | var t = (node instanceof Date && 'Date') || typeof node; 11 | counts[t] = (counts[t] || 0) + 1; 12 | }); 13 | 14 | assert.deepEqual(counts, { 15 | object : 1, 16 | Date : 1, 17 | number : 2, 18 | }); 19 | }; 20 | 21 | exports.dateMap = function () { 22 | var obj = { x : new Date, y : 10, z : 5 }; 23 | 24 | var res = Traverse(obj).map(function (node) { 25 | if (typeof node === 'number') this.update(node + 100); 26 | }); 27 | 28 | assert.ok(obj.x !== res.x); 29 | assert.deepEqual(res, { 30 | x : obj.x, 31 | y : 110, 32 | z : 105, 33 | }); 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/has.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | 4 | exports.has = function () { 5 | var obj = { a : 2, b : [ 4, 5, { c : 6 } ] }; 6 | 7 | assert.equal(traverse(obj).has([ 'b', 2, 'c' ]), true) 8 | assert.equal(traverse(obj).has([ 'b', 2, 'c', 0 ]), false) 9 | assert.equal(traverse(obj).has([ 'b', 2, 'd' ]), false) 10 | assert.equal(traverse(obj).has([]), true) 11 | assert.equal(traverse(obj).has([ 'a' ]), true) 12 | assert.equal(traverse(obj).has([ 'a', 2 ]), false) 13 | }; 14 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/instance.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | var EventEmitter = require('events').EventEmitter; 4 | 5 | exports['check instanceof on node elems'] = function () { 6 | 7 | var counts = { emitter : 0 }; 8 | 9 | Traverse([ new EventEmitter, 3, 4, { ev : new EventEmitter }]) 10 | .forEach(function (node) { 11 | if (node instanceof EventEmitter) counts.emitter ++; 12 | }) 13 | ; 14 | 15 | assert.equal(counts.emitter, 2); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/interface.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['interface map'] = function () { 5 | var obj = { a : [ 5,6,7 ], b : { c : [8] } }; 6 | 7 | assert.deepEqual( 8 | Traverse.paths(obj) 9 | .sort() 10 | .map(function (path) { return path.join('/') }) 11 | .slice(1) 12 | .join(' ') 13 | , 14 | 'a a/0 a/1 a/2 b b/c b/c/0' 15 | ); 16 | 17 | assert.deepEqual( 18 | Traverse.nodes(obj), 19 | [ 20 | { a: [ 5, 6, 7 ], b: { c: [ 8 ] } }, 21 | [ 5, 6, 7 ], 5, 6, 7, 22 | { c: [ 8 ] }, [ 8 ], 8 23 | ] 24 | ); 25 | 26 | assert.deepEqual( 27 | Traverse.map(obj, function (node) { 28 | if (typeof node == 'number') { 29 | return node + 1000; 30 | } 31 | else if (Array.isArray(node)) { 32 | return node.join(' '); 33 | } 34 | }), 35 | { a: '5 6 7', b: { c: '8' } } 36 | ); 37 | 38 | var nodes = 0; 39 | Traverse.forEach(obj, function (node) { nodes ++ }); 40 | assert.deepEqual(nodes, 8); 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/json.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['json test'] = function () { 5 | var id = 54; 6 | var callbacks = {}; 7 | var obj = { moo : function () {}, foo : [2,3,4, function () {}] }; 8 | 9 | var scrubbed = Traverse(obj).map(function (x) { 10 | if (typeof x === 'function') { 11 | callbacks[id] = { id : id, f : x, path : this.path }; 12 | this.update('[Function]'); 13 | id++; 14 | } 15 | }); 16 | 17 | assert.equal( 18 | scrubbed.moo, '[Function]', 19 | 'obj.moo replaced with "[Function]"' 20 | ); 21 | 22 | assert.equal( 23 | scrubbed.foo[3], '[Function]', 24 | 'obj.foo[3] replaced with "[Function]"' 25 | ); 26 | 27 | assert.deepEqual(scrubbed, { 28 | moo : '[Function]', 29 | foo : [ 2, 3, 4, "[Function]" ] 30 | }, 'Full JSON string matches'); 31 | 32 | assert.deepEqual( 33 | typeof obj.moo, 'function', 34 | 'Original obj.moo still a function' 35 | ); 36 | 37 | assert.deepEqual( 38 | typeof obj.foo[3], 'function', 39 | 'Original obj.foo[3] still a function' 40 | ); 41 | 42 | assert.deepEqual(callbacks, { 43 | 54: { id: 54, f : obj.moo, path: [ 'moo' ] }, 44 | 55: { id: 55, f : obj.foo[3], path: [ 'foo', '3' ] }, 45 | }, 'Check the generated callbacks list'); 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/keys.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['sort test'] = function () { 5 | var acc = []; 6 | Traverse({ 7 | a: 30, 8 | b: 22, 9 | id: 9 10 | }).forEach(function (node) { 11 | if ((! Array.isArray(node)) && typeof node === 'object') { 12 | this.before(function(node) { 13 | this.keys = Object.keys(node); 14 | this.keys.sort(function(a, b) { 15 | a = [a === "id" ? 0 : 1, a]; 16 | b = [b === "id" ? 0 : 1, b]; 17 | return a < b ? -1 : a > b ? 1 : 0; 18 | }); 19 | }); 20 | } 21 | if (this.isLeaf) acc.push(node); 22 | }); 23 | 24 | assert.equal( 25 | acc.join(' '), 26 | '9 30 22', 27 | 'Traversal in a custom order' 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/leaves.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['leaves test'] = function () { 5 | var acc = []; 6 | Traverse({ 7 | a : [1,2,3], 8 | b : 4, 9 | c : [5,6], 10 | d : { e : [7,8], f : 9 } 11 | }).forEach(function (x) { 12 | if (this.isLeaf) acc.push(x); 13 | }); 14 | 15 | assert.equal( 16 | acc.join(' '), 17 | '1 2 3 4 5 6 7 8 9', 18 | 'Traversal in the right(?) order' 19 | ); 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/lib/deep_equal.js: -------------------------------------------------------------------------------- 1 | var traverse = require('../../'); 2 | 3 | module.exports = function (a, b) { 4 | if (arguments.length !== 2) { 5 | throw new Error( 6 | 'deepEqual requires exactly two objects to compare against' 7 | ); 8 | } 9 | 10 | var equal = true; 11 | var node = b; 12 | 13 | traverse(a).forEach(function (y) { 14 | var notEqual = (function () { 15 | equal = false; 16 | //this.stop(); 17 | return undefined; 18 | }).bind(this); 19 | 20 | //if (node === undefined || node === null) return notEqual(); 21 | 22 | if (!this.isRoot) { 23 | /* 24 | if (!Object.hasOwnProperty.call(node, this.key)) { 25 | return notEqual(); 26 | } 27 | */ 28 | if (typeof node !== 'object') return notEqual(); 29 | node = node[this.key]; 30 | } 31 | 32 | var x = node; 33 | 34 | this.post(function () { 35 | node = x; 36 | }); 37 | 38 | var toS = function (o) { 39 | return Object.prototype.toString.call(o); 40 | }; 41 | 42 | if (this.circular) { 43 | if (traverse(b).get(this.circular.path) !== x) notEqual(); 44 | } 45 | else if (typeof x !== typeof y) { 46 | notEqual(); 47 | } 48 | else if (x === null || y === null || x === undefined || y === undefined) { 49 | if (x !== y) notEqual(); 50 | } 51 | else if (x.__proto__ !== y.__proto__) { 52 | notEqual(); 53 | } 54 | else if (x === y) { 55 | // nop 56 | } 57 | else if (typeof x === 'function') { 58 | if (x instanceof RegExp) { 59 | // both regexps on account of the __proto__ check 60 | if (x.toString() != y.toString()) notEqual(); 61 | } 62 | else if (x !== y) notEqual(); 63 | } 64 | else if (typeof x === 'object') { 65 | if (toS(y) === '[object Arguments]' 66 | || toS(x) === '[object Arguments]') { 67 | if (toS(x) !== toS(y)) { 68 | notEqual(); 69 | } 70 | } 71 | else if (x instanceof Date || y instanceof Date) { 72 | if (!(x instanceof Date) || !(y instanceof Date) 73 | || x.getTime() !== y.getTime()) { 74 | notEqual(); 75 | } 76 | } 77 | else { 78 | var kx = Object.keys(x); 79 | var ky = Object.keys(y); 80 | if (kx.length !== ky.length) return notEqual(); 81 | for (var i = 0; i < kx.length; i++) { 82 | var k = kx[i]; 83 | if (!Object.hasOwnProperty.call(y, k)) { 84 | notEqual(); 85 | } 86 | } 87 | } 88 | } 89 | }); 90 | 91 | return equal; 92 | }; 93 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/negative.js: -------------------------------------------------------------------------------- 1 | var Traverse = require('../'); 2 | var assert = require('assert'); 3 | 4 | exports['negative update test'] = function () { 5 | var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 6 | var fixed = Traverse.map(obj, function (x) { 7 | if (x < 0) this.update(x + 128); 8 | }); 9 | 10 | assert.deepEqual(fixed, 11 | [ 5, 6, 125, [ 7, 8, 126, 1 ], { f: 10, g: 115 } ], 12 | 'Negative values += 128' 13 | ); 14 | 15 | assert.deepEqual(obj, 16 | [ 5, 6, -3, [ 7, 8, -2, 1 ], { f: 10, g: -13 } ], 17 | 'Original references not modified' 18 | ); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/obj.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['traverse an object with nested functions'] = function () { 5 | var to = setTimeout(function () { 6 | assert.fail('never ran'); 7 | }, 1000); 8 | 9 | function Cons (x) { 10 | clearTimeout(to); 11 | assert.equal(x, 10); 12 | }; 13 | Traverse(new Cons(10)); 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/siblings.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | 4 | exports.siblings = function () { 5 | var obj = { a : 1, b : 2, c : [ 4, 5, 6 ] }; 6 | 7 | var res = traverse(obj).reduce(function (acc, x) { 8 | var p = '/' + this.path.join('/'); 9 | if (this.parent) { 10 | acc[p] = { 11 | siblings : this.parent.keys, 12 | key : this.key, 13 | index : this.parent.keys.indexOf(this.key) 14 | }; 15 | } 16 | else { 17 | acc[p] = { 18 | siblings : [], 19 | key : this.key, 20 | index : -1 21 | } 22 | } 23 | return acc; 24 | }, {}); 25 | 26 | assert.deepEqual(res, { 27 | '/' : { siblings : [], key : undefined, index : -1 }, 28 | '/a' : { siblings : [ 'a', 'b', 'c' ], key : 'a', index : 0 }, 29 | '/b' : { siblings : [ 'a', 'b', 'c' ], key : 'b', index : 1 }, 30 | '/c' : { siblings : [ 'a', 'b', 'c' ], key : 'c', index : 2 }, 31 | '/c/0' : { siblings : [ '0', '1', '2' ], key : '0', index : 0 }, 32 | '/c/1' : { siblings : [ '0', '1', '2' ], key : '1', index : 1 }, 33 | '/c/2' : { siblings : [ '0', '1', '2' ], key : '2', index : 2 } 34 | }); 35 | }; 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/stop.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | 4 | exports.stop = function () { 5 | var visits = 0; 6 | traverse('abcdefghij'.split('')).forEach(function (node) { 7 | if (typeof node === 'string') { 8 | visits ++; 9 | if (node === 'e') this.stop() 10 | } 11 | }); 12 | 13 | assert.equal(visits, 5); 14 | }; 15 | 16 | exports.stopMap = function () { 17 | var s = traverse('abcdefghij'.split('')).map(function (node) { 18 | if (typeof node === 'string') { 19 | if (node === 'e') this.stop() 20 | return node.toUpperCase(); 21 | } 22 | }).join(''); 23 | 24 | assert.equal(s, 'ABCDEfghij'); 25 | }; 26 | 27 | exports.stopReduce = function () { 28 | var obj = { 29 | a : [ 4, 5 ], 30 | b : [ 6, [ 7, 8, 9 ] ] 31 | }; 32 | var xs = traverse(obj).reduce(function (acc, node) { 33 | if (this.isLeaf) { 34 | if (node === 7) this.stop(); 35 | else acc.push(node) 36 | } 37 | return acc; 38 | }, []); 39 | 40 | assert.deepEqual(xs, [ 4, 5, 6 ]); 41 | }; 42 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/stringify.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports.stringify = function () { 5 | var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 6 | 7 | var s = ''; 8 | Traverse(obj).forEach(function (node) { 9 | if (Array.isArray(node)) { 10 | this.before(function () { s += '[' }); 11 | this.post(function (child) { 12 | if (!child.isLast) s += ','; 13 | }); 14 | this.after(function () { s += ']' }); 15 | } 16 | else if (typeof node == 'object') { 17 | this.before(function () { s += '{' }); 18 | this.pre(function (x, key) { 19 | s += '"' + key + '"' + ':'; 20 | }); 21 | this.post(function (child) { 22 | if (!child.isLast) s += ','; 23 | }); 24 | this.after(function () { s += '}' }); 25 | } 26 | else if (typeof node == 'function') { 27 | s += 'null'; 28 | } 29 | else { 30 | s += node.toString(); 31 | } 32 | }); 33 | 34 | assert.equal(s, JSON.stringify(obj)); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/subexpr.js: -------------------------------------------------------------------------------- 1 | var traverse = require('../'); 2 | var assert = require('assert'); 3 | 4 | exports.subexpr = function () { 5 | var obj = [ 'a', 4, 'b', 5, 'c', 6 ]; 6 | var r = traverse(obj).map(function (x) { 7 | if (typeof x === 'number') { 8 | this.update([ x - 0.1, x, x + 0.1 ], true); 9 | } 10 | }); 11 | 12 | assert.deepEqual(obj, [ 'a', 4, 'b', 5, 'c', 6 ]); 13 | assert.deepEqual(r, [ 14 | 'a', [ 3.9, 4, 4.1 ], 15 | 'b', [ 4.9, 5, 5.1 ], 16 | 'c', [ 5.9, 6, 6.1 ], 17 | ]); 18 | }; 19 | 20 | exports.block = function () { 21 | var obj = [ [ 1 ], [ 2 ], [ 3 ] ]; 22 | var r = traverse(obj).map(function (x) { 23 | if (Array.isArray(x) && !this.isRoot) { 24 | if (x[0] === 5) this.block() 25 | else this.update([ [ x[0] + 1 ] ]) 26 | } 27 | }); 28 | 29 | assert.deepEqual(r, [ 30 | [ [ [ [ [ 5 ] ] ] ] ], 31 | [ [ [ [ 5 ] ] ] ], 32 | [ [ [ 5 ] ] ], 33 | ]); 34 | }; 35 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/test/super_deep.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | var deepEqual = require('./lib/deep_equal'); 4 | 5 | exports.super_deep = function () { 6 | var util = require('util'); 7 | var a0 = make(); 8 | var a1 = make(); 9 | assert.ok(deepEqual(a0, a1)); 10 | 11 | a0.c.d.moo = true; 12 | assert.ok(!deepEqual(a0, a1)); 13 | 14 | a1.c.d.moo = true; 15 | assert.ok(deepEqual(a0, a1)); 16 | 17 | // TODO: this one 18 | //a0.c.a = a1; 19 | //assert.ok(!deepEqual(a0, a1)); 20 | }; 21 | 22 | function make () { 23 | var a = { self : 'a' }; 24 | var b = { self : 'b' }; 25 | var c = { self : 'c' }; 26 | var d = { self : 'd' }; 27 | var e = { self : 'e' }; 28 | 29 | a.a = a; 30 | a.b = b; 31 | a.c = c; 32 | 33 | b.a = a; 34 | b.b = b; 35 | b.c = c; 36 | 37 | c.a = a; 38 | c.b = b; 39 | c.c = c; 40 | c.d = d; 41 | 42 | d.a = a; 43 | d.b = b; 44 | d.c = c; 45 | d.d = d; 46 | d.e = e; 47 | 48 | e.a = a; 49 | e.b = b; 50 | e.c = c; 51 | e.d = d; 52 | e.e = e; 53 | 54 | return a; 55 | } 56 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/node_modules/traverse/testling/leaves.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | var test = require('testling'); 3 | 4 | test('leaves', function (t) { 5 | var obj = { 6 | a : [1,2,3], 7 | b : 4, 8 | c : [5,6], 9 | d : { e : [7,8], f : 9 } 10 | }; 11 | 12 | var acc = []; 13 | traverse(obj).forEach(function (x) { 14 | if (this.isLeaf) acc.push(x); 15 | }); 16 | 17 | t.deepEqual( 18 | acc, [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], 19 | 'traversal in the proper order' 20 | ); 21 | t.end(); 22 | }); 23 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "difflet", 3 | "description" : "colorful diffs for javascript objects", 4 | "version" : "0.2.0", 5 | "repository" : { 6 | "type" : "git", 7 | "url" : "git://github.com/substack/difflet.git" 8 | }, 9 | "main" : "index.js", 10 | "keywords" : [ 11 | "diff", 12 | "object", 13 | "compare" 14 | ], 15 | "directories" : { 16 | "lib" : ".", 17 | "example" : "example", 18 | "test" : "test" 19 | }, 20 | "scripts" : { 21 | "test" : "tap test/*.js" 22 | }, 23 | "dependencies" : { 24 | "traverse" : "0.6.x", 25 | "charm" : "0.0.x", 26 | "deep-equal" : "0.0.x" 27 | }, 28 | "devDependencies" : { 29 | "tap" : "0.1.x", 30 | "ent" : "0.0.x" 31 | }, 32 | "engines" : { 33 | "node" : ">=0.4.0" 34 | }, 35 | "license" : "MIT", 36 | "author" : { 37 | "name" : "James Halliday", 38 | "email" : "mail@substack.net", 39 | "url" : "http://substack.net" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/difflet/test/html.js: -------------------------------------------------------------------------------- 1 | var difflet = require('../'); 2 | var test = require('tap').test; 3 | var ent = require('ent'); 4 | 5 | var tags = { 6 | inserted : 'g', 7 | updated : 'b', 8 | deleted : 'r', 9 | }; 10 | 11 | test('html output', function (t) { 12 | t.plan(1); 13 | var diff = difflet({ 14 | start : function (t, s) { 15 | s.write('<' + tags[t] + '>'); 16 | }, 17 | stop : function (t, s) { 18 | s.write(''); 19 | }, 20 | write : function (buf, s) { 21 | s.write(ent.encode(buf)); 22 | } 23 | }); 24 | 25 | var stream = diff( 26 | { yy : 6, zz : 5, a : [1,2,3], fn : function qqq () {} }, 27 | { 28 | a : [ 1, 2, 3, [4], "z", /beep/, new Buffer([0,1,2]) ], 29 | fn : function rrr () {}, 30 | b : [5,6,7] 31 | } 32 | ); 33 | 34 | var data = '' 35 | stream.on('data', function (buf) { data += buf }); 36 | stream.on('end', function () { 37 | t.equal(data, 38 | '{"a":[1,2,3,[4],"z",' 39 | + '/beep/,<Buffer 00 01 02>],' 40 | + '"fn":[Function: rrr],' 41 | + '"b":[5,6,7],"yy":6,' 42 | + '"zz":5}' 43 | ); 44 | t.end(); 45 | }); 46 | }); 47 | 48 | test('compare html output', function (t) { 49 | t.plan(1); 50 | 51 | var diff = difflet({ 52 | start : function (t, s) { 53 | s.write('<' + tags[t] + '>'); 54 | }, 55 | stop : function (t, s) { 56 | s.write(''); 57 | }, 58 | write : function (buf, s) { 59 | s.write(ent.encode(buf)); 60 | } 61 | }); 62 | 63 | var data = diff.compare( 64 | { yy : 6, zz : 5, a : [1,2,3], fn : function qqq () {} }, 65 | { 66 | a : [ 1, 2, 3, [4], "z", /beep/, new Buffer([0,1,2]) ], 67 | fn : function rrr () {}, 68 | b : [5,6,7] 69 | } 70 | ); 71 | 72 | t.equal(data, 73 | '{"a":[1,2,3,[4],"z",' 74 | + '/beep/,<Buffer 00 01 02>],' 75 | + '"fn":[Function: rrr],' 76 | + '"b":[5,6,7],"yy":6,' 77 | + '"zz":5}' 78 | ); 79 | t.end(); 80 | }); 81 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/inherits/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011 Isaac Z. Schlueter (the "Author") 2 | All rights reserved. 3 | 4 | General Public Obviousness License 5 | 6 | The Author asserts that this software and associated documentation 7 | files (the "Software"), while the Author's original creation, is 8 | nonetheless obvious, trivial, unpatentable, and implied by the 9 | context in which the software was created. If you sat down and 10 | thought about the problem for an hour or less, you'd probably 11 | come up with exactly this solution. 12 | 13 | Permission is granted to use this software in any way 14 | whatsoever, with the following restriction: 15 | 16 | You may not release the Software under a more restrictive license 17 | than this one. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | OTHER DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/inherits/README.md: -------------------------------------------------------------------------------- 1 | A dead simple way to do inheritance in JS. 2 | 3 | var inherits = require("inherits") 4 | 5 | function Animal () { 6 | this.alive = true 7 | } 8 | Animal.prototype.say = function (what) { 9 | console.log(what) 10 | } 11 | 12 | inherits(Dog, Animal) 13 | function Dog () { 14 | Dog.super.apply(this) 15 | } 16 | Dog.prototype.sniff = function () { 17 | this.say("sniff sniff") 18 | } 19 | Dog.prototype.bark = function () { 20 | this.say("woof woof") 21 | } 22 | 23 | inherits(Chihuahua, Dog) 24 | function Chihuahua () { 25 | Chihuahua.super.apply(this) 26 | } 27 | Chihuahua.prototype.bark = function () { 28 | this.say("yip yip") 29 | } 30 | 31 | // also works 32 | function Cat () { 33 | Cat.super.apply(this) 34 | } 35 | Cat.prototype.hiss = function () { 36 | this.say("CHSKKSS!!") 37 | } 38 | inherits(Cat, Animal, { 39 | meow: function () { this.say("miao miao") } 40 | }) 41 | Cat.prototype.purr = function () { 42 | this.say("purr purr") 43 | } 44 | 45 | 46 | var c = new Chihuahua 47 | assert(c instanceof Chihuahua) 48 | assert(c instanceof Dog) 49 | assert(c instanceof Animal) 50 | 51 | The actual function is laughably small. 10-lines small. 52 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/inherits/inherits-old.js: -------------------------------------------------------------------------------- 1 | // This is a less perfect implementation of the inherits function, 2 | // designed to work in cases where ES5 is not available. 3 | // 4 | // Note that it is a bit longer, and doesn't properly deal with 5 | // getter/setters or property descriptor flags (enumerable, etc.) 6 | 7 | module.exports = inheritsOld 8 | 9 | function inheritsOld (c, p, proto) { 10 | function F () { this.constructor = c } 11 | F.prototype = p.prototype 12 | var e = {} 13 | for (var i in c.prototype) if (c.prototype.hasOwnProperty(i)) { 14 | e[i] = c.prototype[i] 15 | } 16 | if (proto) for (var i in proto) if (proto.hasOwnProperty(i)) { 17 | e[i] = proto[i] 18 | } 19 | c.prototype = new F() 20 | for (var i in e) if (e.hasOwnProperty(i)) { 21 | c.prototype[i] = e[i] 22 | } 23 | c.super = p 24 | } 25 | 26 | // function Child () { 27 | // Child.super.call(this) 28 | // console.error([this 29 | // ,this.constructor 30 | // ,this.constructor === Child 31 | // ,this.constructor.super === Parent 32 | // ,Object.getPrototypeOf(this) === Child.prototype 33 | // ,Object.getPrototypeOf(Object.getPrototypeOf(this)) 34 | // === Parent.prototype 35 | // ,this instanceof Child 36 | // ,this instanceof Parent]) 37 | // } 38 | // function Parent () {} 39 | // inheritsOld(Child, Parent) 40 | // new Child 41 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/inherits/inherits.js: -------------------------------------------------------------------------------- 1 | module.exports = inherits 2 | 3 | function inherits (c, p, proto) { 4 | proto = proto || {} 5 | var e = {} 6 | ;[c.prototype, proto].forEach(function (s) { 7 | Object.getOwnPropertyNames(s).forEach(function (k) { 8 | e[k] = Object.getOwnPropertyDescriptor(s, k) 9 | }) 10 | }) 11 | c.prototype = Object.create(p.prototype, e) 12 | c.super = p 13 | } 14 | 15 | //function Child () { 16 | // Child.super.call(this) 17 | // console.error([this 18 | // ,this.constructor 19 | // ,this.constructor === Child 20 | // ,this.constructor.super === Parent 21 | // ,Object.getPrototypeOf(this) === Child.prototype 22 | // ,Object.getPrototypeOf(Object.getPrototypeOf(this)) 23 | // === Parent.prototype 24 | // ,this instanceof Child 25 | // ,this instanceof Parent]) 26 | //} 27 | //function Parent () {} 28 | //inherits(Child, Parent) 29 | //new Child 30 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/inherits/package.json: -------------------------------------------------------------------------------- 1 | { "name" : "inherits" 2 | , "description": "A tiny simple way to do classic inheritance in js" 3 | , "version" : "1.0.0" 4 | , "keywords" : ["inheritance", "class", "klass", "oop", "object-oriented"] 5 | , "main" : "./inherits.js" 6 | , "repository" : "https://github.com/isaacs/inherits" 7 | , "license": { "type": "GPOL", "url": "https://raw.github.com/isaacs/inherits/master/LICENSE" } 8 | , "author" : "Isaac Z. Schlueter (http://blog.izs.me/)" } 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/.gitignore.orig: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/.gitignore.rej: -------------------------------------------------------------------------------- 1 | --- /dev/null 2 | +++ .gitignore 3 | @@ -0,0 +1,2 @@ 4 | +node_modules/ 5 | +npm-debug.log -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 James Halliday (mail@substack.net) 2 | 3 | This project is free software released under the MIT/X11 license: 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/README.markdown: -------------------------------------------------------------------------------- 1 | mkdirp 2 | ====== 3 | 4 | Like `mkdir -p`, but in node.js! 5 | 6 | example 7 | ======= 8 | 9 | pow.js 10 | ------ 11 | var mkdirp = require('mkdirp'); 12 | 13 | mkdirp('/tmp/foo/bar/baz', function (err) { 14 | if (err) console.error(err) 15 | else console.log('pow!') 16 | }); 17 | 18 | Output 19 | pow! 20 | 21 | And now /tmp/foo/bar/baz exists, huzzah! 22 | 23 | methods 24 | ======= 25 | 26 | var mkdirp = require('mkdirp'); 27 | 28 | mkdirp(dir, mode, cb) 29 | --------------------- 30 | 31 | Create a new directory and any necessary subdirectories at `dir` with octal 32 | permission string `mode`. 33 | 34 | If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. 35 | 36 | mkdirp.sync(dir, mode) 37 | ---------------------- 38 | 39 | Synchronously create a new directory and any necessary subdirectories at `dir` 40 | with octal permission string `mode`. 41 | 42 | If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. 43 | 44 | install 45 | ======= 46 | 47 | With [npm](http://npmjs.org) do: 48 | 49 | npm install mkdirp 50 | 51 | license 52 | ======= 53 | 54 | MIT/X11 55 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/examples/pow.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('mkdirp'); 2 | 3 | mkdirp('/tmp/foo/bar/baz', function (err) { 4 | if (err) console.error(err) 5 | else console.log('pow!') 6 | }); 7 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/examples/pow.js.orig: -------------------------------------------------------------------------------- 1 | var mkdirp = require('mkdirp'); 2 | 3 | mkdirp('/tmp/foo/bar/baz', 0755, function (err) { 4 | if (err) console.error(err) 5 | else console.log('pow!') 6 | }); 7 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/examples/pow.js.rej: -------------------------------------------------------------------------------- 1 | --- examples/pow.js 2 | +++ examples/pow.js 3 | @@ -1,6 +1,15 @@ 4 | -var mkdirp = require('mkdirp').mkdirp; 5 | +var mkdirp = require('../').mkdirp, 6 | + mkdirpSync = require('../').mkdirpSync; 7 | 8 | mkdirp('/tmp/foo/bar/baz', 0755, function (err) { 9 | if (err) console.error(err) 10 | else console.log('pow!') 11 | }); 12 | + 13 | +try { 14 | + mkdirpSync('/tmp/bar/foo/baz', 0755); 15 | + console.log('double pow!'); 16 | +} 17 | +catch (ex) { 18 | + console.log(ex); 19 | +} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; 5 | 6 | function mkdirP (p, mode, f) { 7 | if (typeof mode === 'function' || mode === undefined) { 8 | f = mode; 9 | mode = 0777 & (~process.umask()); 10 | } 11 | 12 | var cb = f || function () {}; 13 | if (typeof mode === 'string') mode = parseInt(mode, 8); 14 | p = path.resolve(p); 15 | 16 | fs.mkdir(p, mode, function (er) { 17 | if (!er) return cb(); 18 | switch (er.code) { 19 | case 'ENOENT': 20 | mkdirP(path.dirname(p), mode, function (er) { 21 | if (er) cb(er); 22 | else mkdirP(p, mode, cb); 23 | }); 24 | break; 25 | 26 | case 'EEXIST': 27 | fs.stat(p, function (er2, stat) { 28 | // if the stat fails, then that's super weird. 29 | // let the original EEXIST be the failure reason. 30 | if (er2 || !stat.isDirectory()) cb(er) 31 | else if ((stat.mode & 0777) !== mode) fs.chmod(p, mode, cb); 32 | else cb(); 33 | }); 34 | break; 35 | 36 | default: 37 | cb(er); 38 | break; 39 | } 40 | }); 41 | } 42 | 43 | mkdirP.sync = function sync (p, mode) { 44 | if (mode === undefined) { 45 | mode = 0777 & (~process.umask()); 46 | } 47 | 48 | if (typeof mode === 'string') mode = parseInt(mode, 8); 49 | p = path.resolve(p); 50 | 51 | try { 52 | fs.mkdirSync(p, mode) 53 | } 54 | catch (err0) { 55 | switch (err0.code) { 56 | case 'ENOENT' : 57 | var err1 = sync(path.dirname(p), mode) 58 | if (err1) throw err1; 59 | else return sync(p, mode); 60 | break; 61 | 62 | case 'EEXIST' : 63 | var stat; 64 | try { 65 | stat = fs.statSync(p); 66 | } 67 | catch (err1) { 68 | throw err0 69 | } 70 | if (!stat.isDirectory()) throw err0; 71 | else if ((stat.mode & 0777) !== mode) { 72 | try { 73 | fs.chmodSync(p, mode); 74 | } 75 | catch (err) { 76 | if (err && err.code === 'EPERM') return null; 77 | else throw err; 78 | } 79 | return null; 80 | } 81 | else return null; 82 | break; 83 | default : 84 | throw err0 85 | break; 86 | } 87 | } 88 | 89 | return null; 90 | }; 91 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "mkdirp", 3 | "description" : "Recursively mkdir, like `mkdir -p`", 4 | "version" : "0.2.2", 5 | "author" : "James Halliday (http://substack.net)", 6 | "main" : "./index", 7 | "keywords" : [ 8 | "mkdir", 9 | "directory" 10 | ], 11 | "repository" : { 12 | "type" : "git", 13 | "url" : "http://github.com/substack/node-mkdirp.git" 14 | }, 15 | "scripts" : { 16 | "test" : "tap test/*.js" 17 | }, 18 | "devDependencies" : { 19 | "tap" : "0.0.x" 20 | }, 21 | "license" : "MIT/X11", 22 | "engines": { "node": "*" } 23 | } 24 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/chmod.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../').mkdirp; 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | var ps = [ '', 'tmp' ]; 7 | 8 | for (var i = 0; i < 25; i++) { 9 | var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | ps.push(dir); 11 | } 12 | 13 | var file = ps.join('/'); 14 | 15 | test('chmod-pre', function (t) { 16 | var mode = 0744 17 | mkdirp(file, mode, function (er) { 18 | t.ifError(er, 'should not error'); 19 | fs.stat(file, function (er, stat) { 20 | t.ifError(er, 'should exist'); 21 | t.ok(stat && stat.isDirectory(), 'should be directory'); 22 | t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); 23 | t.end(); 24 | }); 25 | }); 26 | }); 27 | 28 | test('chmod', function (t) { 29 | var mode = 0755 30 | mkdirp(file, mode, function (er) { 31 | t.ifError(er, 'should not error'); 32 | fs.stat(file, function (er, stat) { 33 | t.ifError(er, 'should exist'); 34 | t.ok(stat && stat.isDirectory(), 'should be directory'); 35 | t.equal(stat && stat.mode & 0777, mode, 'should be 0755'); 36 | t.end(); 37 | }); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/clobber.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../').mkdirp; 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | var ps = [ '', 'tmp' ]; 7 | 8 | for (var i = 0; i < 25; i++) { 9 | var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | ps.push(dir); 11 | } 12 | 13 | var file = ps.join('/'); 14 | 15 | // a file in the way 16 | var itw = ps.slice(0, 3).join('/'); 17 | 18 | 19 | test('clobber-pre', function (t) { 20 | console.error("about to write to "+itw) 21 | fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); 22 | 23 | fs.stat(itw, function (er, stat) { 24 | t.ifError(er) 25 | t.ok(stat && stat.isFile(), 'should be file') 26 | t.end() 27 | }) 28 | }) 29 | 30 | test('clobber', function (t) { 31 | t.plan(2); 32 | mkdirp(file, 0755, function (err) { 33 | t.ok(err); 34 | t.equal(err.code, 'ENOTDIR'); 35 | t.end(); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/mkdirp.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('woo', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var file = '/tmp/' + [x,y,z].join('/'); 13 | 14 | mkdirp(file, 0755, function (err) { 15 | if (err) t.fail(err); 16 | else path.exists(file, function (ex) { 17 | if (!ex) t.fail('file not created') 18 | else fs.stat(file, function (err, stat) { 19 | if (err) t.fail(err) 20 | else { 21 | t.equal(stat.mode & 0777, 0755); 22 | t.ok(stat.isDirectory(), 'target not a directory'); 23 | t.end(); 24 | } 25 | }) 26 | }) 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/perm.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('async perm', function (t) { 7 | t.plan(2); 8 | var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); 9 | 10 | mkdirp(file, 0755, function (err) { 11 | if (err) t.fail(err); 12 | else path.exists(file, function (ex) { 13 | if (!ex) t.fail('file not created') 14 | else fs.stat(file, function (err, stat) { 15 | if (err) t.fail(err) 16 | else { 17 | t.equal(stat.mode & 0777, 0755); 18 | t.ok(stat.isDirectory(), 'target not a directory'); 19 | t.end(); 20 | } 21 | }) 22 | }) 23 | }); 24 | }); 25 | 26 | test('async root perm', function (t) { 27 | mkdirp('/tmp', 0755, function (err) { 28 | if (err) t.fail(err); 29 | t.end(); 30 | }); 31 | t.end(); 32 | }); 33 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/perm_sync.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('sync perm', function (t) { 7 | t.plan(2); 8 | var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; 9 | 10 | mkdirp.sync(file, 0755); 11 | path.exists(file, function (ex) { 12 | if (!ex) t.fail('file not created') 13 | else fs.stat(file, function (err, stat) { 14 | if (err) t.fail(err) 15 | else { 16 | t.equal(stat.mode & 0777, 0755); 17 | t.ok(stat.isDirectory(), 'target not a directory'); 18 | t.end(); 19 | } 20 | }) 21 | }); 22 | }); 23 | 24 | test('sync root perm', function (t) { 25 | t.plan(1); 26 | 27 | var file = '/tmp'; 28 | mkdirp.sync(file, 0755); 29 | path.exists(file, function (ex) { 30 | if (!ex) t.fail('file not created') 31 | else fs.stat(file, function (err, stat) { 32 | if (err) t.fail(err) 33 | else { 34 | t.ok(stat.isDirectory(), 'target not a directory'); 35 | t.end(); 36 | } 37 | }) 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/race.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../').mkdirp; 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('race', function (t) { 7 | t.plan(4); 8 | var ps = [ '', 'tmp' ]; 9 | 10 | for (var i = 0; i < 25; i++) { 11 | var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 12 | ps.push(dir); 13 | } 14 | var file = ps.join('/'); 15 | 16 | var res = 2; 17 | mk(file, function () { 18 | if (--res === 0) t.end(); 19 | }); 20 | 21 | mk(file, function () { 22 | if (--res === 0) t.end(); 23 | }); 24 | 25 | function mk (file, cb) { 26 | mkdirp(file, 0755, function (err) { 27 | if (err) t.fail(err); 28 | else path.exists(file, function (ex) { 29 | if (!ex) t.fail('file not created') 30 | else fs.stat(file, function (err, stat) { 31 | if (err) t.fail(err) 32 | else { 33 | t.equal(stat.mode & 0777, 0755); 34 | t.ok(stat.isDirectory(), 'target not a directory'); 35 | if (cb) cb(); 36 | } 37 | }) 38 | }) 39 | }); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/rel.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('rel', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var cwd = process.cwd(); 13 | process.chdir('/tmp'); 14 | 15 | var file = [x,y,z].join('/'); 16 | 17 | mkdirp(file, 0755, function (err) { 18 | if (err) t.fail(err); 19 | else path.exists(file, function (ex) { 20 | if (!ex) t.fail('file not created') 21 | else fs.stat(file, function (err, stat) { 22 | if (err) t.fail(err) 23 | else { 24 | process.chdir(cwd); 25 | t.equal(stat.mode & 0777, 0755); 26 | t.ok(stat.isDirectory(), 'target not a directory'); 27 | t.end(); 28 | } 29 | }) 30 | }) 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/sync.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('sync', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var file = '/tmp/' + [x,y,z].join('/'); 13 | 14 | var err = mkdirp.sync(file, 0755); 15 | if (err) t.fail(err); 16 | else path.exists(file, function (ex) { 17 | if (!ex) t.fail('file not created') 18 | else fs.stat(file, function (err, stat) { 19 | if (err) t.fail(err) 20 | else { 21 | t.equal(stat.mode & 0777, 0755); 22 | t.ok(stat.isDirectory(), 'target not a directory'); 23 | t.end(); 24 | } 25 | }) 26 | }) 27 | }); 28 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/umask.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('implicit mode from umask', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var file = '/tmp/' + [x,y,z].join('/'); 13 | 14 | mkdirp(file, function (err) { 15 | if (err) t.fail(err); 16 | else path.exists(file, function (ex) { 17 | if (!ex) t.fail('file not created') 18 | else fs.stat(file, function (err, stat) { 19 | if (err) t.fail(err) 20 | else { 21 | t.equal(stat.mode & 0777, 0777 & (~process.umask())); 22 | t.ok(stat.isDirectory(), 'target not a directory'); 23 | t.end(); 24 | } 25 | }) 26 | }) 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/mkdirp/test/umask_sync.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('umask sync modes', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var file = '/tmp/' + [x,y,z].join('/'); 13 | 14 | var err = mkdirp.sync(file); 15 | if (err) t.fail(err); 16 | else path.exists(file, function (ex) { 17 | if (!ex) t.fail('file not created') 18 | else fs.stat(file, function (err, stat) { 19 | if (err) t.fail(err) 20 | else { 21 | t.equal(stat.mode & 0777, (0777 & (~process.umask()))); 22 | t.ok(stat.isDirectory(), 'target not a directory'); 23 | t.end(); 24 | } 25 | }) 26 | }) 27 | }); 28 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshwnj/statelet/1a7316f6ffbd091d528ad23844812e5334510f6d/tests/node_modules/tap/node_modules/nopt/.gitignore -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter. 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/bin/nopt.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var nopt = require("../lib/nopt") 3 | , types = { num: Number 4 | , bool: Boolean 5 | , help: Boolean 6 | , list: Array 7 | , "num-list": [Number, Array] 8 | , "str-list": [String, Array] 9 | , "bool-list": [Boolean, Array] 10 | , str: String } 11 | , shorthands = { s: [ "--str", "astring" ] 12 | , b: [ "--bool" ] 13 | , nb: [ "--no-bool" ] 14 | , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] 15 | , "?": ["--help"] 16 | , h: ["--help"] 17 | , H: ["--help"] 18 | , n: [ "--num", "125" ] } 19 | , parsed = nopt( types 20 | , shorthands 21 | , process.argv 22 | , 2 ) 23 | 24 | console.log("parsed", parsed) 25 | 26 | if (parsed.help) { 27 | console.log("") 28 | console.log("nopt cli tester") 29 | console.log("") 30 | console.log("types") 31 | console.log(Object.keys(types).map(function M (t) { 32 | var type = types[t] 33 | if (Array.isArray(type)) { 34 | return [t, type.map(function (type) { return type.name })] 35 | } 36 | return [t, type && type.name] 37 | }).reduce(function (s, i) { 38 | s[i[0]] = i[1] 39 | return s 40 | }, {})) 41 | console.log("") 42 | console.log("shorthands") 43 | console.log(shorthands) 44 | } 45 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/examples/my-program.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | //process.env.DEBUG_NOPT = 1 4 | 5 | // my-program.js 6 | var nopt = require("../lib/nopt") 7 | , Stream = require("stream").Stream 8 | , path = require("path") 9 | , knownOpts = { "foo" : [String, null] 10 | , "bar" : [Stream, Number] 11 | , "baz" : path 12 | , "bloo" : [ "big", "medium", "small" ] 13 | , "flag" : Boolean 14 | , "pick" : Boolean 15 | } 16 | , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] 17 | , "b7" : ["--bar", "7"] 18 | , "m" : ["--bloo", "medium"] 19 | , "p" : ["--pick"] 20 | , "f" : ["--flag", "true"] 21 | , "g" : ["--flag"] 22 | , "s" : "--flag" 23 | } 24 | // everything is optional. 25 | // knownOpts and shorthands default to {} 26 | // arg list defaults to process.argv 27 | // slice defaults to 2 28 | , parsed = nopt(knownOpts, shortHands, process.argv, 2) 29 | 30 | console.log("parsed =\n"+ require("util").inspect(parsed)) 31 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/node_modules/abbrev/README.md: -------------------------------------------------------------------------------- 1 | # abbrev-js 2 | 3 | Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). 4 | 5 | Usage: 6 | 7 | var abbrev = require("abbrev"); 8 | abbrev("foo", "fool", "folding", "flop"); 9 | 10 | // returns: 11 | { fl: 'flop' 12 | , flo: 'flop' 13 | , flop: 'flop' 14 | , fol: 'folding' 15 | , fold: 'folding' 16 | , foldi: 'folding' 17 | , foldin: 'folding' 18 | , folding: 'folding' 19 | , foo: 'foo' 20 | , fool: 'fool' 21 | } 22 | 23 | This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. 24 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/node_modules/abbrev/package.json: -------------------------------------------------------------------------------- 1 | { "name" : "abbrev" 2 | , "version" : "1.0.3" 3 | , "description" : "Like ruby's abbrev module, but in js" 4 | , "author" : "Isaac Z. Schlueter " 5 | , "main" : "./lib/abbrev.js" 6 | , "scripts" : { "test" : "node lib/abbrev.js" } 7 | , "repository" : "http://github.com/isaacs/abbrev-js" 8 | } 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/nopt/package.json: -------------------------------------------------------------------------------- 1 | { "name" : "nopt" 2 | , "version" : "1.0.10" 3 | , "description" : "Option parsing for Node, supporting types, shorthands, etc. Used by npm." 4 | , "author" : "Isaac Z. Schlueter (http://blog.izs.me/)" 5 | , "main" : "lib/nopt.js" 6 | , "scripts" : { "test" : "node lib/nopt.js" } 7 | , "repository" : "http://github.com/isaacs/nopt" 8 | , "bin" : "./bin/nopt.js" 9 | , "license" : 10 | { "type" : "MIT" 11 | , "url" : "https://github.com/isaacs/nopt/raw/master/LICENSE" } 12 | , "dependencies" : { "abbrev" : "1" }} 13 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/README.markdown: -------------------------------------------------------------------------------- 1 | runforcover 2 | ====== 3 | 4 | Runforcover is a require-hook library that uses node-bunker to provide code coverage data 5 | for your unit test library, whatever it might be. 6 | 7 | methods 8 | ======= 9 | var runforcover = require('runforcover'); 10 | 11 | var coverage = runforcover.cover([RegExp | path]); 12 | ------- 13 | 14 | Attach runforcover to the global `require` object and patch `require.extensions['.js']` to 15 | provide coverage metadata for all files required after this point. Returns a function 16 | object that can be called to obtain a object keying files to `CoverageData` objects, with 17 | a method for releasing control back to vanilla `require`. Usage: 18 | 19 | ````javascript 20 | 21 | var coverage = runforcover.cover(/.*/g); 22 | 23 | require('some/library'); 24 | 25 | coverage(function(coverageData) { 26 | // coverageData is an object keyed by filename. 27 | var stats = coverageData['/full/path/to/file.js'].stats() 28 | 29 | // the percentage of lines run versus total lines in file 30 | console.log(stats.percentage); 31 | 32 | // the number of missing lines 33 | console.log(stats.missing); 34 | 35 | // the number of lines run (seen) 36 | console.log(stats.seen); 37 | 38 | // an array of line objects representing 'missed' lines 39 | stats.lines; 40 | 41 | stats.lines.forEach(function(line) { 42 | // the line number of the line: 43 | console.log(line.number); 44 | 45 | // returns a string containing the source data for the line: 46 | console.log(line.source()); 47 | }); 48 | 49 | // return control back to the original require function 50 | coverage.release(); 51 | }); 52 | ```` 53 | 54 | license 55 | ======= 56 | new BSD. 57 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/README.markdown: -------------------------------------------------------------------------------- 1 | bunker 2 | ====== 3 | 4 | Bunker is a module to calculate code coverage using native javascript 5 | [burrito](https://github.com/substack/node-burrito) AST trickery. 6 | 7 | ![code coverage](http://substack.net/images/code_coverage.png) 8 | 9 | examples 10 | ======== 11 | 12 | tiny 13 | ---- 14 | 15 | ````javascript 16 | var bunker = require('bunker'); 17 | var b = bunker('var x = 0; for (var i = 0; i < 30; i++) { x++ }'); 18 | 19 | var counts = {}; 20 | 21 | b.on('node', function (node) { 22 | if (!counts[node.id]) { 23 | counts[node.id] = { times : 0, node : node }; 24 | } 25 | counts[node.id].times ++; 26 | }); 27 | 28 | b.run(); 29 | 30 | Object.keys(counts).forEach(function (key) { 31 | var count = counts[key]; 32 | console.log(count.times + ' : ' + count.node.source()); 33 | }); 34 | ```` 35 | 36 | output: 37 | 38 | $ node example/tiny.js 39 | 1 : var x=0; 40 | 31 : i<30 41 | 30 : i++ 42 | 30 : x++; 43 | 30 : x++ 44 | 45 | methods 46 | ======= 47 | 48 | var bunker = require('bunker'); 49 | 50 | var b = bunker(src) 51 | ------------------- 52 | 53 | Create a new bunker code coverageifier with some source `src`. 54 | 55 | The bunker object `b` is an `EventEmitter` that emits `'node'` events with two 56 | parameters: 57 | 58 | * `node` - the [burrito](https://github.com/substack/node-burrito) node object 59 | * `stack` - the stack, [stackedy](https://github.com/substack/node-stackedy) style 60 | 61 | b.include(src) 62 | -------------- 63 | 64 | Include some source into the bunker. 65 | 66 | b.compile() 67 | ----------- 68 | 69 | Return the source wrapped with burrito. 70 | 71 | b.assign(context={}) 72 | -------------------- 73 | 74 | Assign the statement-tracking functions into `context`. 75 | 76 | b.run(context={}) 77 | ----------------- 78 | 79 | Run the source using `vm.runInNewContext()` with some `context`. 80 | The statement-tracking functions will be added to `context` by `assign()`. 81 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/example/prof.js: -------------------------------------------------------------------------------- 1 | var bunker = require('bunker'); 2 | var b = bunker('(' + function () { 3 | function beep () { 4 | var x = 0; 5 | for (var i = 0; i < 1000; i++) { 6 | for (var j = 0; j < 100; j++) { 7 | x += j; 8 | } 9 | } 10 | return x; 11 | } 12 | 13 | beep(); 14 | 15 | } + ')()'); 16 | 17 | var counts = {}; 18 | 19 | b.on('node', function (node) { 20 | if (!counts[node.id]) { 21 | counts[node.id] = { times : 0, node : node, elapsed : 0 }; 22 | } 23 | counts[node.id].times ++; 24 | 25 | var now = Date.now(); 26 | 27 | if (last.id !== undefined) { 28 | counts[last.id].elapsed += last. 29 | } 30 | 31 | if (node.name === 'call') { 32 | var start = now; 33 | 34 | last.id = node.id; 35 | counts[node.id].elapsed += Date.now() - start; 36 | } 37 | else { 38 | counts[node.id].elapsed += now - last; 39 | last = now; 40 | } 41 | }); 42 | 43 | b.run(); 44 | 45 | Object.keys(counts).forEach(function (key) { 46 | var count = counts[key]; 47 | console.log( 48 | [ count.times, count.node.source(), count.elapsed ] 49 | .join(' : ') 50 | ); 51 | }); 52 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/example/tiny.js: -------------------------------------------------------------------------------- 1 | var bunker = require('bunker'); 2 | var b = bunker('var x = 0; for (var i = 0; i < 30; i++) { x++ }'); 3 | 4 | var counts = {}; 5 | 6 | b.on('node', function (node) { 7 | if (!counts[node.id]) { 8 | counts[node.id] = { times : 0, node : node }; 9 | } 10 | counts[node.id].times ++; 11 | }); 12 | 13 | b.run(); 14 | 15 | Object.keys(counts).forEach(function (key) { 16 | var count = counts[key]; 17 | console.log(count.times + ' : ' + count.node.source()); 18 | }); 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/example/top/run.js: -------------------------------------------------------------------------------- 1 | var bunker = require('bunker'); 2 | var fs = require('fs'); 3 | var src = fs.readFileSync(__dirname + '/src.js', 'utf8'); 4 | 5 | var counts = {}; 6 | 7 | var b = bunker(src); 8 | b.on('node', function (node) { 9 | if (!counts[node.id]) { 10 | counts[node.id] = { times : 0, node : node }; 11 | } 12 | counts[node.id].times ++; 13 | }); 14 | 15 | b.run({ 16 | setInterval : setInterval, 17 | clearInterval : clearInterval, 18 | end : function () { 19 | Object.keys(counts) 20 | .sort(function (a, b) { 21 | return counts[b].times - counts[a].times 22 | }) 23 | .forEach(function (key) { 24 | var count = counts[key]; 25 | console.log( 26 | count.times + ' : ' + count.node.source() 27 | ); 28 | }) 29 | ; 30 | } 31 | }); 32 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/example/top/src.js: -------------------------------------------------------------------------------- 1 | function boop () { 2 | for (var i = 0; i < 30; i++) { 3 | nop(); 4 | } 5 | } 6 | 7 | function nop () { 8 | return undefined; 9 | } 10 | 11 | var times = 0; 12 | var iv = setInterval(function () { 13 | if (++times === 10) { 14 | clearInterval(iv); 15 | end(); 16 | } 17 | else boop() 18 | }, 100); 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/index.js: -------------------------------------------------------------------------------- 1 | var burrito = require('burrito'); 2 | var vm = require('vm'); 3 | var EventEmitter = require('events').EventEmitter; 4 | 5 | module.exports = function (src) { 6 | var b = new Bunker(); 7 | if (src) b.include(src); 8 | return b; 9 | }; 10 | 11 | function Bunker () { 12 | this.sources = []; 13 | this.nodes = []; 14 | 15 | this.names = { 16 | call : burrito.generateName(6), 17 | expr : burrito.generateName(6), 18 | stat : burrito.generateName(6) 19 | }; 20 | } 21 | 22 | Bunker.prototype = new EventEmitter; 23 | 24 | Bunker.prototype.include = function (src) { 25 | this.sources.push(src); 26 | this.source = null; 27 | return this; 28 | }; 29 | 30 | Bunker.prototype.compile = function () { 31 | var src = this.sources.join('\n'); 32 | var nodes = this.nodes; 33 | var names = this.names; 34 | 35 | return burrito(src, function (node) { 36 | var i = nodes.length; 37 | 38 | if (node.name === 'call') { 39 | nodes.push(node); 40 | node.wrap(names.call + '(' + i + ')(%s)'); 41 | } 42 | else if (node.name === 'stat' || node.name === 'throw' 43 | || node.name === 'var') { 44 | nodes.push(node); 45 | node.wrap('{' + names.stat + '(' + i + ');%s}'); 46 | } 47 | else if (node.name === 'binary') { 48 | nodes.push(node); 49 | node.wrap(names.expr + '(' + i + ')(%s)'); 50 | } 51 | else if (node.name === 'unary-postfix' || node.name === 'unary-prefix') { 52 | nodes.push(node); 53 | node.wrap(names.expr + '(' + i + ')(%s)'); 54 | } 55 | 56 | if (i !== nodes.length) { 57 | node.id = i; 58 | } 59 | }); 60 | }; 61 | 62 | Bunker.prototype.assign = function (context) { 63 | if (!context) context = {}; 64 | 65 | var self = this; 66 | var stack = []; 67 | 68 | context[self.names.call] = function (i) { 69 | var node = self.nodes[i]; 70 | stack.unshift(node); 71 | self.emit('node', node, stack); 72 | 73 | return function (expr) { 74 | stack.shift(); 75 | return expr; 76 | }; 77 | }; 78 | 79 | context[self.names.expr] = function (i) { 80 | var node = self.nodes[i]; 81 | self.emit('node', node, stack); 82 | 83 | return function (expr) { 84 | return expr; 85 | }; 86 | }; 87 | 88 | context[self.names.stat] = function (i) { 89 | var node = self.nodes[i]; 90 | self.emit('node', node, stack); 91 | }; 92 | 93 | return context; 94 | }; 95 | 96 | Bunker.prototype.run = function (context) { 97 | var src = this.compile(); 98 | vm.runInNewContext(src, this.assign(context)); 99 | 100 | return this; 101 | }; 102 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/example/microwave.js: -------------------------------------------------------------------------------- 1 | var burrito = require('burrito'); 2 | 3 | var res = burrito.microwave('Math.sin(2)', function (node) { 4 | if (node.name === 'num') node.wrap('Math.PI / %s'); 5 | }); 6 | 7 | console.log(res); // sin(pi / 2) == 1 8 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 |

13 | 
14 | 
15 | 


--------------------------------------------------------------------------------
/tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/example/web/main.js:
--------------------------------------------------------------------------------
 1 | var burrito = require('burrito');
 2 | var json = require('jsonify');
 3 | 
 4 | var src = [
 5 |     'function f () { g() }',
 6 |     'function g () { h() }',
 7 |     'function h () { throw "moo" + Array(x).join("!") }',
 8 |     'var x = 4',
 9 |     'f()'
10 | ].join('\r\n');
11 | 
12 | window.onload = function () {
13 |     burrito(src, function (node) {
14 |         document.body.innerHTML += node.name + '
\n'; 15 | }); 16 | }; 17 | if (document.readyState === 'complete') window.onload(); 18 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/example/web/server.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var browserify = require('browserify'); 3 | 4 | var app = express.createServer(); 5 | app.use(express.static(__dirname)); 6 | app.use(browserify({ 7 | entry : __dirname + '/main.js', 8 | watch : true, 9 | })); 10 | 11 | app.listen(8081); 12 | console.log('Listening on :8081'); 13 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/example/wrap.js: -------------------------------------------------------------------------------- 1 | var burrito = require('burrito'); 2 | 3 | var src = burrito('f() && g(h())\nfoo()', function (node) { 4 | if (node.name === 'call') node.wrap('qqq(%s)'); 5 | }); 6 | 7 | console.log(src); 8 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

results

7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/main.js: -------------------------------------------------------------------------------- 1 | var burrito = require('./'); 2 | 3 | window.onload = function () { 4 | var res = burrito.microwave('Math.sin(2)', function (node) { 5 | if (node.name === 'num') node.wrap('Math.PI / %s'); 6 | }); 7 | 8 | document.body.innerHTML += res; 9 | }; 10 | 11 | if (document.readyState === 'complete') window.onload(); 12 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/.bin/uglifyjs: -------------------------------------------------------------------------------- 1 | ../uglify-js/bin/uglifyjs -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 James Halliday (mail@substack.net) 2 | 3 | This project is free software released under the MIT/X11 license: 4 | http://www.opensource.org/licenses/mit-license.php 5 | 6 | Copyright 2010 James Halliday (mail@substack.net) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/examples/json.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | 3 | var id = 54; 4 | var callbacks = {}; 5 | var obj = { moo : function () {}, foo : [2,3,4, function () {}] }; 6 | 7 | var scrubbed = traverse(obj).map(function (x) { 8 | if (typeof x === 'function') { 9 | callbacks[id] = { id : id, f : x, path : this.path }; 10 | this.update('[Function]'); 11 | id++; 12 | } 13 | }); 14 | 15 | console.dir(scrubbed); 16 | console.dir(callbacks); 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/examples/leaves.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | 3 | var obj = { 4 | a : [1,2,3], 5 | b : 4, 6 | c : [5,6], 7 | d : { e : [7,8], f : 9 }, 8 | }; 9 | 10 | var leaves = traverse(obj).reduce(function (acc, x) { 11 | if (this.isLeaf) acc.push(x); 12 | return acc; 13 | }, []); 14 | 15 | console.dir(leaves); 16 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/examples/negative.js: -------------------------------------------------------------------------------- 1 | var traverse = require('traverse'); 2 | var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 3 | 4 | traverse(obj).forEach(function (x) { 5 | if (x < 0) this.update(x + 128); 6 | }); 7 | 8 | console.dir(obj); 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/examples/scrub.js: -------------------------------------------------------------------------------- 1 | // scrub out circular references 2 | var traverse = require('traverse'); 3 | 4 | var obj = { a : 1, b : 2, c : [ 3, 4 ] }; 5 | obj.c.push(obj); 6 | 7 | var scrubbed = traverse(obj).map(function (x) { 8 | if (this.circular) this.remove() 9 | }); 10 | console.dir(scrubbed); 11 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/examples/stringify.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var traverse = require('traverse'); 3 | 4 | var obj = [ 'five', 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 5 | 6 | var s = ''; 7 | traverse(obj).forEach(function to_s (node) { 8 | if (Array.isArray(node)) { 9 | this.before(function () { s += '[' }); 10 | this.post(function (child) { 11 | if (!child.isLast) s += ','; 12 | }); 13 | this.after(function () { s += ']' }); 14 | } 15 | else if (typeof node == 'object') { 16 | this.before(function () { s += '{' }); 17 | this.pre(function (x, key) { 18 | to_s(key); 19 | s += ':'; 20 | }); 21 | this.post(function (child) { 22 | if (!child.isLast) s += ','; 23 | }); 24 | this.after(function () { s += '}' }); 25 | } 26 | else if (typeof node == 'string') { 27 | s += '"' + node.toString().replace(/"/g, '\\"') + '"'; 28 | } 29 | else if (typeof node == 'function') { 30 | s += 'null'; 31 | } 32 | else { 33 | s += node.toString(); 34 | } 35 | }); 36 | 37 | console.log('JSON.stringify: ' + JSON.stringify(obj)); 38 | console.log('this stringify: ' + s); 39 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/main.js: -------------------------------------------------------------------------------- 1 | // scrub out circular references 2 | var traverse = require('./index.js'); 3 | 4 | var obj = { a : 1, b : 2, c : [ 3, 4 ] }; 5 | obj.c.push(obj); 6 | 7 | var scrubbed = traverse(obj).map(function (x) { 8 | if (this.circular) this.remove() 9 | }); 10 | console.dir(scrubbed); 11 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "traverse", 3 | "version" : "0.5.2", 4 | "description" : "Traverse and transform objects by visiting every node on a recursive walk", 5 | "author" : "James Halliday", 6 | "license" : "MIT/X11", 7 | "main" : "./index", 8 | "repository" : { 9 | "type" : "git", 10 | "url" : "http://github.com/substack/js-traverse.git" 11 | }, 12 | "devDependencies" : { 13 | "expresso" : "0.7.x" 14 | }, 15 | "scripts" : { 16 | "test" : "expresso" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/date.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports.dateEach = function () { 5 | var obj = { x : new Date, y : 10, z : 5 }; 6 | 7 | var counts = {}; 8 | 9 | Traverse(obj).forEach(function (node) { 10 | var t = (node instanceof Date && 'Date') || typeof node; 11 | counts[t] = (counts[t] || 0) + 1; 12 | }); 13 | 14 | assert.deepEqual(counts, { 15 | object : 1, 16 | Date : 1, 17 | number : 2, 18 | }); 19 | }; 20 | 21 | exports.dateMap = function () { 22 | var obj = { x : new Date, y : 10, z : 5 }; 23 | 24 | var res = Traverse(obj).map(function (node) { 25 | if (typeof node === 'number') this.update(node + 100); 26 | }); 27 | 28 | assert.ok(obj.x !== res.x); 29 | assert.deepEqual(res, { 30 | x : obj.x, 31 | y : 110, 32 | z : 105, 33 | }); 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/instance.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | var EventEmitter = require('events').EventEmitter; 4 | 5 | exports['check instanceof on node elems'] = function () { 6 | 7 | var counts = { emitter : 0 }; 8 | 9 | Traverse([ new EventEmitter, 3, 4, { ev : new EventEmitter }]) 10 | .forEach(function (node) { 11 | if (node instanceof EventEmitter) counts.emitter ++; 12 | }) 13 | ; 14 | 15 | assert.equal(counts.emitter, 2); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/interface.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['interface map'] = function () { 5 | var obj = { a : [ 5,6,7 ], b : { c : [8] } }; 6 | 7 | assert.deepEqual( 8 | Traverse.paths(obj) 9 | .sort() 10 | .map(function (path) { return path.join('/') }) 11 | .slice(1) 12 | .join(' ') 13 | , 14 | 'a a/0 a/1 a/2 b b/c b/c/0' 15 | ); 16 | 17 | assert.deepEqual( 18 | Traverse.nodes(obj), 19 | [ 20 | { a: [ 5, 6, 7 ], b: { c: [ 8 ] } }, 21 | [ 5, 6, 7 ], 5, 6, 7, 22 | { c: [ 8 ] }, [ 8 ], 8 23 | ] 24 | ); 25 | 26 | assert.deepEqual( 27 | Traverse.map(obj, function (node) { 28 | if (typeof node == 'number') { 29 | return node + 1000; 30 | } 31 | else if (Array.isArray(node)) { 32 | return node.join(' '); 33 | } 34 | }), 35 | { a: '5 6 7', b: { c: '8' } } 36 | ); 37 | 38 | var nodes = 0; 39 | Traverse.forEach(obj, function (node) { nodes ++ }); 40 | assert.deepEqual(nodes, 8); 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/json.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['json test'] = function () { 5 | var id = 54; 6 | var callbacks = {}; 7 | var obj = { moo : function () {}, foo : [2,3,4, function () {}] }; 8 | 9 | var scrubbed = Traverse(obj).map(function (x) { 10 | if (typeof x === 'function') { 11 | callbacks[id] = { id : id, f : x, path : this.path }; 12 | this.update('[Function]'); 13 | id++; 14 | } 15 | }); 16 | 17 | assert.equal( 18 | scrubbed.moo, '[Function]', 19 | 'obj.moo replaced with "[Function]"' 20 | ); 21 | 22 | assert.equal( 23 | scrubbed.foo[3], '[Function]', 24 | 'obj.foo[3] replaced with "[Function]"' 25 | ); 26 | 27 | assert.deepEqual(scrubbed, { 28 | moo : '[Function]', 29 | foo : [ 2, 3, 4, "[Function]" ] 30 | }, 'Full JSON string matches'); 31 | 32 | assert.deepEqual( 33 | typeof obj.moo, 'function', 34 | 'Original obj.moo still a function' 35 | ); 36 | 37 | assert.deepEqual( 38 | typeof obj.foo[3], 'function', 39 | 'Original obj.foo[3] still a function' 40 | ); 41 | 42 | assert.deepEqual(callbacks, { 43 | 54: { id: 54, f : obj.moo, path: [ 'moo' ] }, 44 | 55: { id: 55, f : obj.foo[3], path: [ 'foo', '3' ] }, 45 | }, 'Check the generated callbacks list'); 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/keys.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['sort test'] = function () { 5 | var acc = []; 6 | Traverse({ 7 | a: 30, 8 | b: 22, 9 | id: 9 10 | }).forEach(function (node) { 11 | if ((! Array.isArray(node)) && typeof node === 'object') { 12 | this.before(function(node) { 13 | this.keys = Object.keys(node); 14 | this.keys.sort(function(a, b) { 15 | a = [a === "id" ? 0 : 1, a]; 16 | b = [b === "id" ? 0 : 1, b]; 17 | return a < b ? -1 : a > b ? 1 : 0; 18 | }); 19 | }); 20 | } 21 | if (this.isLeaf) acc.push(node); 22 | }); 23 | 24 | assert.equal( 25 | acc.join(' '), 26 | '9 30 22', 27 | 'Traversal in a custom order' 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/leaves.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['leaves test'] = function () { 5 | var acc = []; 6 | Traverse({ 7 | a : [1,2,3], 8 | b : 4, 9 | c : [5,6], 10 | d : { e : [7,8], f : 9 } 11 | }).forEach(function (x) { 12 | if (this.isLeaf) acc.push(x); 13 | }); 14 | 15 | assert.equal( 16 | acc.join(' '), 17 | '1 2 3 4 5 6 7 8 9', 18 | 'Traversal in the right(?) order' 19 | ); 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/lib/deep_equal.js: -------------------------------------------------------------------------------- 1 | var traverse = require('../../'); 2 | 3 | module.exports = function (a, b) { 4 | if (arguments.length !== 2) { 5 | throw new Error( 6 | 'deepEqual requires exactly two objects to compare against' 7 | ); 8 | } 9 | 10 | var equal = true; 11 | var node = b; 12 | 13 | traverse(a).forEach(function (y) { 14 | var notEqual = (function () { 15 | equal = false; 16 | //this.stop(); 17 | return undefined; 18 | }).bind(this); 19 | 20 | //if (node === undefined || node === null) return notEqual(); 21 | 22 | if (!this.isRoot) { 23 | /* 24 | if (!Object.hasOwnProperty.call(node, this.key)) { 25 | return notEqual(); 26 | } 27 | */ 28 | if (typeof node !== 'object') return notEqual(); 29 | node = node[this.key]; 30 | } 31 | 32 | var x = node; 33 | 34 | this.post(function () { 35 | node = x; 36 | }); 37 | 38 | var toS = function (o) { 39 | return Object.prototype.toString.call(o); 40 | }; 41 | 42 | if (this.circular) { 43 | if (traverse(b).get(this.circular.path) !== x) notEqual(); 44 | } 45 | else if (typeof x !== typeof y) { 46 | notEqual(); 47 | } 48 | else if (x === null || y === null || x === undefined || y === undefined) { 49 | if (x !== y) notEqual(); 50 | } 51 | else if (x.__proto__ !== y.__proto__) { 52 | notEqual(); 53 | } 54 | else if (x === y) { 55 | // nop 56 | } 57 | else if (typeof x === 'function') { 58 | if (x instanceof RegExp) { 59 | // both regexps on account of the __proto__ check 60 | if (x.toString() != y.toString()) notEqual(); 61 | } 62 | else if (x !== y) notEqual(); 63 | } 64 | else if (typeof x === 'object') { 65 | if (toS(y) === '[object Arguments]' 66 | || toS(x) === '[object Arguments]') { 67 | if (toS(x) !== toS(y)) { 68 | notEqual(); 69 | } 70 | } 71 | else if (x instanceof Date || y instanceof Date) { 72 | if (!(x instanceof Date) || !(y instanceof Date) 73 | || x.getTime() !== y.getTime()) { 74 | notEqual(); 75 | } 76 | } 77 | else { 78 | var kx = Object.keys(x); 79 | var ky = Object.keys(y); 80 | if (kx.length !== ky.length) return notEqual(); 81 | for (var i = 0; i < kx.length; i++) { 82 | var k = kx[i]; 83 | if (!Object.hasOwnProperty.call(y, k)) { 84 | notEqual(); 85 | } 86 | } 87 | } 88 | } 89 | }); 90 | 91 | return equal; 92 | }; 93 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/negative.js: -------------------------------------------------------------------------------- 1 | var Traverse = require('../'); 2 | var assert = require('assert'); 3 | 4 | exports['negative update test'] = function () { 5 | var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 6 | var fixed = Traverse.map(obj, function (x) { 7 | if (x < 0) this.update(x + 128); 8 | }); 9 | 10 | assert.deepEqual(fixed, 11 | [ 5, 6, 125, [ 7, 8, 126, 1 ], { f: 10, g: 115 } ], 12 | 'Negative values += 128' 13 | ); 14 | 15 | assert.deepEqual(obj, 16 | [ 5, 6, -3, [ 7, 8, -2, 1 ], { f: 10, g: -13 } ], 17 | 'Original references not modified' 18 | ); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/obj.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports['traverse an object with nested functions'] = function () { 5 | var to = setTimeout(function () { 6 | assert.fail('never ran'); 7 | }, 1000); 8 | 9 | function Cons (x) { 10 | clearTimeout(to); 11 | assert.equal(x, 10); 12 | }; 13 | Traverse(new Cons(10)); 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/siblings.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | 4 | exports.siblings = function () { 5 | var obj = { a : 1, b : 2, c : [ 4, 5, 6 ] }; 6 | 7 | var res = traverse(obj).reduce(function (acc, x) { 8 | var p = '/' + this.path.join('/'); 9 | if (this.parent) { 10 | acc[p] = { 11 | siblings : this.parent.keys, 12 | key : this.key, 13 | index : this.parent.keys.indexOf(this.key) 14 | }; 15 | } 16 | else { 17 | acc[p] = { 18 | siblings : [], 19 | key : this.key, 20 | index : -1 21 | } 22 | } 23 | return acc; 24 | }, {}); 25 | 26 | assert.deepEqual(res, { 27 | '/' : { siblings : [], key : undefined, index : -1 }, 28 | '/a' : { siblings : [ 'a', 'b', 'c' ], key : 'a', index : 0 }, 29 | '/b' : { siblings : [ 'a', 'b', 'c' ], key : 'b', index : 1 }, 30 | '/c' : { siblings : [ 'a', 'b', 'c' ], key : 'c', index : 2 }, 31 | '/c/0' : { siblings : [ '0', '1', '2' ], key : '0', index : 0 }, 32 | '/c/1' : { siblings : [ '0', '1', '2' ], key : '1', index : 1 }, 33 | '/c/2' : { siblings : [ '0', '1', '2' ], key : '2', index : 2 } 34 | }); 35 | }; 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/stop.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | 4 | exports.stop = function () { 5 | var visits = 0; 6 | traverse('abcdefghij'.split('')).forEach(function (node) { 7 | if (typeof node === 'string') { 8 | visits ++; 9 | if (node === 'e') this.stop() 10 | } 11 | }); 12 | 13 | assert.equal(visits, 5); 14 | }; 15 | 16 | exports.stopMap = function () { 17 | var s = traverse('abcdefghij'.split('')).map(function (node) { 18 | if (typeof node === 'string') { 19 | if (node === 'e') this.stop() 20 | return node.toUpperCase(); 21 | } 22 | }).join(''); 23 | 24 | assert.equal(s, 'ABCDEfghij'); 25 | }; 26 | 27 | exports.stopReduce = function () { 28 | var obj = { 29 | a : [ 4, 5 ], 30 | b : [ 6, [ 7, 8, 9 ] ] 31 | }; 32 | var xs = traverse(obj).reduce(function (acc, node) { 33 | if (this.isLeaf) { 34 | if (node === 7) this.stop(); 35 | else acc.push(node) 36 | } 37 | return acc; 38 | }, []); 39 | 40 | assert.deepEqual(xs, [ 4, 5, 6 ]); 41 | }; 42 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/stringify.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var Traverse = require('../'); 3 | 4 | exports.stringify = function () { 5 | var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; 6 | 7 | var s = ''; 8 | Traverse(obj).forEach(function (node) { 9 | if (Array.isArray(node)) { 10 | this.before(function () { s += '[' }); 11 | this.post(function (child) { 12 | if (!child.isLast) s += ','; 13 | }); 14 | this.after(function () { s += ']' }); 15 | } 16 | else if (typeof node == 'object') { 17 | this.before(function () { s += '{' }); 18 | this.pre(function (x, key) { 19 | s += '"' + key + '"' + ':'; 20 | }); 21 | this.post(function (child) { 22 | if (!child.isLast) s += ','; 23 | }); 24 | this.after(function () { s += '}' }); 25 | } 26 | else if (typeof node == 'function') { 27 | s += 'null'; 28 | } 29 | else { 30 | s += node.toString(); 31 | } 32 | }); 33 | 34 | assert.equal(s, JSON.stringify(obj)); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/subexpr.js: -------------------------------------------------------------------------------- 1 | var traverse = require('../'); 2 | var assert = require('assert'); 3 | 4 | exports.subexpr = function () { 5 | var obj = [ 'a', 4, 'b', 5, 'c', 6 ]; 6 | var r = traverse(obj).map(function (x) { 7 | if (typeof x === 'number') { 8 | this.update([ x - 0.1, x, x + 0.1 ], true); 9 | } 10 | }); 11 | 12 | assert.deepEqual(obj, [ 'a', 4, 'b', 5, 'c', 6 ]); 13 | assert.deepEqual(r, [ 14 | 'a', [ 3.9, 4, 4.1 ], 15 | 'b', [ 4.9, 5, 5.1 ], 16 | 'c', [ 5.9, 6, 6.1 ], 17 | ]); 18 | }; 19 | 20 | exports.block = function () { 21 | var obj = [ [ 1 ], [ 2 ], [ 3 ] ]; 22 | var r = traverse(obj).map(function (x) { 23 | if (Array.isArray(x) && !this.isRoot) { 24 | if (x[0] === 5) this.block() 25 | else this.update([ [ x[0] + 1 ] ]) 26 | } 27 | }); 28 | 29 | assert.deepEqual(r, [ 30 | [ [ [ [ [ 5 ] ] ] ] ], 31 | [ [ [ [ 5 ] ] ] ], 32 | [ [ [ 5 ] ] ], 33 | ]); 34 | }; 35 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/traverse/test/super_deep.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var traverse = require('../'); 3 | var deepEqual = require('./lib/deep_equal'); 4 | 5 | exports.super_deep = function () { 6 | var util = require('util'); 7 | var a0 = make(); 8 | var a1 = make(); 9 | assert.ok(deepEqual(a0, a1)); 10 | 11 | a0.c.d.moo = true; 12 | assert.ok(!deepEqual(a0, a1)); 13 | 14 | a1.c.d.moo = true; 15 | assert.ok(deepEqual(a0, a1)); 16 | 17 | // TODO: this one 18 | //a0.c.a = a1; 19 | //assert.ok(!deepEqual(a0, a1)); 20 | }; 21 | 22 | function make () { 23 | var a = { self : 'a' }; 24 | var b = { self : 'b' }; 25 | var c = { self : 'c' }; 26 | var d = { self : 'd' }; 27 | var e = { self : 'e' }; 28 | 29 | a.a = a; 30 | a.b = b; 31 | a.c = c; 32 | 33 | b.a = a; 34 | b.b = b; 35 | b.c = c; 36 | 37 | c.a = a; 38 | c.b = b; 39 | c.c = c; 40 | c.d = d; 41 | 42 | d.a = a; 43 | d.b = b; 44 | d.c = c; 45 | d.d = d; 46 | d.e = e; 47 | 48 | e.a = a; 49 | e.b = b; 50 | e.c = c; 51 | e.d = d; 52 | e.e = e; 53 | 54 | return a; 55 | } 56 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .tmp*~ 3 | *.local.* 4 | .pinf-* -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/docstyle.css: -------------------------------------------------------------------------------- 1 | html { font-family: "Lucida Grande","Trebuchet MS",sans-serif; font-size: 12pt; } 2 | body { max-width: 60em; } 3 | .title { text-align: center; } 4 | .todo { color: red; } 5 | .done { color: green; } 6 | .tag { background-color:lightblue; font-weight:normal } 7 | .target { } 8 | .timestamp { color: grey } 9 | .timestamp-kwd { color: CadetBlue } 10 | p.verse { margin-left: 3% } 11 | pre { 12 | border: 1pt solid #AEBDCC; 13 | background-color: #F3F5F7; 14 | padding: 5pt; 15 | font-family: monospace; 16 | font-size: 90%; 17 | overflow:auto; 18 | } 19 | pre.src { 20 | background-color: #eee; color: #112; border: 1px solid #000; 21 | } 22 | table { border-collapse: collapse; } 23 | td, th { vertical-align: top; } 24 | dt { font-weight: bold; } 25 | div.figure { padding: 0.5em; } 26 | div.figure p { text-align: center; } 27 | .linenr { font-size:smaller } 28 | .code-highlighted {background-color:#ffff00;} 29 | .org-info-js_info-navigation { border-style:none; } 30 | #org-info-js_console-label { font-size:10px; font-weight:bold; 31 | white-space:nowrap; } 32 | .org-info-js_search-highlight {background-color:#ffff00; color:#000000; 33 | font-weight:bold; } 34 | 35 | sup { 36 | vertical-align: baseline; 37 | position: relative; 38 | top: -0.5em; 39 | font-size: 80%; 40 | } 41 | 42 | sup a:link, sup a:visited { 43 | text-decoration: none; 44 | color: #c00; 45 | } 46 | 47 | sup a:before { content: "["; color: #999; } 48 | sup a:after { content: "]"; color: #999; } 49 | 50 | h1.title { border-bottom: 4px solid #000; padding-bottom: 5px; margin-bottom: 2em; } 51 | 52 | #postamble { 53 | color: #777; 54 | font-size: 90%; 55 | padding-top: 1em; padding-bottom: 1em; border-top: 1px solid #999; 56 | margin-top: 2em; 57 | padding-left: 2em; 58 | padding-right: 2em; 59 | text-align: right; 60 | } 61 | 62 | #postamble p { margin: 0; } 63 | 64 | #footnotes { border-top: 1px solid #000; } 65 | 66 | h1 { font-size: 200% } 67 | h2 { font-size: 175% } 68 | h3 { font-size: 150% } 69 | h4 { font-size: 125% } 70 | 71 | h1, h2, h3, h4 { font-family: "Bookman",Georgia,"Times New Roman",serif; font-weight: normal; } 72 | 73 | @media print { 74 | html { font-size: 11pt; } 75 | } 76 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/lib/squeeze-more.js: -------------------------------------------------------------------------------- 1 | var jsp = require("./parse-js"), 2 | pro = require("./process"), 3 | slice = jsp.slice, 4 | member = jsp.member, 5 | curry = jsp.curry, 6 | MAP = pro.MAP, 7 | PRECEDENCE = jsp.PRECEDENCE, 8 | OPERATORS = jsp.OPERATORS; 9 | 10 | function ast_squeeze_more(ast) { 11 | var w = pro.ast_walker(), walk = w.walk, scope; 12 | function with_scope(s, cont) { 13 | var save = scope, ret; 14 | scope = s; 15 | ret = cont(); 16 | scope = save; 17 | return ret; 18 | }; 19 | function _lambda(name, args, body) { 20 | return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ]; 21 | }; 22 | return w.with_walkers({ 23 | "toplevel": function(body) { 24 | return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ]; 25 | }, 26 | "function": _lambda, 27 | "defun": _lambda, 28 | "new": function(ctor, args) { 29 | if (ctor[0] == "name" && ctor[1] == "Array" && !scope.has("Array")) { 30 | if (args.length != 1) { 31 | return [ "array", args ]; 32 | } else { 33 | return walk([ "call", [ "name", "Array" ], args ]); 34 | } 35 | } 36 | }, 37 | "call": function(expr, args) { 38 | if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) { 39 | // foo.toString() ==> foo+"" 40 | return [ "binary", "+", expr[1], [ "string", "" ]]; 41 | } 42 | if (expr[0] == "name" && expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { 43 | return [ "array", args ]; 44 | } 45 | } 46 | }, function() { 47 | return walk(pro.ast_add_scope(ast)); 48 | }); 49 | }; 50 | 51 | exports.ast_squeeze_more = ast_squeeze_more; 52 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "uglify-js", 3 | 4 | "author" : { 5 | "name" : "Mihai Bazon", 6 | "email" : "mihai.bazon@gmail.com", 7 | "url" : "http://mihai.bazon.net/blog" 8 | }, 9 | 10 | "version" : "1.0.7", 11 | 12 | "main" : "./uglify-js.js", 13 | 14 | "bin" : { 15 | "uglifyjs" : "./bin/uglifyjs" 16 | }, 17 | 18 | "repository": { 19 | "type": "git", 20 | "url": "git@github.com:mishoo/UglifyJS.git" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/beautify.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | global.sys = require("sys"); 4 | var fs = require("fs"); 5 | 6 | var jsp = require("../lib/parse-js"); 7 | var pro = require("../lib/process"); 8 | 9 | var filename = process.argv[2]; 10 | fs.readFile(filename, "utf8", function(err, text){ 11 | try { 12 | var ast = time_it("parse", function(){ return jsp.parse(text); }); 13 | ast = time_it("mangle", function(){ return pro.ast_mangle(ast); }); 14 | ast = time_it("squeeze", function(){ return pro.ast_squeeze(ast); }); 15 | var gen = time_it("generate", function(){ return pro.gen_code(ast, false); }); 16 | sys.puts(gen); 17 | } catch(ex) { 18 | sys.debug(ex.stack); 19 | sys.debug(sys.inspect(ex)); 20 | sys.debug(JSON.stringify(ex)); 21 | } 22 | }); 23 | 24 | function time_it(name, cont) { 25 | var t1 = new Date().getTime(); 26 | try { return cont(); } 27 | finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); } 28 | }; 29 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/array1.js: -------------------------------------------------------------------------------- 1 | [],Array(1),[1,2,3] 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/array2.js: -------------------------------------------------------------------------------- 1 | (function(){var a=function(){};return new a(1,2,3,4)})() 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/array3.js: -------------------------------------------------------------------------------- 1 | (function(){function a(){}return new a(1,2,3,4)})() 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/array4.js: -------------------------------------------------------------------------------- 1 | (function(){function a(){}(function(){return new a(1,2,3)})()})() 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/assignment.js: -------------------------------------------------------------------------------- 1 | a=1,b=a,c=1,d=b,e=d,longname=2;if(longname+1){x=3;if(x)var z=7}z=1,y=1,x=1,g+=1,h=g,++i,j=i,i++,j=i+17 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/concatstring.js: -------------------------------------------------------------------------------- 1 | var a=a+"a"+"b"+1+c,b=a+"c"+"ds"+123+c,c=a+"c"+123+d+"ds"+c -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/const.js: -------------------------------------------------------------------------------- 1 | var a=13,b=1/3 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js: -------------------------------------------------------------------------------- 1 | function bar(){return--x}function foo(){while(bar());}function mak(){for(;;);}var x=5 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/forstatement.js: -------------------------------------------------------------------------------- 1 | a=func(),b=z;for(a++;i<10;i++)alert(i);var z=1;g=2;for(;i<10;i++)alert(i);var a=2;for(var i=1;i<10;i++)alert(i) -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/if.js: -------------------------------------------------------------------------------- 1 | var a=1;a==1?a=2:a=17 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js: -------------------------------------------------------------------------------- 1 | function a(a){return a==1?2:17} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js: -------------------------------------------------------------------------------- 1 | function x(a){return typeof a=="object"?a:a===42?0:a*2}function y(a){return typeof a=="object"?a:null} 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue10.js: -------------------------------------------------------------------------------- 1 | function f(){var a;return(a="a")?a:a}f() -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue11.js: -------------------------------------------------------------------------------- 1 | new(A,B),new(A||B),new(X?A:B) -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue13.js: -------------------------------------------------------------------------------- 1 | var a=/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/ -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue14.js: -------------------------------------------------------------------------------- 1 | var a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"} 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue16.js: -------------------------------------------------------------------------------- 1 | var a=3250441966 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue17.js: -------------------------------------------------------------------------------- 1 | var a=function(b){b(),a()} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue20.js: -------------------------------------------------------------------------------- 1 | a:1 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue21.js: -------------------------------------------------------------------------------- 1 | var a=0;switch(a){case 0:a++} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue25.js: -------------------------------------------------------------------------------- 1 | label1:{label2:break label2;console.log(1)} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue27.js: -------------------------------------------------------------------------------- 1 | (a?b:c)?d:e -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue28.js: -------------------------------------------------------------------------------- 1 | o={".5":.5},o={.5:.5},o={.5:.5} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue29.js: -------------------------------------------------------------------------------- 1 | result=function(){return 1}() -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue30.js: -------------------------------------------------------------------------------- 1 | var a=8,b=4,c=4 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue34.js: -------------------------------------------------------------------------------- 1 | var a={};a["this"]=1,a.that=2 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue4.js: -------------------------------------------------------------------------------- 1 | var a=2e3,b=.002,c=2e-5 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue48.js: -------------------------------------------------------------------------------- 1 | var s,i;s="",i=0 -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue50.js: -------------------------------------------------------------------------------- 1 | function bar(a){try{foo()}catch(b){alert("Exception caught (foo not defined)")}alert(a)}bar(10) 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue53.js: -------------------------------------------------------------------------------- 1 | x=(y,z) 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js: -------------------------------------------------------------------------------- 1 | foo+"",a.toString(16),b.toString.call(c) 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue68.js: -------------------------------------------------------------------------------- 1 | function f(){function b(){}if(a)return;b()} 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue69.js: -------------------------------------------------------------------------------- 1 | [(a,b)] 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/issue9.js: -------------------------------------------------------------------------------- 1 | var a={a:1,b:2} -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/mangle.js: -------------------------------------------------------------------------------- 1 | (function(){var a=function b(a,b,c){return b}})() 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js: -------------------------------------------------------------------------------- 1 | typeof a=="string",b+""!=c+"",d> 1; 3 | var c = 8 >>> 1; -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue34.js: -------------------------------------------------------------------------------- 1 | var a = {}; 2 | a["this"] = 1; 3 | a["that"] = 2; -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue4.js: -------------------------------------------------------------------------------- 1 | var a = 2e3; 2 | var b = 2e-3; 3 | var c = 2e-5; -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue48.js: -------------------------------------------------------------------------------- 1 | var s, i; s = ''; i = 0; -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue50.js: -------------------------------------------------------------------------------- 1 | function bar(a) { 2 | try { 3 | foo(); 4 | } catch(e) { 5 | alert("Exception caught (foo not defined)"); 6 | } 7 | alert(a); // 10 in FF, "[object Error]" in IE 8 | } 9 | bar(10); 10 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue53.js: -------------------------------------------------------------------------------- 1 | x = (y, z) 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue54.1.js: -------------------------------------------------------------------------------- 1 | foo.toString(); 2 | a.toString(16); 3 | b.toString.call(c); 4 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue68.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | if (a) return; 3 | g(); 4 | function g(){} 5 | }; 6 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue69.js: -------------------------------------------------------------------------------- 1 | [(a,b)] 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/issue9.js: -------------------------------------------------------------------------------- 1 | var a = { 2 | a: 1, 3 | b: 2, // <-- trailing comma 4 | }; 5 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/mangle.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = function fun(a, fun, b) { 3 | return fun; 4 | }; 5 | }()); 6 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/strict-equals.js: -------------------------------------------------------------------------------- 1 | typeof a === 'string' 2 | b + "" !== c + "" 3 | d < e === f < g 4 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/var.js: -------------------------------------------------------------------------------- 1 | // var declarations after each other should be combined 2 | var a = 1; 3 | var b = 2; -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/compress/test/with.js: -------------------------------------------------------------------------------- 1 | with({}) { 2 | }; 3 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/test/unit/scripts.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'), 2 | uglify = require('uglify-js'), 3 | jsp = uglify.parser, 4 | nodeunit = require('nodeunit'), 5 | path = require('path'), 6 | pro = uglify.uglify; 7 | 8 | var Script = process.binding('evals').Script; 9 | 10 | var scriptsPath = __dirname; 11 | 12 | function compress(code) { 13 | var ast = jsp.parse(code); 14 | ast = pro.ast_mangle(ast); 15 | ast = pro.ast_squeeze(ast, { no_warnings: true }); 16 | ast = pro.ast_squeeze_more(ast); 17 | return pro.gen_code(ast); 18 | }; 19 | 20 | var testDir = path.join(scriptsPath, "compress", "test"); 21 | var expectedDir = path.join(scriptsPath, "compress", "expected"); 22 | 23 | function getTester(script) { 24 | return function(test) { 25 | var testPath = path.join(testDir, script); 26 | var expectedPath = path.join(expectedDir, script); 27 | var content = fs.readFileSync(testPath, 'utf-8'); 28 | var outputCompress = compress(content); 29 | 30 | // Check if the noncompressdata is larger or same size as the compressed data 31 | test.ok(content.length >= outputCompress.length); 32 | 33 | // Check that a recompress gives the same result 34 | var outputReCompress = compress(content); 35 | test.equal(outputCompress, outputReCompress); 36 | 37 | // Check if the compressed output is what is expected 38 | var expected = fs.readFileSync(expectedPath, 'utf-8'); 39 | test.equal(outputCompress, expected.replace(/(\r?\n)+$/, "")); 40 | 41 | test.done(); 42 | }; 43 | }; 44 | 45 | var tests = {}; 46 | 47 | var scripts = fs.readdirSync(testDir); 48 | for (var i in scripts) { 49 | var script = scripts[i]; 50 | if (/\.js$/.test(script)) { 51 | tests[script] = getTester(script); 52 | } 53 | } 54 | 55 | module.exports = nodeunit.testCase(tests); 56 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/tmp/hoist.js: -------------------------------------------------------------------------------- 1 | function foo(arg1, arg2, arg3, arg4, arg5, arg6) { 2 | var a = 5; 3 | { 4 | var d = 10, mak = 20, buz = 30; 5 | var q = buz * 2; 6 | } 7 | if (moo) { 8 | var a, b, c; 9 | } 10 | for (var arg1 = 0, d = 20; arg1 < 10; ++arg1) 11 | console.log(arg3); 12 | for (var i in mak) {} 13 | for (j in d) {} 14 | var d; 15 | 16 | function test() { 17 | 18 | }; 19 | 20 | //test(); 21 | 22 | (function moo(first, second){ 23 | console.log(first); 24 | })(1); 25 | 26 | (function moo(first, second){ 27 | console.log(moo()); 28 | })(1); 29 | } 30 | 31 | 32 | var foo; 33 | var bar; 34 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/tmp/test.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util"); 4 | var fs = require("fs"); 5 | var uglify = require("uglify-js"), // symlink ~/.node_libraries/uglify-js.js to ../uglify-js.js 6 | jsp = uglify.parser, 7 | pro = uglify.uglify; 8 | 9 | var code = fs.readFileSync("hoist.js", "utf8"); 10 | var ast = jsp.parse(code); 11 | 12 | ast = pro.ast_lift_variables(ast); 13 | 14 | console.log(pro.gen_code(ast, { 15 | beautify: true 16 | })); 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/node_modules/uglify-js/uglify-js.js: -------------------------------------------------------------------------------- 1 | //convienence function(src, [options]); 2 | function uglify(orig_code, options){ 3 | options || (options = {}); 4 | var jsp = uglify.parser; 5 | var pro = uglify.uglify; 6 | 7 | var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST 8 | ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names 9 | ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations 10 | var final_code = pro.gen_code(ast, options.gen_options); // compressed code here 11 | return final_code; 12 | }; 13 | 14 | uglify.parser = require("./lib/parse-js"); 15 | uglify.uglify = require("./lib/process"); 16 | 17 | module.exports = uglify -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "burrito", 3 | "description" : "Wrap up expressions with a trace function while walking the AST with rice and beans on the side", 4 | "version" : "0.2.11", 5 | "repository" : { 6 | "type" : "git", 7 | "url" : "git://github.com/substack/node-burrito.git" 8 | }, 9 | "main" : "./index.js", 10 | "keywords" : [ 11 | "trace", 12 | "ast", 13 | "walk", 14 | "syntax", 15 | "source", 16 | "tree", 17 | "uglify" 18 | ], 19 | "directories" : { 20 | "lib" : ".", 21 | "example" : "example", 22 | "test" : "test" 23 | }, 24 | "scripts" : { 25 | "test" : "expresso" 26 | }, 27 | "dependencies" : { 28 | "traverse" : ">=0.5.1 <0.6.0", 29 | "uglify-js" : "1.0.7" 30 | }, 31 | "devDependencies" : { 32 | "expresso" : "=0.7.x" 33 | }, 34 | "engines" : { 35 | "node" : ">=0.4.0" 36 | }, 37 | "license" : "BSD", 38 | "author" : { 39 | "name" : "James Halliday", 40 | "email" : "mail@substack.net", 41 | "url" : "http://substack.net" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/server.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var app = express.createServer(); 3 | app.use(express.static(__dirname)); 4 | app.listen(8080); 5 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/test/ast.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var burrito = require('../'); 3 | var vm = require('vm'); 4 | 5 | exports.ast = function () { 6 | var ast = burrito.parse('f(g(h(5)))', false, true); 7 | var src = burrito(ast, function (node) { 8 | if (node.name === 'call') { 9 | node.wrap(function (s) { 10 | return 'z(' + s + ')'; 11 | }); 12 | } 13 | }); 14 | 15 | var times = 0; 16 | assert.equal( 17 | vm.runInNewContext(src, { 18 | f : function (x) { return x + 1 }, 19 | g : function (x) { return x + 2 }, 20 | h : function (x) { return x + 3 }, 21 | z : function (x) { 22 | times ++; 23 | return x * 10; 24 | }, 25 | }), 26 | (((((5 + 3) * 10) + 2) * 10) + 1) * 10 27 | ); 28 | assert.equal(times, 3); 29 | }; 30 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/test/err.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var burrito = require('../'); 3 | 4 | exports.wrapError = function () { 5 | try { 6 | var src = burrito('f() && g()', function (node) { 7 | if (node.name === 'binary') node.wrap('h(%a, %b') 8 | }); 9 | assert.fail('should have blown up'); 10 | } 11 | catch (err) { 12 | assert.ok(err.message.match(/unexpected/i)); 13 | assert.ok(err instanceof SyntaxError); 14 | assert.ok(!err.stack.match(/uglify-js/)); 15 | assert.equal(err.line, 0); 16 | assert.equal(err.col, 10); 17 | assert.equal(err.pos, 10); 18 | } 19 | }; 20 | 21 | exports.nonString = function () { 22 | assert.throws(function () { 23 | burrito.parse(new Buffer('[]')); 24 | }); 25 | 26 | assert.throws(function () { 27 | burrito.parse(new String('[]')); 28 | }); 29 | 30 | assert.throws(function () { 31 | burrito.parse(); 32 | }); 33 | }; 34 | 35 | exports.syntaxError = function () { 36 | try { 37 | var src = burrito('f() && g())', function (node) { 38 | if (node.name === 'binary') node.wrap('h(%a, %b)') 39 | }); 40 | assert.fail('should have blown up'); 41 | } 42 | catch (err) { 43 | assert.ok(err.message.match(/unexpected/i)); 44 | assert.ok(err instanceof SyntaxError); 45 | assert.ok(!err.stack.match(/uglify-js/)); 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/test/fail.js: -------------------------------------------------------------------------------- 1 | var burrito = require('../'); 2 | var assert = require('assert'); 3 | var fs = require('fs'); 4 | var src = fs.readFileSync(__dirname + '/fail/src.js', 'utf8'); 5 | 6 | exports.fail = function () { 7 | burrito(src, function (node) {}); 8 | }; 9 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/test/fail/src.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | 3 | module.exports = function(fs, ready) { 4 | var global_files = {} 5 | 6 | var recurse = function(dir, okay) { 7 | fs.readdir(dir, function(err, dir_files) { 8 | var countdown = 0 9 | , files = [] 10 | , dirs = [] 11 | , checked = 0 12 | dir_files.forEach(function(file, idx, all) { 13 | fs.stat(path.join(dir, file), function(err, stat) { 14 | if(stat.isDirectory() && !/node_modules/g.test(dir)) { 15 | dirs.push(file) 16 | } else if(/\.js$/g.test(file)) { 17 | files.push(file) 18 | } 19 | 20 | if(++checked >= dir_files.length) 21 | recurse_dirs() 22 | }) 23 | }) 24 | 25 | function recurse_dirs() { 26 | var total = 0 27 | dirs.forEach(function(this_dir) { 28 | recurse(path.join(dir, this_dir), function(err, data) { 29 | if(++total >= dirs.length) 30 | recurse_files() 31 | }) 32 | }) 33 | 34 | if(!dirs.length) 35 | recurse_files() 36 | } 37 | 38 | function recurse_files() { 39 | var total = 0 40 | files.forEach(function(file) { 41 | fs.readFile(path.join(dir, file), 'utf8', function(err, src) { 42 | global_files[path.join(dir, file)] = src 43 | ++total >= files.length && 44 | okay(null, global_files) 45 | }) 46 | }) 47 | 48 | if(!files.length) 49 | okay(null, global_files) 50 | } 51 | 52 | if(!dir_files.length) 53 | okay(null, global_files) 54 | }) 55 | } 56 | 57 | recurse('.', ready) 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/test/microwave.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var burrito = require('../'); 3 | 4 | exports.microwave = function () { 5 | var times = 0; 6 | var context = { 7 | f : function (x) { return x + 1 }, 8 | g : function (x) { return x + 2 }, 9 | h : function (x) { return x + 3 }, 10 | z : function (x) { 11 | times ++; 12 | return x * 10; 13 | }, 14 | }; 15 | 16 | var res = burrito.microwave('f(g(h(5)))', context, function (node) { 17 | if (node.name === 'call') { 18 | node.wrap(function (s) { 19 | return 'z(' + s + ')'; 20 | }); 21 | } 22 | }); 23 | 24 | assert.equal(res, (((((5 + 3) * 10) + 2) * 10) + 1) * 10); 25 | assert.equal(times, 3); 26 | }; 27 | 28 | exports.emptyContext = function () { 29 | var res = burrito.microwave('Math.sin(2)', function (node) { 30 | if (node.name === 'num') node.wrap('Math.PI / %s'); 31 | }); 32 | assert.equal(res, 1); 33 | }; 34 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/node_modules/burrito/test/parent.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var burrito = require('../'); 3 | 4 | exports.checkParent = function () { 5 | var src = 'Math.tan(0) + Math.sin(0)'; 6 | 7 | var res = burrito.microwave(src, function (node) { 8 | if (node.name === 'binary') { 9 | node.wrap('%a - %b'); 10 | } 11 | else if (node.name === 'num') { 12 | assert.equal(node.parent().value[0][0], 'dot'); 13 | 14 | var fn = node.parent().value[0][2]; 15 | if (fn === 'sin') { 16 | node.wrap('Math.PI / 2'); 17 | } 18 | else if (fn === 'tan') { 19 | node.wrap('Math.PI / 4'); 20 | } 21 | else assert.fail('Unknown fn'); 22 | } 23 | }); 24 | 25 | assert.equal(res, Math.tan(Math.PI / 4) - Math.sin(Math.PI / 2)); // ~ 0 26 | }; 27 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "bunker", 3 | "version" : "0.1.1", 4 | "description" : "code coverage in native javascript", 5 | "main" : "index.js", 6 | "directories" : { 7 | "lib" : ".", 8 | "example" : "example", 9 | "test" : "test" 10 | }, 11 | "dependencies" : { 12 | "burrito" : ">=0.2.5 <0.3" 13 | }, 14 | "devDependencies" : { 15 | "expresso" : "0.7.x" 16 | }, 17 | "scripts" : { 18 | "test" : "expresso" 19 | }, 20 | "repository" : { 21 | "type" : "git", 22 | "url" : "http://github.com/substack/node-bunker.git" 23 | }, 24 | "keywords" : [ 25 | "code", 26 | "coverage" 27 | ], 28 | "author" : { 29 | "name" : "James Halliday", 30 | "email" : "mail@substack.net", 31 | "url" : "http://substack.net" 32 | }, 33 | "license" : "MIT/X11", 34 | "engine" : { "node" : ">=0.4" } 35 | } 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/test/cover.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var bunker = require('../'); 3 | var fs = require('fs'); 4 | 5 | var src = fs.readdirSync(__dirname + '/src').reduce(function (acc, file) { 6 | acc[file] = fs.readFileSync(__dirname + '/src/' + file, 'utf8'); 7 | return acc; 8 | }, {}); 9 | 10 | exports.cover = function () { 11 | var b = bunker(src['cover.js']); 12 | var counts = {}; 13 | 14 | b.on('node', function (node) { 15 | counts[node.name] = (counts[node.name] || 0) + 1; 16 | }); 17 | 18 | b.run({ 19 | setInterval : setInterval, 20 | clearInterval : function () { 21 | process.nextTick(function () { 22 | assert.deepEqual(counts, { 23 | binary : 11, 24 | 'unary-postfix' : 11, 25 | 'var' : 2, 26 | call : 2, // setInterval and clearInterval 27 | stat : 1, // clearInterval 28 | }); 29 | }); 30 | 31 | return clearInterval.apply(this, arguments); 32 | }, 33 | console : console 34 | }); 35 | }; 36 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/node_modules/bunker/test/src/cover.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | var iv = setInterval(function () { 3 | if (i++ === 10) { 4 | clearInterval(iv); 5 | } 6 | }, 10); 7 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "runforcover", 3 | "version" : "0.0.2", 4 | "description" : "require plugin for js code coverage using bunker", 5 | "main" : "index.js", 6 | "directories" : { 7 | "lib" : ".", 8 | "test" : "test" 9 | }, 10 | "dependencies" : { 11 | "bunker" : "0.1.X" 12 | }, 13 | "scripts" : { 14 | "test" : "node test/index.js" 15 | }, 16 | "repository" : { 17 | "type" : "git", 18 | "url" : "http://github.com/chrisdickinson/node-runforcover.git" 19 | }, 20 | "keywords" : [ 21 | "code", 22 | "coverage", 23 | "bunker" 24 | ], 25 | "author" : { 26 | "name" : "Chris Dickinson", 27 | "email" : "chris@neversaw.us", 28 | "url" : "http://neversaw.us" 29 | }, 30 | "license" : "new BSD", 31 | "engine" : { "node" : ">=0.4" } 32 | } 33 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/test/index.js: -------------------------------------------------------------------------------- 1 | require('./interface').coverageInterface() 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/test/interface.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var runforcover = require('../'); 3 | 4 | exports.coverageInterface = function() { 5 | assert.ok(runforcover.cover); 6 | 7 | var originalRequire = require.extensions['.js']; 8 | 9 | var coverage = runforcover.cover(); 10 | 11 | assert.notEqual(originalRequire, require.extensions['.js']); 12 | 13 | var file = require('./src/coverage'); 14 | 15 | coverage(function(coverageData) { 16 | assert.equal(Object.keys(coverageData).length, 1); 17 | assert.equal(Object.keys(coverageData)[0], __dirname + '/src/coverage.js'); 18 | 19 | var fileCoverageData = coverageData[Object.keys(coverageData)[0]]; 20 | 21 | assert.ok(fileCoverageData.stats); 22 | assert.ok(fileCoverageData.missing); 23 | 24 | var stats = fileCoverageData.stats(); 25 | 26 | assert.ok(stats.percentage !== undefined); 27 | assert.ok(stats.lines !== undefined); 28 | assert.ok(stats.missing !== undefined); 29 | assert.ok(stats.seen !== undefined); 30 | 31 | assert.equal(stats.lines.length, 3); 32 | assert.equal(stats.lines[0].source(), ' if(a > 0) {'); 33 | assert.equal(stats.lines[1].source(), ' return a + 1;'); 34 | assert.equal(stats.lines[2].source(), ' return a - 1;'); 35 | 36 | file.something(1); 37 | stats = fileCoverageData.stats(); 38 | 39 | assert.equal(stats.lines.length, 1); 40 | assert.equal(stats.lines[0].source(), ' return a - 1;'); 41 | 42 | file.something(-1); 43 | stats = fileCoverageData.stats(); 44 | 45 | assert.equal(stats.lines.length, 0); 46 | 47 | coverage.release(); 48 | assert.equal(require.extensions['.js'], originalRequire); 49 | }); 50 | }; 51 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/runforcover/test/src/coverage.js: -------------------------------------------------------------------------------- 1 | exports.something = function(a) { 2 | if(a > 0) { 3 | return a + 1; 4 | } else { 5 | return a - 1; 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/README.md: -------------------------------------------------------------------------------- 1 | # Slide - a tiny flow control library 2 | 3 | Callbacks are simple and easy if you keep the pattern consistent. 4 | 5 | Check out the [slide presentation](http://github.com/isaacs/slide-flow-control/raw/master/nodejs-controlling-flow.pdf). 6 | 7 | You'll laugh when you see how little code is actually in this thing. 8 | It's so not-enterprisey, you won't believe it. It does almost nothing, 9 | but it's super handy. 10 | 11 | I actually use an earlier version of this util in 12 | [a real world program](http://npmjs.org/). 13 | 14 | ## Installation 15 | 16 | Just copy the files into your project, and use them that way, or 17 | you can do this: 18 | 19 | npm install slide 20 | 21 | and then: 22 | 23 | var asyncMap = require("slide").asyncMap 24 | , chain = require("slide").chain 25 | // use the power! 26 | 27 | Enjoy! 28 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/index.js: -------------------------------------------------------------------------------- 1 | module.exports=require("./lib/slide") 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/lib/async-map-ordered.js: -------------------------------------------------------------------------------- 1 | 2 | throw new Error("TODO: Not yet implemented.") 3 | 4 | /* 5 | usage: 6 | 7 | Like asyncMap, but only can take a single cb, and guarantees 8 | the order of the results. 9 | */ 10 | 11 | module.exports = asyncMapOrdered 12 | 13 | function asyncMapOrdered (list, fn, cb_) { 14 | if (typeof cb_ !== "function") throw new Error( 15 | "No callback provided to asyncMapOrdered") 16 | 17 | if (typeof fn !== "function") throw new Error( 18 | "No map function provided to asyncMapOrdered") 19 | 20 | if (list === undefined || list === null) return cb_(null, []) 21 | if (!Array.isArray(list)) list = [list] 22 | if (!list.length) return cb_(null, []) 23 | 24 | var errState = null 25 | , l = list.length 26 | , a = l 27 | , res = [] 28 | , resCount = 0 29 | , maxArgLen = 0 30 | 31 | function cb (index) { return function () { 32 | if (errState) return 33 | var er = arguments[0] 34 | var argLen = arguments.length 35 | maxArgLen = Math.max(maxArgLen, argLen) 36 | res[index] = argLen === 1 ? [er] : Array.apply(null, arguments) 37 | 38 | // see if any new things have been added. 39 | if (list.length > l) { 40 | var newList = list.slice(l) 41 | a += (list.length - l) 42 | var oldLen = l 43 | l = list.length 44 | process.nextTick(function () { 45 | newList.forEach(function (ar, i) { fn(ar, cb(i + oldLen)) }) 46 | }) 47 | } 48 | 49 | if (er || --a === 0) { 50 | errState = er 51 | cb_.apply(null, [errState].concat(flip(res, resCount, maxArgLen))) 52 | } 53 | }} 54 | // expect the supplied cb function to be called 55 | // "n" times for each thing in the array. 56 | list.forEach(function (ar) { 57 | steps.forEach(function (fn, i) { fn(ar, cb(i)) }) 58 | }) 59 | } 60 | 61 | function flip (res, resCount, argLen) { 62 | var flat = [] 63 | // res = [[er, x, y], [er, x1, y1], [er, x2, y2, z2]] 64 | // return [[x, x1, x2], [y, y1, y2], [undefined, undefined, z2]] 65 | 66 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/lib/async-map.js: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | usage: 4 | 5 | // do something to a list of things 6 | asyncMap(myListOfStuff, function (thing, cb) { doSomething(thing.foo, cb) }, cb) 7 | // do more than one thing to each item 8 | asyncMap(list, fooFn, barFn, cb) 9 | 10 | */ 11 | 12 | module.exports = asyncMap 13 | 14 | function asyncMap () { 15 | var steps = Array.prototype.slice.call(arguments) 16 | , list = steps.shift() || [] 17 | , cb_ = steps.pop() 18 | if (typeof cb_ !== "function") throw new Error( 19 | "No callback provided to asyncMap") 20 | if (!list) return cb_(null, []) 21 | if (!Array.isArray(list)) list = [list] 22 | var n = steps.length 23 | , data = [] // 2d array 24 | , errState = null 25 | , l = list.length 26 | , a = l * n 27 | if (!a) return cb_(null, []) 28 | function cb (er) { 29 | if (errState) return 30 | var argLen = arguments.length 31 | for (var i = 1; i < argLen; i ++) if (arguments[i] !== undefined) { 32 | data[i - 1] = (data[i - 1] || []).concat(arguments[i]) 33 | } 34 | // see if any new things have been added. 35 | if (list.length > l) { 36 | var newList = list.slice(l) 37 | a += (list.length - l) * n 38 | l = list.length 39 | process.nextTick(function () { 40 | newList.forEach(function (ar) { 41 | steps.forEach(function (fn) { fn(ar, cb) }) 42 | }) 43 | }) 44 | } 45 | 46 | if (er || --a === 0) { 47 | errState = er 48 | cb_.apply(null, [errState].concat(data)) 49 | } 50 | } 51 | // expect the supplied cb function to be called 52 | // "n" times for each thing in the array. 53 | list.forEach(function (ar) { 54 | steps.forEach(function (fn) { fn(ar, cb) }) 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/lib/bind-actor.js: -------------------------------------------------------------------------------- 1 | module.exports = bindActor 2 | function bindActor () { 3 | var args = 4 | Array.prototype.slice.call 5 | (arguments) // jswtf. 6 | , obj = null 7 | , fn 8 | if (typeof args[0] === "object") { 9 | obj = args.shift() 10 | fn = args.shift() 11 | if (typeof fn === "string") 12 | fn = obj[ fn ] 13 | } else fn = args.shift() 14 | return function (cb) { 15 | fn.apply(obj, args.concat(cb)) } 16 | } 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/lib/chain.js: -------------------------------------------------------------------------------- 1 | module.exports = chain 2 | var bindActor = require("./bind-actor.js") 3 | chain.first = {} ; chain.last = {} 4 | function chain (things, cb) { 5 | var res = [] 6 | ;(function LOOP (i, len) { 7 | if (i >= len) return cb(null,res) 8 | if (Array.isArray(things[i])) 9 | things[i] = bindActor.apply(null, 10 | things[i].map(function(i){ 11 | return (i===chain.first) ? res[0] 12 | : (i===chain.last) 13 | ? res[res.length - 1] : i })) 14 | if (!things[i]) return LOOP(i + 1, len) 15 | things[i](function (er, data) { 16 | if (er) return cb(er, res) 17 | if (data !== undefined) res = res.concat(data) 18 | LOOP(i + 1, len) 19 | }) 20 | })(0, things.length) } 21 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/lib/slide.js: -------------------------------------------------------------------------------- 1 | exports.asyncMap = require("./async-map") 2 | exports.bindActor = require("./bind-actor") 3 | exports.chain = require("./chain") 4 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/nodejs-controlling-flow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshwnj/statelet/1a7316f6ffbd091d528ad23844812e5334510f6d/tests/node_modules/tap/node_modules/slide/nodejs-controlling-flow.pdf -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/slide/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slide", 3 | "version": "1.1.3", 4 | "author": "Isaac Z. Schlueter (http://blog.izs.me/)", 5 | "contributors": [ 6 | "S. Sriram (http://www.565labs.com)" 7 | ], 8 | "description": "A flow control lib small enough to fit on in a slide presentation. Derived live at Oak.JS", 9 | "main": "./lib/slide.js", 10 | "dependencies": {}, 11 | "devDependencies": {}, 12 | "engines": { 13 | "node": "*" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git://github.com/isaacs/slide-flow-control.git" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/yamlish/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Isaac Z. Schlueter 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/yamlish/README.md: -------------------------------------------------------------------------------- 1 | This is a thingie to parse the "yamlish" format used to serialize 2 | objects in the TAP format. 3 | 4 | It's like yaml, but just a tiny little bit smaller. 5 | 6 | Usage: 7 | 8 | var yamlish = require("yamlish") 9 | // returns a string like: 10 | /* 11 | some: 12 | object: 13 | - full 14 | - of 15 | pretty: things 16 | */ 17 | yamlish.encode({some:{object:["full", "of"]}, pretty:"things"}) 18 | 19 | // returns the object 20 | yamlish.decode(someYamlishString) 21 | -------------------------------------------------------------------------------- /tests/node_modules/tap/node_modules/yamlish/package.json: -------------------------------------------------------------------------------- 1 | { "name" : "yamlish" 2 | , "description" : "Parser/encoder for the yamlish format" 3 | , "repository":"https://github.com/isaacs/yamlish" 4 | , "version" : "0.0.4" 5 | , "main" : "yamlish.js" 6 | , "keywords" : [ "yaml", "yamlish", "test", "anything", "protocol", "tap"] 7 | , "license" : { "type" : "MIT" 8 | , "url" : "http://github.com/isaacs/yamlish/raw/master/LICENSE" } 9 | , "author" : "Isaac Z. Schlueter (http://blog.izs.me/)" } 10 | -------------------------------------------------------------------------------- /tests/node_modules/tap/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tap", 3 | "version": "0.2.3", 4 | "author": "Isaac Z. Schlueter (http://blog.izs.me)", 5 | "description": "A Test-Anything-Protocol library", 6 | "bin": "bin/tap.js", 7 | "main": "lib/main.js", 8 | "dependencies": { 9 | "inherits": "*", 10 | "yamlish": "*", 11 | "slide": "*", 12 | "runforcover": "~0.0.2", 13 | "nopt": "~1.0.10", 14 | "mkdirp": "~0.2.2", 15 | "difflet" : "0.2.0", 16 | "deep-equal" : "~0.0.0" 17 | }, 18 | "bundledDependencies": [ 19 | "inherits", 20 | "tap-consumer", 21 | "yamlish" 22 | ], 23 | "keywords": [ 24 | "assert", 25 | "test", 26 | "tap" 27 | ], 28 | "contributors": [ 29 | "Isaac Z. Schlueter (http://blog.izs.me)", 30 | "baudehlo " 31 | ], 32 | "license": { 33 | "type": "MIT", 34 | "url": "https://github.com/isaacs/node-tap/raw/master/LICENSE" 35 | }, 36 | "repository": "git://github.com/isaacs/node-tap.git", 37 | "scripts": { 38 | "test": "bin/tap.js test" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test-disabled/bailout.js: -------------------------------------------------------------------------------- 1 | var tap = require("tap") 2 | , test = tap.test 3 | 4 | test("bailout test", { skip: false }, function (t) { 5 | 6 | // t.once("bailout", function () { 7 | // console.error("bailout event")//, t) 8 | // t.clear() 9 | // }) 10 | 11 | // t.once("end", function () { 12 | // console.error("end event") 13 | // }) 14 | 15 | // simulate three tests where the second bails out. 16 | t.test("first", function (t) { 17 | t.pass("this is ok") 18 | t.end() 19 | }) 20 | 21 | t.test("bailout", function (t) { 22 | console.error("bailout test") 23 | t.pass("pass") 24 | t.bailout("bail out message") 25 | t.fail("fail") 26 | t.end() 27 | }) 28 | 29 | t.test("second (should not happen)", function (t) { 30 | t.fail("this should not happen") 31 | t.end() 32 | }) 33 | 34 | t.end() 35 | 36 | }) 37 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test-disabled/foo.js: -------------------------------------------------------------------------------- 1 | process.stdin 2 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test-disabled/t.js: -------------------------------------------------------------------------------- 1 | var test = require('tap').test; 2 | 3 | function foo() { 4 | throw new Error('one'); 5 | } 6 | 7 | test('demonstrate bug in t.throws', function (t) { 8 | t.throws( 9 | function () { 10 | foo(); 11 | }, 12 | new Error('two')), 13 | // "this should throw", 14 | // {}); // not 'one'! 15 | t.end(); 16 | }); 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/common.js: -------------------------------------------------------------------------------- 1 | exports.taps = ["Tests for the foo module" 2 | ,{ok:true, name:"test that the foo is fooish" 3 | ,file:"foo.js", line:8, name:"fooish test" 4 | ,stack:new Error("fooish").stack} 5 | ,{ok:false, name:"a test that the bar is barish" 6 | ,file:"bar.js", line:25 7 | ,expected:"bar\nbar\nbaz", actual:"rab\nrib\nzib" 8 | ,hash:{more:"\nstuff\nhere\n",regexp:/asdf/}} 9 | ,"Quux module tests" 10 | ,"This is a longer comment" 11 | ,{ok:true, name:"an easy one."} 12 | ,{ok:false, name:"bloooooo" 13 | ,expected:"blerggeyyy" 14 | ,actual:"blorggeyy"} 15 | ,{ok:false, name:"array test" 16 | ,expected:[{ok:true},{ok:true},{stack:new Error().stack}] 17 | ,actual:[1234567890,123456789,{error:new Error("yikes")}]} 18 | ,{ok:true, name:"nulltest" 19 | ,expected:undefined, actual:null} 20 | ,{ok:true, name:"weird key test" 21 | ,expected:"weird key" 22 | ,actual:"weird key" 23 | ,"this object":{"has a ":"weird key" 24 | ,"and a looooooooonnnnnnnnnggg":"jacket"}} 25 | ,{ok:true, name:"regexp test" 26 | ,regexp:/asdf/,function:function (a,b) { return a + b }} 27 | ] 28 | 29 | if (require.main === module) { 30 | console.log("1..1") 31 | console.log("ok 1 - just setup, nothing relevant") 32 | } 33 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/deep.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | , test = tap.test 3 | 4 | test("deepEquals shouldn't care about key order", function (t) { 5 | t.deepEqual({ a : 1, b : 2 }, { b : 2, a : 1 }) 6 | t.end() 7 | }) 8 | 9 | test("deepEquals shouldn't care about key order recursively", function (t) { 10 | t.deepEqual( 11 | { x : { a : 1, b : 2 }, y : { c : 3, d : 4 } }, 12 | { y : { d : 4, c : 3 }, x : { b : 2, a : 1 } } 13 | ) 14 | t.end() 15 | }) 16 | 17 | test("deepEquals shoudn't care about key order but still might", function (t) { 18 | t.deepEqual( 19 | [ { foo: 20 | { z: 100 21 | , y: 200 22 | , x: 300 } } 23 | , "bar" 24 | , 11 25 | , { baz: 26 | { d : 4 27 | , a: 1 28 | , b: 2 29 | , c: 3 } } ] 30 | , [ { foo : 31 | { z: 100 32 | , y: 200 33 | , x: 300 } } 34 | , "bar" 35 | , 11 36 | , { baz: 37 | { a: 1 38 | , b: 2 39 | , c: 3 40 | , d: 4 } } ] 41 | ) 42 | t.end() 43 | }); 44 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/independent-timeouts.js: -------------------------------------------------------------------------------- 1 | // https://github.com/isaacs/node-tap/issues/23 2 | 3 | var tap = require("../") 4 | , test = tap.test 5 | 6 | test("finishes in time", {timeout: 500}, function(t) { 7 | setTimeout(function () { 8 | t.end(); 9 | }, 300); 10 | }) 11 | test("finishes in time too", {timeout: 500}, function(t) { 12 | setTimeout(function () { 13 | t.end(); 14 | }, 300); 15 | }) 16 | 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/isolated-conf-test.js: -------------------------------------------------------------------------------- 1 | // https://github.com/isaacs/node-tap/issues/24 2 | 3 | var tap = require("../") 4 | , test = tap.test 5 | 6 | var config = {foo: "bar"} 7 | test("one", config, function(t) { 8 | t.equal(t.conf.foo, "bar") 9 | t.equal(t.conf.name, "one") // before fix this would be "two" 10 | t.end() 11 | }) 12 | test("two", config, function(t) { 13 | t.equal(t.conf.foo, "bar") 14 | t.equal(t.conf.name, "two") 15 | t.end() 16 | }) 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/meta-test.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | , test = tap.test 3 | 4 | test("meta test", { skip: false }, function (t) { 5 | 6 | function thr0w() { throw new Error('raburt') } 7 | function noop () {} 8 | 9 | // this also tests the ok/notOk functions 10 | t.once("end", section2) 11 | t.ok(true, "true is ok") 12 | t.ok(noop, "function is ok") 13 | t.ok({}, "object is ok") 14 | t.ok(t, "t is ok") 15 | t.ok(100, "number is ok") 16 | t.ok("asdf", "string is ok") 17 | t.notOk(false, "false is notOk") 18 | t.notOk(0, "0 is notOk") 19 | t.notOk(null, "null is notOk") 20 | t.notOk(undefined, "undefined is notOk") 21 | t.notOk(NaN, "NaN is notOk") 22 | t.notOk("", "empty string is notOk") 23 | t.throws(thr0w, "Thrower throws"); 24 | t.doesNotThrow(noop, "noop does not throw"); 25 | t.similar({foo:"bar", bar:"foo"}, {foo:"bar"}, "similar objects are ok"); 26 | t.dissimilar({}, {mandatory:"value"}, "dissimilar objects are ok"); 27 | t.dissimilar(null, {}, "null is dissimilar from an object, even with no keys"); 28 | 29 | // a few failures. 30 | t.ifError(new Error("this is an error")) 31 | t.ifError({ message: "this is a custom error" }) 32 | t.ok(false, "false is not ok") 33 | t.notOk(true, "true is not not ok") 34 | t.similar(null, {}, "Null is not similar to an object, even with no keys"); 35 | t.throws(noop, "noop does not throw"); 36 | t.throws(noop, new Error("Whoops!"), "noop does not throw an Error"); 37 | t.throws(noop, {name:"MyError", message:"Whoops!"}, "noop does not throw a MyError"); 38 | t.doesNotThrow(thr0w, "thrower does throw"); 39 | t.end() 40 | 41 | function section2 () { 42 | var results = t.results 43 | t.clear() 44 | t.ok(true, "sanity check") 45 | t.notOk(results.ok, "not ok") 46 | t.equal(results.tests, 26, "total test count") 47 | t.equal(results.passTotal, 17, "tests passed") 48 | t.equal(results.fail, 9, "tests failed") 49 | t.type(results.ok, "boolean", "ok is boolean") 50 | t.type(results.skip, "number", "skip is number") 51 | t.type(results, "Results", "results isa Results") 52 | t.type(t, "Test", "test isa Test") 53 | t.type(t, "Harness", "test isa Harness") 54 | t.end() 55 | } 56 | }) 57 | 58 | 59 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/nested-test.js: -------------------------------------------------------------------------------- 1 | var tap = require("../"), 2 | test = tap.test, 3 | util = require('util'); 4 | 5 | test("parent", function (t) { 6 | // TODO: Make grandchildren tests count? 7 | t.plan(3); 8 | t.ok(true, 'p test'); 9 | t.test("subtest", function (t) { 10 | t.ok(true, 'ch test'); 11 | t.test('nested subtest', function(t) { 12 | t.ok(true, 'grch test'); 13 | t.end(); 14 | }); 15 | t.end(); 16 | }); 17 | t.test('another subtest', function(t) { 18 | t.ok(true, 'ch test 2'); 19 | t.end(); 20 | }); 21 | t.end(); 22 | }) 23 | 24 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/non-tap-output.js: -------------------------------------------------------------------------------- 1 | console.log("everything is fine\n" 2 | +"there are no errors\n" 3 | +"this output is not haiku.\n\n" 4 | +"is 8 ok?\n" 5 | +"ok, 8 can stay.\n" 6 | +"ok 100 might be confusing\n" 7 | +" but: nevertheless, here we are\n" 8 | +" this: is indented\n" 9 | +" and: it\n" 10 | +" might: ~\n" 11 | +" be: yaml?\n" 12 | +"ok done now, exiting") 13 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/result-trap.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | 3 | tap.test("trap result #TODO", function (t0) { 4 | 5 | console.log("not ok 1 result event trapping #TODO") 6 | return t0.end() 7 | 8 | t0.plan(3) 9 | 10 | var t1 = new(tap.Harness)(tap.Test).test() 11 | 12 | t1.plan(1) 13 | 14 | t1.on("result", function (res) { 15 | if (res.wanted === 4) { 16 | t0.equal(res.found, 3) 17 | t0.equal(res.wanted, 4) 18 | 19 | t0.end() 20 | t1.end() 21 | } 22 | }) 23 | 24 | t1.equal(1 + 2, 4) 25 | }) 26 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/simple-harness-test-with-plan.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | , test = tap.test 3 | , plan = tap.plan 4 | 5 | plan(2) 6 | 7 | test("trivial success", function (t) { 8 | t.ok(true, "it works") 9 | t.end() 10 | }) 11 | 12 | test("two tests", function (t) { 13 | t.equal(255, 0xFF, "math should work") 14 | t.notOk(false, "false should not be ok") 15 | t.end() 16 | }) 17 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/simple-harness-test.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | , test = tap.test 3 | 4 | test("trivial success", function (t) { 5 | t.ok(true, "it works") 6 | t.end() 7 | }) 8 | 9 | test("two tests", function (t) { 10 | t.equal(255, 0xFF, "math should work") 11 | t.notOk(false, "false should not be ok") 12 | t.end() 13 | }) 14 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/test-test.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | , test = tap.test 3 | , Test = require("../lib/tap-test") 4 | , Harness = require("../lib/tap-harness") 5 | 6 | test("testing the test object", function (t) { 7 | 8 | t.isa(t, Test, "test object should be instanceof Test") 9 | t.isa(t, Harness, "test object should be instanceof Harness") 10 | t.is(t._Test, Test, "test._Test should be the Test class") 11 | 12 | // now test all the methods. 13 | ; [ "isNotDeepEqual" 14 | , "equals" 15 | , "inequivalent" 16 | , "threw" 17 | , "strictEqual" 18 | , "emit" 19 | , "fail" 20 | , "strictEquals" 21 | , "notLike" 22 | , "dissimilar" 23 | , "true" 24 | , "assert" 25 | , "is" 26 | , "ok" 27 | , "isEqual" 28 | , "isDeeply" 29 | , "deepEqual" 30 | , "deepEquals" 31 | , "pass" 32 | , "length" 33 | , "skip" 34 | , "isNotEqual" 35 | , "looseEquals" 36 | , "false" 37 | , "notDeeply" 38 | , "ifErr" 39 | , "hasFields" 40 | , "isNotDeeply" 41 | , "like" 42 | , "similar" 43 | , "notOk" 44 | , "isDissimilar" 45 | , "isEquivalent" 46 | , "doesNotEqual" 47 | , "isSimilar" 48 | , "notDeepEqual" 49 | , "type" 50 | , "notok" 51 | , "isInequivalent" 52 | , "isNot" 53 | , "same" 54 | , "isInequal" 55 | , "_endNice" 56 | , "ifError" 57 | , "iferror" 58 | , "clear" 59 | , "has" 60 | , "not" 61 | , "timeout" 62 | , "notSimilar" 63 | , "isUnlike" 64 | , "notEquals" 65 | , "unsimilar" 66 | , "result" 67 | , "doesNotThrow" 68 | , "error" 69 | , "constructor" 70 | , "notEqual" 71 | , "throws" 72 | , "isLike" 73 | , "isNotSimilar" 74 | , "isNotEquivalent" 75 | , "inequal" 76 | , "notEquivalent" 77 | , "isNotLike" 78 | , "equivalent" 79 | , "looseEqual" 80 | , "equal" 81 | , "unlike" 82 | , "doesNotHave" 83 | , "comment" 84 | , "isa" 85 | ].forEach(function (method) { 86 | t.ok(t[method], "should have "+method+" method") 87 | t.isa(t[method], "function", method+" method should be a function") 88 | }) 89 | t.end() 90 | }) 91 | 92 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/timeout.js: -------------------------------------------------------------------------------- 1 | var tap = require("../") 2 | 3 | tap.test("timeout test with plan only", function (t) { 4 | console.error("timeout test") 5 | t.plan(2) 6 | console.error("t.plan="+t._plan) 7 | setTimeout(function () { 8 | console.error("a assert") 9 | t.ok(true, "a") 10 | }, 1000) 11 | setTimeout(function () { 12 | console.error("b assert") 13 | t.ok(true, "b") 14 | }, 1000) 15 | }) 16 | 17 | tap.test("timeout test with plan and end", function (t) { 18 | console.error("timeout test") 19 | t.plan(2) 20 | 21 | var tc = 2 22 | console.error("t.plan="+t._plan) 23 | setTimeout(function () { 24 | console.error("a assert") 25 | t.ok(true, "a") 26 | if (-- tc === 0) t.end() 27 | }, 1000) 28 | setTimeout(function () { 29 | console.error("b assert") 30 | t.ok(true, "b") 31 | if (-- tc === 0) t.end() 32 | }, 1000) 33 | }) 34 | -------------------------------------------------------------------------------- /tests/node_modules/tap/test/trivial-success.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshwnj/statelet/1a7316f6ffbd091d528ad23844812e5334510f6d/tests/node_modules/tap/test/trivial-success.js --------------------------------------------------------------------------------