├── .gitignore ├── .jshintrc ├── CHANGES.md ├── CONTRIBUTING.md ├── CPAL-1.0.md ├── LICENSE ├── README.md ├── benchmarks ├── benchmark.js ├── express_app │ ├── package.json │ └── server.js └── run_bench.sh ├── docs.json ├── examples.md ├── index.js ├── lib ├── debug.js ├── error.js ├── isv010.js ├── linked-list.js ├── non-error.js ├── raw-debug.js ├── scheduler.js ├── setup.js ├── uid.js ├── wrappers │ ├── binding.js │ ├── binding │ │ ├── cares_wrap.js │ │ ├── fs.js │ │ ├── process_wrap.js │ │ ├── stream_wrap.js │ │ └── zlib.js │ ├── dom-globals.js │ ├── node-lib │ │ ├── _http_agent.js │ │ ├── dns.js │ │ ├── events.js │ │ ├── http.js │ │ ├── native_module.js │ │ ├── stream.js │ │ └── zlib.js │ ├── process.js │ └── require.js ├── zone-callback.js └── zone.js ├── package.json ├── showcase ├── README.md ├── curl │ ├── README.md │ ├── curl-naive.js │ └── curl-zone.js ├── inspect │ ├── README.md │ ├── demo.js │ └── inspect.js ├── long-stack-http │ ├── README.md │ └── demo.js └── long-stack │ ├── README.md │ ├── long-stack.js │ └── short-stack.js └── test ├── assets ├── file1 └── file2 ├── node-tests ├── common.js ├── fixtures │ ├── GH-1899-output.js │ ├── GH-892-request.js │ ├── a.js │ ├── a1.js │ ├── agent.crt │ ├── agent.key │ ├── alice.crt │ ├── b │ │ ├── c.js │ │ ├── d.js │ │ └── package │ │ │ └── index.js │ ├── break-in-module │ │ ├── main.js │ │ └── mod.js │ ├── breakpoints.js │ ├── breakpoints_utf8.js │ ├── catch-stdout-error.js │ ├── cert.pem │ ├── child-process-message-and-exit.js │ ├── child-process-persistent.js │ ├── child-process-spawn-node.js │ ├── child_process_should_emit_error.js │ ├── create-file.js │ ├── cycles │ │ ├── folder │ │ │ └── foo.js │ │ └── root.js │ ├── debug-target.js │ ├── deprecated.js │ ├── destroy-stdin.js │ ├── echo-close-check.js │ ├── echo.js │ ├── elipses.txt │ ├── empty.js │ ├── empty.txt │ ├── empty │ │ └── .gitkeep │ ├── exit.js │ ├── fixture.ini │ ├── foafssl.crt │ ├── foafssl.key │ ├── foo │ ├── global │ │ └── plain.js │ ├── invalid.json │ ├── keys │ │ ├── Makefile │ │ ├── agent1-cert.pem │ │ ├── agent1-csr.pem │ │ ├── agent1-key.pem │ │ ├── agent1.cnf │ │ ├── agent2-cert.pem │ │ ├── agent2-csr.pem │ │ ├── agent2-key.pem │ │ ├── agent2.cnf │ │ ├── agent3-cert.pem │ │ ├── agent3-csr.pem │ │ ├── agent3-key.pem │ │ ├── agent3.cnf │ │ ├── agent4-cert.pem │ │ ├── agent4-csr.pem │ │ ├── agent4-key.pem │ │ ├── agent4.cnf │ │ ├── ca1-cert.pem │ │ ├── ca1-cert.srl │ │ ├── ca1-key.pem │ │ ├── ca1.cnf │ │ ├── ca2-cert.pem │ │ ├── ca2-cert.srl │ │ ├── ca2-crl.pem │ │ ├── ca2-database.txt │ │ ├── ca2-key.pem │ │ ├── ca2-serial │ │ └── ca2.cnf │ ├── module-load-order │ │ ├── file1 │ │ ├── file1.js │ │ ├── file1.node │ │ ├── file1.reg │ │ ├── file1.reg2 │ │ ├── file2.js │ │ ├── file2.node │ │ ├── file2.reg │ │ ├── file2.reg2 │ │ ├── file2 │ │ │ ├── index.js │ │ │ ├── index.node │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ ├── file3.node │ │ ├── file3.reg │ │ ├── file3.reg2 │ │ ├── file3 │ │ │ ├── index.js │ │ │ ├── index.node │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ ├── file4.reg │ │ ├── file4.reg2 │ │ ├── file4 │ │ │ ├── index.js │ │ │ ├── index.node │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ ├── file5.reg2 │ │ ├── file5 │ │ │ ├── index.js │ │ │ ├── index.node │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ ├── file6 │ │ │ ├── index.js │ │ │ ├── index.node │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ ├── file7 │ │ │ ├── index.node │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ ├── file8 │ │ │ ├── index.reg │ │ │ └── index.reg2 │ │ └── file9 │ │ │ └── index.reg2 │ ├── module-loading-error.node │ ├── module-require │ │ ├── child │ │ │ └── index.js │ │ └── parent │ │ │ └── index.js │ ├── msca.pem │ ├── multi-alice.crt │ ├── nested-index │ │ ├── one │ │ │ ├── hello.js │ │ │ └── index.js │ │ ├── three.js │ │ ├── three │ │ │ └── index.js │ │ └── two │ │ │ ├── hello.js │ │ │ └── index.js │ ├── net-fd-passing-receiver.js │ ├── not-main-module.js │ ├── packages │ │ ├── main-index │ │ │ ├── package-main-module │ │ │ │ └── index.js │ │ │ └── package.json │ │ └── main │ │ │ ├── package-main-module.js │ │ │ └── package.json │ ├── parent-process-nonpersistent.js │ ├── pass-cert.pem │ ├── pass-csr.pem │ ├── pass-key.pem │ ├── person.jpg │ ├── person.jpg.gz │ ├── print-10-lines.js │ ├── print-chars-from-buffer.js │ ├── print-chars.js │ ├── readdir │ │ ├── are │ │ ├── dir │ │ │ └── empty │ │ ├── empty │ │ ├── files │ │ ├── for │ │ ├── just │ │ ├── testing.js │ │ └── these │ ├── recvfd.js │ ├── registerExt.hello.world │ ├── registerExt.test │ ├── registerExt2.test │ ├── sample.png │ ├── semicolon.js │ ├── should_exit.js │ ├── stdio-filter.js │ ├── test-fs-readfile-error.js │ ├── test-init-index │ │ └── index.js │ ├── test-init-native │ │ └── fs.js │ ├── test-regress-GH-4015.js │ ├── test_ca.pem │ ├── test_cert.pem │ ├── test_cert.pfx │ ├── test_dsa_params.pem │ ├── test_dsa_privkey.pem │ ├── test_dsa_pubkey.pem │ ├── test_key.pem │ ├── test_rsa_privkey.pem │ ├── test_rsa_privkey_2.pem │ ├── test_rsa_pubkey.pem │ ├── test_rsa_pubkey_2.pem │ ├── throws_error.js │ ├── throws_error1.js │ ├── throws_error2.js │ ├── throws_error3.js │ ├── utf8-bom.js │ ├── utf8-bom.json │ ├── x.txt │ └── x1024.txt ├── simple │ ├── test-zlib-close-after-write.js │ ├── test-zlib-dictionary-fail.js │ ├── test-zlib-dictionary.js │ ├── test-zlib-from-gzip.js │ ├── test-zlib-from-string.js │ ├── test-zlib-invalid-input.js │ ├── test-zlib-random-byte-pipes.js │ ├── test-zlib-write-after-close.js │ ├── test-zlib-write-after-flush.js │ ├── test-zlib-zero-byte.js │ └── test-zlib.js └── tmp │ └── .gitignore ├── run-tests.js └── zone-tests ├── _common.js ├── test-after-task.js ├── test-async-event-cleanup.js ├── test-before-task-with-error.js ├── test-before-task.js ├── test-callback-auto-exit.js ├── test-callback-catch.js ├── test-callback-errback-with-error.js ├── test-callback-errback-with-result.js ├── test-callback-then-with-error.js ├── test-callback-then-with-success.js ├── test-callback-throw-non-error.js ├── test-child-process-exec-error.js ├── test-child-process-exec.js ├── test-child-process-spawn-cleanup.js ├── test-clean-exit-waits-for-fs-stat.js ├── test-clean-exit-waits-for-timeout.js ├── test-dns-lookup.js ├── test-dns-resolve-localhost-in-zone.js ├── test-dns-resolve4.js ├── test-dns-resolve6-in-zone.js ├── test-dns-reverse.js ├── test-ee-add-remove-listener.js ├── test-ee-emit-once.js ├── test-ee-in-root-zone.js ├── test-ee-x-zone-1.js ├── test-ee-x-zone-2.js ├── test-ee-x-zone-3.js ├── test-error-catch.js ├── test-error-exit-cancels-timeout.js ├── test-error-exit-waits-for-fs-stat.js ├── test-error-propogation.js ├── test-event-emitter-cleanup.js ├── test-fd-auto-close-on-error.js ├── test-fd-auto-close.js ├── test-http-agent-patching.js ├── test-linked-list-head.js ├── test-linked-list-push-pop.js ├── test-linked-list-remove.js ├── test-linked-list-shift-unshift.js ├── test-linked-list-tail.js ├── test-require-module.js ├── test-simple-cleanup.js ├── test-stream-write-callbacks.js ├── test-stream-write-from-root.js └── test-stream-write-from-zone.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.orig 2 | node_modules 3 | docs 4 | npm-debug.log 5 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ "zone" ] 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) IBM Corp. 2014,2016. All Rights Reserved. 2 | Node module: zone 3 | This project is licensed under the MIT License, full text below. 4 | 5 | -------- 6 | 7 | MIT license 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /benchmarks/benchmark.js: -------------------------------------------------------------------------------- 1 | var rounds = 1e7; 2 | var name = ''; 3 | var itrLeft = 0; 4 | var start = 0; 5 | var benchFunc = null; 6 | 7 | exports.startBenchmark = function(name_, benchFunc_) { 8 | benchFunc = benchFunc_; 9 | itrLeft = rounds; 10 | name = name_; 11 | start = Date.now(); 12 | benchFunc(next); 13 | }; 14 | 15 | function next() { 16 | if (!--itrLeft) 17 | return done(); 18 | benchFunc(next); 19 | } 20 | 21 | function done() { 22 | var end = Date.now(); 23 | var perSec = rounds / (end - start) * 1000; 24 | console.log('ops/sec: %d (' + name + ')', perSec); 25 | } 26 | -------------------------------------------------------------------------------- /benchmarks/express_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "body-parser": "~1.0.1", 4 | "express": "~4.0.0", 5 | "mongoose": "~3.6.13" 6 | }, 7 | "main": "server.js", 8 | "name": "express-app" 9 | } 10 | -------------------------------------------------------------------------------- /benchmarks/express_app/server.js: -------------------------------------------------------------------------------- 1 | require('../../lib/setup.js').enable(); 2 | express = require('express'); 3 | var app = express(); 4 | var bodyParser = require('body-parser'); 5 | Error.stackTraceLimit = 0; 6 | 7 | app.use(function(req, res, next) { 8 | zone.create(function RequestZone() { 9 | zone.data.url = req.url; 10 | next(); 11 | }).catch (function(err) { 12 | console.error(err); 13 | }); 14 | }); 15 | 16 | app.use(bodyParser()); 17 | var router = express.Router(); 18 | 19 | router.get('/', function(req, res) { 20 | res.json({ 21 | // zone: zone.name, 22 | message: 'Hello world' 23 | }); 24 | }); 25 | 26 | app.use('/api', router); 27 | app.listen(3001); 28 | -------------------------------------------------------------------------------- /benchmarks/run_bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | node ./base-next-tick.js 3 | node ./zoned-next-tick.js 4 | node ./create-zone.js 5 | 6 | which gobench 1> /dev/null 2> /dev/null 7 | if [ $? -ne 0 ]; then 8 | echo -e "\n"; 9 | echo "Unable to perform additional benchmarks."; 10 | echo "Please install gobench (go get github.com/cmpxchg16/gobench)"; 11 | echo "and ensure that it is available on the \$PATH"; 12 | exit 0; 13 | fi 14 | 15 | node ./basic-server.js & 16 | sleep 1 17 | gobench -c=200 -k=true -r=501 -u="http://127.0.0.1:3001" 2>/dev/null 1>/dev/null 18 | sleep 1 19 | node ./basic-server-with-zones.js & 20 | sleep 1 21 | gobench -c=200 -k=true -r=501 -u="http://127.0.0.1:3001" 2>/dev/null 1>/dev/null 22 | sleep 1 23 | node ./zoned-server.js & 24 | sleep 1 25 | gobench -c=200 -k=true -r=501 -u="http://127.0.0.1:3001" 2>/dev/null 1>/dev/null 26 | -------------------------------------------------------------------------------- /docs.json: -------------------------------------------------------------------------------- 1 | { 2 | "content": [ 3 | {"title": "Zone API", "depth": 2}, 4 | "lib/zone.js" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/setup.js'); 2 | -------------------------------------------------------------------------------- /lib/debug.js: -------------------------------------------------------------------------------- 1 | var isWindows = process.platform === 'win32'; 2 | var net = require('net'); 3 | var path = require('path'); 4 | var prefix = isWindows ? '\\\\?\\pipe' : '/tmp'; 5 | var util = require('util'); 6 | var Zone = zone.Zone; 7 | 8 | zone.create(function DebugServerZone() { 9 | var pipeName = prefix + path.sep + '%node-zone-debug-' + process.pid; 10 | 11 | var server = net.createServer({allowHalfOpen: true}); 12 | 13 | server.listen(pipeName); 14 | server._handle.unref(); 15 | 16 | server.on('connection', function(conn) { 17 | var header = util.format('(%d) %s\n', process.pid, process.argv.join(' ')); 18 | conn.write(header); 19 | 20 | var root = zone.root; 21 | if (!root) 22 | conn.end('No zones.\n\n'); 23 | else 24 | conn.end(root.dump()); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /lib/error.js: -------------------------------------------------------------------------------- 1 | var Zone = global.zone.Zone; 2 | 3 | function getZoneStack() { 4 | var r = this.stack; 5 | var z; 6 | if (Zone.longStackSupport) { 7 | for (z = this.zone; z && z.parent; z = z.parent) { 8 | r += '\nIn zone: ' + z.stack; 9 | } 10 | } else { 11 | for (z = this.zone; z && z.parent; z = z.parent) { 12 | r += '\nIn zone: ' + z.name; 13 | } 14 | 15 | r += '\n\nNote: Long stack trace is disabled. ' + 16 | 'SET NODE_ENV=development or set Zone.longStackSupport=true to enable it.\n'; 17 | } 18 | 19 | return r; 20 | } 21 | 22 | Object.defineProperty(Error.prototype, 'zoneStack', {get: getZoneStack}); 23 | -------------------------------------------------------------------------------- /lib/isv010.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = /^v0\.10\./.test(process.version); 3 | -------------------------------------------------------------------------------- /lib/linked-list.js: -------------------------------------------------------------------------------- 1 | module.exports = LinkedList; 2 | 3 | function LinkedListIterator(list, head, tail) { 4 | this._list = list; 5 | this._head = head; 6 | this._tail = tail; 7 | this.current = list; 8 | 9 | this.prev = function prev() { 10 | this.current = this.current.prev; 11 | if (this.current && this.current !== this._list) { 12 | return this.current.value; 13 | } else { 14 | this.current = null; 15 | return null; 16 | } 17 | }; 18 | 19 | this.next = function next() { 20 | this.current = this.current.next; 21 | if (this.current && this.current !== this._list) { 22 | return this.current.value; 23 | } else { 24 | this.current = null; 25 | return null; 26 | } 27 | }; 28 | } 29 | 30 | function ListItem(object, prev, next) { 31 | this.value = object; 32 | this.prev = prev; 33 | this.next = next; 34 | } 35 | 36 | function LinkedList(name) { 37 | this.prev = this; // tail 38 | this.next = this; // head 39 | this.name = name; 40 | 41 | this.push = function push(object) { 42 | if (this.empty()) { 43 | this.next = this.prev = new ListItem(object, this, this); 44 | } else { 45 | var newEntry = new ListItem(object, this.prev, this); 46 | this.prev.next = newEntry; 47 | this.prev = newEntry; 48 | } 49 | }; 50 | 51 | this.unshift = function unshift(object) { 52 | if (this.empty()) { 53 | this.next = this.prev = new ListItem(object, this, this); 54 | } else { 55 | var newEntry = new ListItem(object, this, this.next); 56 | this.next.prev = newEntry; 57 | this.next = newEntry; 58 | } 59 | }; 60 | 61 | this.pop = function pop() { 62 | if (this.empty()) { 63 | return null; 64 | } else { 65 | var entry = this.prev; 66 | if (entry.prev === this) { 67 | this.next = this; 68 | this.prev = this; 69 | } else { 70 | this.prev = entry.prev; 71 | } 72 | 73 | return entry.value; 74 | } 75 | }; 76 | 77 | this.shift = function shift() { 78 | if (this.empty()) { 79 | return null; 80 | } else { 81 | var entry = this.next; 82 | if (entry.next === this) { 83 | this.next = this; 84 | this.prev = this; 85 | } else { 86 | this.next = entry.next; 87 | } 88 | 89 | return entry.value; 90 | } 91 | }; 92 | 93 | this.tail = function tail() { 94 | if (this.empty()) { 95 | return null; 96 | } else { 97 | return this.prev.value; 98 | } 99 | }; 100 | 101 | this.head = function head() { 102 | if (this.empty()) { 103 | return null; 104 | } else { 105 | return this.next.value; 106 | } 107 | }; 108 | 109 | this.empty = function empty() { return this.next === this; }; 110 | 111 | this.remove = function remove(object) { 112 | if (!this.empty()) { 113 | for (var c = this.next; c !== this; c = c.next) { 114 | if (c.value === object) { 115 | c.prev.next = c.next; 116 | c.next.prev = c.prev; 117 | return; 118 | } 119 | } 120 | } 121 | }; 122 | 123 | this.iterator = function iterator() { 124 | return new LinkedListIterator(this, this.next, this.prev); 125 | }; 126 | } 127 | -------------------------------------------------------------------------------- /lib/non-error.js: -------------------------------------------------------------------------------- 1 | module.exports = NonError; 2 | var util = require('util'); 3 | 4 | function NonError(value) { 5 | // Format a reasonable message from `value`. 6 | var message; 7 | try { 8 | message = util.inspect(value); 9 | } catch (e) { 10 | message = e.message; 11 | } 12 | 13 | this.message = message; 14 | this.value = value; 15 | 16 | Error.captureStackTrace(this, NonError); 17 | } 18 | 19 | NonError.prototype = Object.create(Error.prototype); 20 | -------------------------------------------------------------------------------- /lib/raw-debug.js: -------------------------------------------------------------------------------- 1 | 2 | var isv010 = require('./isv010.js'); 3 | 4 | if (isv010) { 5 | var write = process.binding('fs').write; 6 | var util = require('util'); 7 | 8 | process._rawDebug = function _rawDebug(string) { 9 | var buf = new Buffer(string + '\n'); 10 | write(2, buf, 0, buf.length, null); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /lib/scheduler.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var LinkedList = require('./linked-list.js'); 3 | var realNextTick = process.nextTick; 4 | 5 | var callbackQueue = new LinkedList(); 6 | var zoneQueue = []; 7 | var scheduled = false; 8 | 9 | function enqueueCallback(zone, receiver, fn, args) { 10 | callbackQueue.push([zone, receiver, fn, args]); 11 | zone._incrementScheduledTaskCount(); 12 | 13 | if (!scheduled) { 14 | scheduled = true; 15 | realNextTick(processQueues); 16 | } 17 | } 18 | 19 | function enqueueZone(zone) { 20 | zoneQueue.push(zone); 21 | 22 | if (!scheduled) { 23 | scheduled = true; 24 | realNextTick(processQueues); 25 | } 26 | } 27 | 28 | function dequeueZone(zone) { 29 | var length = zoneQueue.length; 30 | for (var i = 0; i < length; i++) { 31 | if (zoneQueue[i] === zone) { 32 | zoneQueue[i] = null; 33 | } 34 | } 35 | } 36 | 37 | function processCallbacks() { 38 | var callbackEntry = callbackQueue.shift(); 39 | for (; callbackEntry !== null; callbackEntry = callbackQueue.shift()) { 40 | var zone = callbackEntry[0]; 41 | var receiver = callbackEntry[1]; 42 | var fn = callbackEntry[2]; 43 | var args = callbackEntry[3]; 44 | 45 | var prevZone = global.zone; 46 | global.zone = null; 47 | zone.apply(receiver, fn, args); 48 | global.zone = prevZone; 49 | zone._decrementScheduledTaskCount(); 50 | zone = null; 51 | } 52 | } 53 | 54 | function processZones() { 55 | var zoneEntry = zoneQueue.shift(); 56 | if (zoneEntry && !zoneEntry._closed) { 57 | zoneEntry._finalize(); 58 | } 59 | } 60 | 61 | function processQueues() { 62 | scheduled = false; 63 | var zoneEntry; 64 | var result; 65 | 66 | do { 67 | processCallbacks(); 68 | processZones(); 69 | } while (zoneQueue.length !== 0); 70 | } 71 | 72 | exports.enqueueCallback = enqueueCallback; 73 | exports.enqueueZone = enqueueZone; 74 | exports.dequeueZone = dequeueZone; 75 | -------------------------------------------------------------------------------- /lib/setup.js: -------------------------------------------------------------------------------- 1 | exports.enable = function() { 2 | if (!global.zone) { 3 | var RootZone = require('./zone.js').RootZone; 4 | global.zone = new RootZone(); 5 | 6 | require('./raw-debug.js'); 7 | require('./wrappers/binding.js'); 8 | require('./wrappers/require.js'); 9 | require('./wrappers/dom-globals.js'); 10 | require('./wrappers/process.js'); 11 | require('./error.js'); 12 | require('./debug.js'); 13 | 14 | console.error('Zones are enabled. ' + 15 | 'See \x1b[1;34mhttp://strongloop.com/zone\x1b[0m ' + 16 | 'for more information.'); 17 | } 18 | 19 | return global.zone; 20 | }; 21 | -------------------------------------------------------------------------------- /lib/uid.js: -------------------------------------------------------------------------------- 1 | module.exports = uid; 2 | 3 | var uidCounter = 0; 4 | function uid() { return ++uidCounter; } 5 | -------------------------------------------------------------------------------- /lib/wrappers/binding.js: -------------------------------------------------------------------------------- 1 | var realBinding = process.binding; 2 | var bindingCache = {}; 3 | 4 | process.binding = binding; 5 | 6 | function binding(name) { 7 | if (name in bindingCache) 8 | return bindingCache[name]; 9 | 10 | var wb; 11 | 12 | switch (name) { 13 | case 'pipe_wrap': 14 | case 'tcp_wrap': 15 | case 'tty_wrap': 16 | wb = require('./binding/stream_wrap.js')(realBinding); 17 | bindingCache.pipe_wrap = wb; 18 | bindingCache.tcp_wrap = wb; 19 | bindingCache.tty_wrap = wb; 20 | return wb; 21 | 22 | case 'cares_wrap': 23 | case 'fs': 24 | case 'process_wrap': 25 | case 'zlib': 26 | wb = require('./binding/' + name + '.js')(realBinding); 27 | bindingCache[name] = wb; 28 | return wb; 29 | 30 | default: 31 | return realBinding(name); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/wrappers/dom-globals.js: -------------------------------------------------------------------------------- 1 | var realSetTimeout = global.setTimeout; 2 | var realClearTimeout = global.clearTimeout; 3 | 4 | global.setTimeout = function setTimeout(cb, timeout) { 5 | var options = { 6 | autoRelease: true, 7 | signalCallback: 8 | function(err) { 9 | if (err || timeout === 0) { 10 | this.release(); 11 | } 12 | }, 13 | releaseCallback: function() { realClearTimeout(handle); }, 14 | name: 'setTimeout' 15 | }; 16 | 17 | var callback = zone.bindCallback(cb, null, options); 18 | var handle = realSetTimeout(callback, timeout); 19 | 20 | return callback; 21 | }; 22 | 23 | global.clearTimeout = 24 | function clearTimeout(callback) { zone.releaseCallback(callback); }; 25 | 26 | var realSetInterval = global.setInterval; 27 | var realClearInterval = global.clearInterval; 28 | 29 | global.setInterval = function setInterval(cb, interval) { 30 | var options = { 31 | autoRelease: false, 32 | signalCallback: function(err) { this.release(); }, 33 | releaseCallback: 34 | function() { 35 | // Calling realClearTimeout may seem wrong here but it is in fact 36 | // intentional. 37 | handle._repeat = false; 38 | realClearTimeout(handle); 39 | }, 40 | name: 'setInterval' 41 | }; 42 | 43 | var callback = zone.bindCallback(cb, null, options); 44 | var handle = realSetInterval(callback, interval); 45 | 46 | return callback; 47 | }; 48 | 49 | global.clearInterval = 50 | function clearInterval(callback) { zone.releaseCallback(callback); }; 51 | 52 | var realSetImmediate = global.setImmediate; 53 | var realClearImmediate = global.clearImmediate; 54 | 55 | global.setImmediate = function setImmediate(cb, timeout) { 56 | var options = { 57 | autoRelease: false, 58 | signalCallback: function(err) { this.release(); }, 59 | releaseCallback: function() { realClearImmediate(handle); }, 60 | name: 'setImmediate' 61 | }; 62 | 63 | var callback = zone.bindCallback(cb, null, options); 64 | var handle = realSetImmediate(callback, timeout); 65 | 66 | return callback; 67 | }; 68 | 69 | global.clearImmediate = 70 | function clearImmediate(callback) { zone.releaseCallback(callback); }; 71 | -------------------------------------------------------------------------------- /lib/wrappers/node-lib/_http_agent.js: -------------------------------------------------------------------------------- 1 | %nativeSource; 2 | 3 | // Monkey-patch the globalAgent property to always use a single agent in the 4 | // active zone. The HTTP agent and the HTTP client are so intertwined that it 5 | // is not practical to share them between zones. 6 | 7 | // This monkey-patch is only applicable to node v0.11+; 8 | // node 0.10 didn't have _http_agent.js, so the 0.10 version of this patch 9 | // lives in http.js instead. 10 | 11 | var Agent = exports.Agent; 12 | 13 | zone.root._httpAgent = exports.globalAgent; 14 | 15 | function getAgent() { 16 | if (zone._httpAgent) 17 | return zone._httpAgent; 18 | 19 | var agent = new Agent(); 20 | zone._httpAgent = agent; 21 | return agent; 22 | } 23 | 24 | function setAgent(agent) { 25 | zone._httpAgent = agent; 26 | } 27 | 28 | Object.defineProperty( 29 | exports, 30 | 'globalAgent', 31 | { get: getAgent, 32 | set: setAgent, 33 | enumerable: true, 34 | configurable: false }); 35 | -------------------------------------------------------------------------------- /lib/wrappers/node-lib/dns.js: -------------------------------------------------------------------------------- 1 | %nativeSource; 2 | 3 | 4 | /* This is a partial workaround for 5 | * https://github.com/joyent/node/issues/8664 6 | */ 7 | 8 | makeAsync = function makeAsync(callback) { 9 | if (typeof callback !== 'function') { 10 | return callback; 11 | } 12 | return function asyncCallback() { 13 | if (asyncCallback.immediately) { 14 | // The API already returned, we can invoke the callback immediately. 15 | callback.apply(null, arguments); 16 | } else { 17 | var args = arguments; 18 | setTimeout(function() { 19 | callback.apply(null, args); 20 | }, 0); 21 | } 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /lib/wrappers/node-lib/zlib.js: -------------------------------------------------------------------------------- 1 | %nativeSource; 2 | 3 | var isv010 = require('../../isv010.js'); 4 | 5 | /* Part of the zone-ification of the zlib built-in module. 6 | * Here make a minor change to the Zlib constructor, which is a base class for 7 | * different classes that implement a compression algorithms (Deflate, Gzip, 8 | * etc). 9 | */ 10 | 11 | var RealZlib = Zlib; 12 | 13 | Zlib = function Zlib() { 14 | RealZlib.apply(this, arguments); 15 | 16 | if (isv010) 17 | this._binding.owner = this; 18 | else // Node 0.11+ 19 | this._handle.owner = this; 20 | }; 21 | 22 | Zlib.prototype = RealZlib.prototype; 23 | -------------------------------------------------------------------------------- /lib/wrappers/require.js: -------------------------------------------------------------------------------- 1 | var module = require('module'); 2 | var Module = module.Module; 3 | var NativeModule = require('./node-lib/native_module'); 4 | var isv010 = require('../isv010.js'); 5 | 6 | 7 | var realRequire = Module.prototype.require; 8 | Module.prototype._realRequire = realRequire; 9 | 10 | function load(path) { 11 | switch (path) { 12 | case 'buffer': 13 | return realRequire.apply(this, arguments); 14 | 15 | case 'module': 16 | return module; 17 | 18 | default: 19 | if (NativeModule.exists(path)) 20 | return NativeModule.require(path); 21 | else 22 | return realRequire.apply(this, arguments); 23 | } 24 | } 25 | 26 | Module.prototype.require = zone.root.bindCallback( 27 | load, zone.root, {autoRelease: false, name: 'Module.require'}); 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zone", 3 | "version": "0.3.4", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node --expose-gc test/run-tests.js --tap-on-ci", 8 | "benchmarks": "cd benchmarks; ./run_bench.sh" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/strongloop/zone.git" 13 | }, 14 | "author": "", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/strongloop/zone/issues" 18 | }, 19 | "homepage": "https://github.com/strongloop/zone", 20 | "optionalDependencies": { 21 | "sl-blip": "http://blip.strongloop.com/zone@0.3.4" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /showcase/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Showcases 3 | 4 | The subdirectories in this folder contain example code to show off zone 5 | features. Look at their README files and try them out. 6 | 7 | Note that you need node v0.11+ to run them. 8 | -------------------------------------------------------------------------------- /showcase/curl/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Curl showcase 3 | 4 | The 'curl' showcase demonstrates three zone features: 5 | 6 | * Callbacks guaranteed to be made asynchronously and to be made exactly once. 7 | * Errors are handled automatically. 8 | * It is trivial to wrap a function that uses the callback-first pattern in 9 | it's own zone, allowing the implementation to be shorter and not having to 10 | worry about common mistakes. 11 | 12 | This directory contains two files that both contain an implementation of the 13 | 'curl' function, which simply downloads a web page, and uses a very simple 14 | in-memory cache. 15 | 16 | * _curl-naive.js_ has a naive implementation that looks good at first glance, 17 | but has subtle bugs which as pointed out in code comments. 18 | * _curl-zone.js_ has a slightly shorter implementation that leverages a zone 19 | to avoid problems. 20 | -------------------------------------------------------------------------------- /showcase/curl/curl-naive.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | 3 | var cache = {}; 4 | 5 | function curl(url, cb) { 6 | if (cache[url]) 7 | // WRONG: synchronous callback 8 | return cb(null, cache[url]); 9 | 10 | var data = ''; 11 | 12 | http.get(url, function(res) { 13 | res.setEncoding('utf8'); 14 | 15 | res.on('data', function(s) { 16 | data += s; 17 | }); 18 | 19 | res.on('end', function() { 20 | cache[url] = data; 21 | cb(null, data); 22 | }); 23 | 24 | // WRONG: are you sure that 'end' and 'error' are mutually exclusive? 25 | res.on('error', function(err) { 26 | cb(err); 27 | }); 28 | }); 29 | 30 | // WRONG: the request object may emit 'error', but there is no 31 | // handler for it. 32 | } 33 | 34 | // Usage: 35 | curl('http://www.google.com', console.log); 36 | curl('http://does/not/exist/', console.log); 37 | -------------------------------------------------------------------------------- /showcase/curl/curl-zone.js: -------------------------------------------------------------------------------- 1 | require('../../').enable(); 2 | 3 | var Zone = zone.Zone; 4 | Zone.longStackSupport = true; 5 | var http = require('http'); 6 | 7 | var cache = {}; 8 | 9 | function curl(url, cb) { 10 | zone.create(function CurlZone() { 11 | if (cache[url]) 12 | // A zone always completes asynchronously, as the user would expect, 13 | // even when it returns a result immediately. 14 | return zone.return(cache[url]); 15 | 16 | var data = ''; 17 | 18 | // Note that we're not installing an 'error' event handler on either the 19 | // request nor the response object. 20 | 21 | // Any error that happens within the zone is automatically caught and 22 | // handled. The zone prevents leaking resources, so both the 'request' 23 | // and the 'response' stream associated with the http.get api will be 24 | // cleaned up before the zone calls it's callback. 25 | 26 | http.get(url, function(res) { 27 | res.setEncoding('utf8'); 28 | 29 | res.on('data', function(s) { 30 | data += s; 31 | }); 32 | 33 | res.on('end', function() { 34 | cache[url] = data; 35 | zone.return(data); 36 | }); 37 | }); 38 | 39 | // The zone takes an error-first callback that it will always call exactly 40 | // once - even if due to a programmer error the zone never explicitly 41 | // returns a result. In this case we're just forwarding to the callback that 42 | // the user passed when calling curl(). 43 | }).setCallback(cb); 44 | } 45 | 46 | // Usage: 47 | curl('http://www.google.com/', console.log); 48 | 49 | // This is obviously going to fail, so we print a long stack trace in the 50 | // callback. 51 | curl('http://does/not/exist/', function(err, data) { 52 | console.log(err.zoneStack); 53 | }); 54 | -------------------------------------------------------------------------------- /showcase/inspect/demo.js: -------------------------------------------------------------------------------- 1 | require('../../').enable(); // enable zones 2 | 3 | var Zone = zone.Zone; 4 | var net = require('net'); 5 | 6 | 7 | zone.create(function ServerZone() { 8 | var server = net.createServer(function(conn) { 9 | conn.resume(); 10 | }); 11 | 12 | server.listen(3000); 13 | }); 14 | 15 | function ConnectionZone() { 16 | var conn = net.connect(3000, function() { 17 | zone.create(function IntervalZone() { 18 | setInterval(function() { 19 | conn.write('hello'); 20 | }, 1); 21 | }); 22 | }); 23 | } 24 | 25 | for (var i = 0; i < 10; i++) { 26 | zone.create(ConnectionZone); 27 | } 28 | 29 | console.log("Run the inspect tool to see what's going on in this process."); 30 | -------------------------------------------------------------------------------- /showcase/inspect/inspect.js: -------------------------------------------------------------------------------- 1 | var isWindows = process.platform === 'win32'; 2 | var fs = require('fs'); 3 | var net = require('net'); 4 | var path = require('path'); 5 | var prefix = isWindows ? '\\\\?\\pipe' 6 | : '/tmp'; 7 | 8 | 9 | var pipeNames = fs.readdirSync(prefix); 10 | 11 | pipeNames = pipeNames.filter(function(name) { 12 | return /^%node-zone-debug-/.test(name); 13 | }).map(function(name) { 14 | return prefix + path.sep + name; 15 | }); 16 | 17 | if (pipeNames.length > 0) 18 | inspectNext(); 19 | else 20 | console.log('No zone processes found'); 21 | 22 | 23 | function inspectNext() { 24 | var pipeName = pipeNames.shift(); 25 | 26 | if (!pipeName) 27 | return; 28 | 29 | var conn = net.connect(pipeName); 30 | conn.pipe(process.stdout); 31 | conn.on('error', function() {}); 32 | conn.on('close', inspectNext); 33 | } 34 | -------------------------------------------------------------------------------- /showcase/long-stack-http/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## long-stack-http showcase 3 | 4 | In this example we are demonstrating a few benefits that are apparent in the stack trace below. 5 | 6 | * We can see nice stack traces upon error (hello Java!), in this case 7 | when a connection is dropped. 8 | * The code is more readable - error handling is left to zones and not 9 | sprinkled all around. 10 | * Zones can be named dynamically, so additional information (the 11 | failing request URI in this example) shows up in the stack trace. 12 | 13 | ## What happens inside 14 | 15 | demo.js creates an http server, and then creates a bunch of clients 16 | that make POST requests to the server and try to send some data. 17 | 18 | However the server has a chaos monkey inside it: sometimes it randomly 19 | kills a connection. The client subsequently sees an 'ECONNRESET' error. 20 | However that's okay: the zone takes care of the cleanup, and we print 21 | long the stack trace (with one zone named after the URI we were posting 22 | to) for debugging purposes. 23 | 24 | Because the chaos monkey behaves randomly, you may not see an error on 25 | every run and sometimes multiple errors may appear. 26 | 27 | ## Output 28 | 29 | You'll end up seeing stack traces that look like this: 30 | 31 | ``` 32 | Error: read ECONNRESET 33 | at exports._errnoException (util.js:742:11) 34 | at TCP.onread (net.js:535:26) 35 | at Zone.self.apply (D:\zone\lib\Zone.js:438:23) 36 | at processQueues (D:\zone\lib\scheduler.js:52:12) 37 | at process._tickCallback (node.js:343:11) 38 | In zone: POST http://127.0.0.1:3000/hello/7 39 | at Zone.create (D:\zone\lib\Zone.js:517:10) 40 | at Zone.ClientZone (D:\zone\showcase\long-stack-http\demo.js:85:10) 41 | at Zone.self.apply (D:\zone\lib\Zone.js:438:23) 42 | at Zone.self.run (D:\zone\lib\Zone.js:426:10) 43 | at new Zone (D:\zone\lib\Zone.js:504:10) 44 | at Zone.create (D:\zone\lib\Zone.js:517:10) 45 | at Object. (D:\zone\showcase\long-stack-http\demo.js:78:6) 46 | at Module._compile (module.js:449:26) 47 | at Object.Module._extensions..js (module.js:467:10) 48 | at Module.load (module.js:349:32) 49 | In zone: ClientZone 50 | at Zone.create (D:\zone\lib\Zone.js:517:10) 51 | at Object. (D:\zone\showcase\long-stack-http\demo.js:78:6) 52 | at Module._compile (module.js:449:26) 53 | at Object.Module._extensions..js (module.js:467:10) 54 | at Module.load (module.js:349:32) 55 | at Function.Module._load (module.js:305:12) 56 | at Function.Module.runMain (module.js:490:10) 57 | at startup (node.js:124:16) 58 | at node.js:807:3 59 | ``` 60 | -------------------------------------------------------------------------------- /showcase/long-stack/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Long-stack showcase 3 | 4 | This showcase demonstrates that zones can print out long stack traces, 5 | and that zones can be named dynamically so the programmer can add 6 | additional information that shows up in the stack trace. 7 | 8 | In long-stack.js a couple of (nested) zones are created and some 9 | asynchronous APIs are used (nextTick and setTimeout). Eventually a 10 | non-existent function is called which causes an error to be thrown. Node 11 | crashes with a long stack trace. 12 | 13 | You can run short-stack.js if you want to be reminded what this looks 14 | like without zones. 15 | 16 | ## Output 17 | 18 | The long stack trace should look similar to this: 19 | 20 | ``` 21 | ReferenceError: function_that_doesnt_exist is not defined 22 | at Zone. (D:\zone\showcase\long-stack\long-stack.js:20:5) 23 | at Zone.self.apply (D:\zone\lib\Zone.js:440:23) 24 | at processQueues (D:\zone\lib\scheduler.js:52:12) 25 | at process._tickCallback (node.js:343:11) 26 | In zone: AsyncFailZone 27 | at D:\zone\lib\Zone.js:532:12 28 | at Zone. (D:\zone\showcase\long-stack\long-stack.js:14:5) 29 | at Zone.self.apply (D:\zone\lib\Zone.js:440:23) 30 | at Zone.self.run (D:\zone\lib\Zone.js:428:10) 31 | at new Zone (D:\zone\lib\Zone.js:506:10) 32 | at Zone.create (D:\zone\lib\Zone.js:519:10) 33 | at Zone.createMiddleZone (D:\zone\showcase\long-stack\long-stack.js:12:8) 34 | at Zone.self.apply (D:\zone\lib\Zone.js:440:23) 35 | at Gate.self.apply (D:\zone\lib\Gate.js:62:12) 36 | at Gate.self.run (D:\zone\lib\Gate.js:53:10) 37 | In zone: In the middle 38 | at Zone.create (D:\zone\lib\Zone.js:519:10) 39 | at Zone.createMiddleZone (D:\zone\showcase\long-stack\long-stack.js:12:8) 40 | at Zone.self.apply (D:\zone\lib\Zone.js:440:23) 41 | at Gate.self.apply (D:\zone\lib\Gate.js:62:12) 42 | at Gate.self.run (D:\zone\lib\Gate.js:53:10) 43 | at D:\zone\lib\process.js:19:10 44 | at process._tickCallback (node.js:343:11) 45 | at Function.Module.runMain (module.js:492:11) 46 | at startup (node.js:124:16) 47 | at node.js:807:3 48 | In zone: Outer 49 | at Zone.create (D:\zone\lib\Zone.js:519:10) 50 | at Object. (D:\zone\showcase\long-stack\long-stack.js:7:6) 51 | at Module._compile (module.js:449:26) 52 | at Object.Module._extensions..js (module.js:467:10) 53 | at Module.load (module.js:349:32) 54 | at Function.Module._load (module.js:305:12) 55 | at Function.Module.runMain (module.js:490:10) 56 | at startup (node.js:124:16) 57 | at node.js:807:3 58 | ``` 59 | -------------------------------------------------------------------------------- /showcase/long-stack/long-stack.js: -------------------------------------------------------------------------------- 1 | // Normally this would be: require('zone').enable(); 2 | require('../../').enable(); 3 | 4 | var Zone = zone.Zone; 5 | Zone.longStackSupport = true; 6 | 7 | zone.create(function Outer() { 8 | process.nextTick(createMiddleZone); 9 | }); 10 | 11 | function createMiddleZone() { 12 | zone.create(function() { 13 | this.name = 'In the middle'; 14 | failAsync(1); 15 | }); 16 | } 17 | 18 | var failAsync = zone.define(function AsyncFailZone(timeout) { 19 | setTimeout(function() { 20 | function_that_doesnt_exist(); 21 | }, timeout); 22 | }); 23 | -------------------------------------------------------------------------------- /showcase/long-stack/short-stack.js: -------------------------------------------------------------------------------- 1 | require('../../').enable(); 2 | 3 | var Zone = zone.Zone; 4 | 5 | process.nextTick(doSomethingAsync); 6 | 7 | function doSomethingAsync() { 8 | failAsync(1); 9 | } 10 | 11 | function failAsync(timeout) { 12 | setTimeout(function() { 13 | function_that_doesnt_exist(); 14 | }, timeout); 15 | } 16 | -------------------------------------------------------------------------------- /test/assets/file1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/assets/file1 -------------------------------------------------------------------------------- /test/assets/file2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/assets/file2 -------------------------------------------------------------------------------- /test/node-tests/fixtures/GH-1899-output.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | console.log('hello, world!'); 23 | 24 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/GH-892-request.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // Called by test/pummel/test-regress-GH-892.js 23 | 24 | var https = require('https'); 25 | var fs = require('fs'); 26 | var assert = require('assert'); 27 | 28 | var PORT = parseInt(process.argv[2]); 29 | var bytesExpected = parseInt(process.argv[3]); 30 | 31 | var gotResponse = false; 32 | 33 | var options = { 34 | method: 'POST', 35 | port: PORT, 36 | rejectUnauthorized: false 37 | }; 38 | 39 | var req = https.request(options, function(res) { 40 | assert.equal(200, res.statusCode); 41 | gotResponse = true; 42 | console.error('DONE'); 43 | res.resume(); 44 | }); 45 | 46 | req.end(new Buffer(bytesExpected)); 47 | 48 | process.on('exit', function() { 49 | assert.ok(gotResponse); 50 | }); 51 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/a.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var c = require('./b/c'); 23 | 24 | console.error('load fixtures/a.js'); 25 | 26 | var string = 'A'; 27 | 28 | exports.SomeClass = c.SomeClass; 29 | 30 | exports.A = function() { 31 | return string; 32 | }; 33 | 34 | exports.C = function() { 35 | return c.C(); 36 | }; 37 | 38 | exports.D = function() { 39 | return c.D(); 40 | }; 41 | 42 | exports.number = 42; 43 | 44 | process.on('exit', function() { 45 | string = 'A done'; 46 | }); 47 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/a1.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var c = require('./b/c'); 23 | 24 | console.error('load fixtures/a.js'); 25 | 26 | var string = 'A'; 27 | 28 | exports.SomeClass = c.SomeClass; 29 | 30 | exports.A = function() { 31 | return string; 32 | }; 33 | 34 | exports.C = function() { 35 | return c.C(); 36 | }; 37 | 38 | exports.D = function() { 39 | return c.D(); 40 | }; 41 | 42 | exports.number = 42; 43 | 44 | process.on('exit', function() { 45 | string = 'A done'; 46 | }); 47 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/agent.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDXTCCAkWgAwIBAgIJAMUSOvlaeyQHMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV 3 | BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQwHhcNMTAxMTE2MDkzMjQ5WhcNMTMxMTE1MDkzMjQ5WjBF 5 | MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 6 | ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB 7 | CgKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEVwfPQQp4X 8 | wtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+1FAE0c5o 9 | exPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404WthquTqg 10 | S7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy25IyBK3QJ 11 | c+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWAQsqW+COL 12 | 0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABo1AwTjAdBgNVHQ4EFgQUDnV4d6mD 13 | tOnluLoCjkUHTX/n4agwHwYDVR0jBBgwFoAUDnV4d6mDtOnluLoCjkUHTX/n4agw 14 | DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAFwV4MQfTo+qMv9JMiyno 15 | IEiqfOz4RgtmBqRnXUffcjS2dhc7/z+FPZnM79Kej8eLHoVfxCyWRHFlzm93vEdv 16 | wxOCrD13EDOi08OOZfxWyIlCa6Bg8cMAKqQzd2OvQOWqlRWBTThBJIhWflU33izX 17 | Qn5GdmYqhfpc+9ZHHGhvXNydtRQkdxVK2dZNzLBvBlLlRmtoClU7xm3A+/5dddeP 18 | AQHEPtyFlUw49VYtZ3ru6KqPms7MKvcRhYLsy9rwSfuuniMlx4d0bDR7TOkw0QQS 19 | A0N8MGQRQpzl4mw4jLzyM5d5QtuGBh2P6hPGa0YQxtI3RPT/p6ENzzBiAKXiSfzo 20 | xw== 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/agent.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEV 3 | wfPQQp4XwtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+ 4 | 1FAE0c5oexPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404 5 | WthquTqgS7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy2 6 | 5IyBK3QJc+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWA 7 | QsqW+COL0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABAoIBAGe4+9VqZfJN+dsq 8 | 8Osyuz01uQ8OmC0sAWTIqUlQgENIyf9rCJsUBlYmwR5BT6Z69XP6QhHdpSK+TiAR 9 | XUz0EqG9HYzcxHIBaACP7j6iRoQ8R4kbbiWKo0z3WqQGIOqFjvD/mKEuQdE5mEYw 10 | eOUCG6BnX1WY2Yr8WKd2AA/tp0/Y4d8z04u9eodMpSTbHTzYMJb5SbBN1vo6FY7q 11 | 8zSuO0BMzXlAxUsCwHsk1GQHFr8Oh3zIR7bQGtMBouI+6Lhh7sjFYsfxJboqMTBV 12 | IKaA216M6ggHG7MU1/jeKcMGDmEfqQLQoyWp29rMK6TklUgipME2L3UD7vTyAVzz 13 | xbVOpZkCgYEA8CXW4sZBBrSSrLR5SB+Ubu9qNTggLowOsC/kVKB2WJ4+xooc5HQo 14 | mFhq1v/WxPQoWIxdYsfg2odlL+JclK5Qcy6vXmRSdAQ5lK9gBDKxZSYc3NwAw2HA 15 | zyHCTK+I0n8PBYQ+yGcrxu0WqTGnlLW+Otk4CejO34WlgHwbH9bbY5UCgYEA3ZvT 16 | C4+OoMHXlmICSt29zUrYiL33IWsR3/MaONxTEDuvgkOSXXQOl/8Ebd6Nu+3WbsSN 17 | bjiPC/JyL1YCVmijdvFpl4gjtgvfJifs4G+QHvO6YfsYoVANk4u6g6rUuBIOwNK4 18 | RwYxwDc0oysp+g7tPxoSgDHReEVKJNzGBe9NGGsCgYEA4O4QP4gCEA3B9BF2J5+s 19 | n9uPVxmiyvZUK6Iv8zP4pThTBBMIzNIf09G9AHPQ7djikU2nioY8jXKTzC3xGTHM 20 | GJZ5m6fLsu7iH+nDvSreDSeNkTBfZqGAvoGYQ8uGE+L+ZuRfCcXYsxIOT5s6o4c3 21 | Dle2rVFpsuKzCY00urW796ECgYBn3go75+xEwrYGQSer6WR1nTgCV29GVYXKPooy 22 | zmmMOT1Yw80NSkEw0pFD4cTyqVYREsTrPU0mn1sPfrOXxnGfZSVFpcR/Je9QVfQ7 23 | eW7GYxwfom335aqHVj10SxRqteP+UoWWnHujCPz94VRKZMakBddYCIGSan+G6YdS 24 | 7sdmwwKBgBc2qj0wvGXDF2kCLwSGfWoMf8CS1+5fIiUIdT1e/+7MfDdbmLMIFVjF 25 | QKS3zVViXCbrG5SY6wS9hxoc57f6E2A8vcaX6zy2xkZlGHQCpWRtEM5R01OWJQaH 26 | HsHMmQZGUQVoDm1oRkDhrTFK4K3ukc3rAxzeTZ96utOQN8/KJsTv 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/alice.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID8DCCAtigAwIBAgIJALmw0zKhqlY1MA0GCSqGSIb3DQEBBQUAMFgxDjAMBgNV 3 | BAMTBWFsaWNlMUYwRAYDVR0RFD11bmlmb3JtUmVzb3VyY2VJZGVudGlmaWVyOmh0 4 | dHA6Ly9sb2NhbGhvc3Q6ODAwMC9hbGljZS5mb2FmI21lMB4XDTExMDgyNDA1NTUx 5 | NFoXDTExMDkyMzA1NTUxNFowWDEOMAwGA1UEAxMFYWxpY2UxRjBEBgNVHREUPXVu 6 | aWZvcm1SZXNvdXJjZUlkZW50aWZpZXI6aHR0cDovL2xvY2FsaG9zdDo4MDAwL2Fs 7 | aWNlLmZvYWYjbWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDP4tdk 8 | 6NxAImrf5kpQVpuPvWij97H9ewFwWq0FOGONPD0JURXB89BCnhfC0+IHbTi+dhfB 9 | DX9HY11NCoJm7juXv0uywv+7Zrlj37Q0RTedADmp237UUATRzmh7E+KZc6tHcZZ8 10 | rPs+ZnY7TXXsh4JRRc8blTy6aEN7/iYMXhk0mIpzjTha2Gq5OqBLustBkeFnoPQS 11 | cac6TOWbEkxg80dI5jX/qK901RRwLztrA0QDeWB+HLbkjIErdAlz5pgo1Nu3vQt6 12 | vLdu7bBYsUa2Y2IaVBNLgmzEiZGwQJMjvbs5tLv8VYBCypb4I4vRJrkG4wWsUimM 13 | +sR7SKHu9FFt2ZdHAgMBAAGjgbwwgbkwHQYDVR0OBBYEFA51eHepg7Tp5bi6Ao5F 14 | B01/5+GoMIGJBgNVHSMEgYEwf4AUDnV4d6mDtOnluLoCjkUHTX/n4aihXKRaMFgx 15 | DjAMBgNVBAMTBWFsaWNlMUYwRAYDVR0RFD11bmlmb3JtUmVzb3VyY2VJZGVudGlm 16 | aWVyOmh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9hbGljZS5mb2FmI21lggkAubDTMqGq 17 | VjUwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAreudH4Y7R9Vl2GJo 18 | 2xRUEwZiMj/ogomZ7B+IZtcuMIR8X2mzQ30xmPKaCy/fjbueqBroIDdxFeQ4eWZf 19 | MD3AK/q5lJXwSInDjnn7jE9gNgLdQeCnajV0/QH+eDxIe/Alvx+RuvrDiNOudEs4 20 | vhqv5zEaL6VEXoWVb4/cghDbynQucSpyOMmGGPYYw2zmg0nNXdQauYWDUZIaDwQ6 21 | tM/pi2ewYubHPZdwJv5jvxTN3Z7RuuGHM+aLAZSAqSgAi0ml8PYYd2eRzXMaEI0c 22 | eajcEvVa405aYT6dxuF1qqRDYx14As/R7O5RKCpz7wsxD6ICD/Ynv3GCUGxANQim 23 | bcCjpg== 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/b/c.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var d = require('./d'); 23 | 24 | var assert = require('assert'); 25 | 26 | var package = require('./package'); 27 | 28 | assert.equal('world', package.hello); 29 | 30 | console.error('load fixtures/b/c.js'); 31 | 32 | var string = 'C'; 33 | 34 | exports.SomeClass = function() { 35 | 36 | }; 37 | 38 | exports.C = function() { 39 | return string; 40 | }; 41 | 42 | exports.D = function() { 43 | return d.D(); 44 | }; 45 | 46 | process.on('exit', function() { 47 | string = 'C done'; 48 | console.log('b/c.js exit'); 49 | }); 50 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/b/d.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | console.error('load fixtures/b/d.js'); 23 | 24 | var string = 'D'; 25 | 26 | exports.D = function() { 27 | return string; 28 | }; 29 | 30 | process.on('exit', function() { 31 | string = 'D done'; 32 | }); 33 | 34 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/b/package/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.hello = 'world'; 23 | console.error('load package/index.js'); 24 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/break-in-module/main.js: -------------------------------------------------------------------------------- 1 | var mod = require('./mod.js'); 2 | mod.hello(); 3 | mod.hello(); 4 | debugger; 5 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/break-in-module/mod.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.hello = function() { 23 | return 'hello from module'; 24 | }; 25 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/breakpoints.js: -------------------------------------------------------------------------------- 1 | debugger; 2 | function a(x) { 3 | var i = 10; 4 | while (--i != 0); 5 | debugger; 6 | return i; 7 | } 8 | function b() { 9 | return ['hello', 'world'].join(' '); 10 | } 11 | a(); 12 | a(1); 13 | b(); 14 | b(); 15 | 16 | 17 | 18 | setInterval(function() { 19 | }, 5000); 20 | 21 | 22 | now = new Date(); 23 | debugger; 24 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/breakpoints_utf8.js: -------------------------------------------------------------------------------- 1 | debugger; 2 | function a(x) { 3 | var i = 10; 4 | while (--i != 0); 5 | debugger; 6 | return i; 7 | } 8 | function b() { 9 | return ['こんにち', 'わ'].join(' '); 10 | } 11 | a(); 12 | a(1); 13 | b(); 14 | b(); 15 | 16 | 17 | 18 | setInterval(function() { 19 | }, 5000); 20 | 21 | 22 | now = new Date(); 23 | debugger; 24 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/catch-stdout-error.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | function write() { 23 | try { 24 | process.stdout.write('Hello, world\n'); 25 | } catch (ex) { 26 | throw new Error('this should never happen'); 27 | } 28 | setImmediate(function() { 29 | write(); 30 | }); 31 | } 32 | 33 | process.stdout.on('error', function(er) { 34 | console.error(JSON.stringify(er)); 35 | process.exit(42); 36 | }); 37 | 38 | write(); 39 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDNDCCAp2gAwIBAgIJAJvXLQpGPpm7MA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV 3 | BAYTAkdCMRAwDgYDVQQIEwdHd3luZWRkMREwDwYDVQQHEwhXYXVuZmF3cjEUMBIG 4 | A1UEChMLQWNrbmFjayBMdGQxEjAQBgNVBAsTCVRlc3QgQ2VydDESMBAGA1UEAxMJ 5 | bG9jYWxob3N0MB4XDTA5MTEwMjE5MzMwNVoXDTEwMTEwMjE5MzMwNVowcDELMAkG 6 | A1UEBhMCR0IxEDAOBgNVBAgTB0d3eW5lZGQxETAPBgNVBAcTCFdhdW5mYXdyMRQw 7 | EgYDVQQKEwtBY2tuYWNrIEx0ZDESMBAGA1UECxMJVGVzdCBDZXJ0MRIwEAYDVQQD 8 | Ewlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANdym7nGe2yw 9 | 6LlJfJrQtC5TmKOGrSXiyolYCbGOy4xZI4KD31d3097jhlQFJyF+10gwkE62DuJe 10 | fLvBZDUsvLe1R8bzlVhZnBVn+3QJyUIWQAL+DsRj8P3KoD7k363QN5dIaA1GOAg2 11 | vZcPy1HCUsvOgvDXGRUCZqNLAyt+h/cpAgMBAAGjgdUwgdIwHQYDVR0OBBYEFK4s 12 | VBV4shKUj3UX/fvSJnFaaPBjMIGiBgNVHSMEgZowgZeAFK4sVBV4shKUj3UX/fvS 13 | JnFaaPBjoXSkcjBwMQswCQYDVQQGEwJHQjEQMA4GA1UECBMHR3d5bmVkZDERMA8G 14 | A1UEBxMIV2F1bmZhd3IxFDASBgNVBAoTC0Fja25hY2sgTHRkMRIwEAYDVQQLEwlU 15 | ZXN0IENlcnQxEjAQBgNVBAMTCWxvY2FsaG9zdIIJAJvXLQpGPpm7MAwGA1UdEwQF 16 | MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAFxR7BA1mUlsYqPiogtxSIfLzHWh+s0bJ 17 | SBuhNrHes4U8QxS8+x/KWjd/81gzsf9J1C2VzTlFaydAgigz3SkQYgs+TMnFkT2o 18 | 9jqoJrcdf4WpZ2DQXUALaZgwNzPumMUSx8Ac5gO+BY/RHyP6fCodYvdNwyKslnI3 19 | US7eCSHZsVo= 20 | -----END CERTIFICATE----- 21 | -----BEGIN RSA PRIVATE KEY----- 22 | MIICXgIBAAKBgQDXcpu5xntssOi5SXya0LQuU5ijhq0l4sqJWAmxjsuMWSOCg99X 23 | d9Pe44ZUBSchftdIMJBOtg7iXny7wWQ1LLy3tUfG85VYWZwVZ/t0CclCFkAC/g7E 24 | Y/D9yqA+5N+t0DeXSGgNRjgINr2XD8tRwlLLzoLw1xkVAmajSwMrfof3KQIDAQAB 25 | AoGBAIBHR/tT93ce2mJAJAXV0AJpWc+7x2pwX2FpXtQujnlxNZhnRlrBCRCD7h4m 26 | t0bVS/86kyGaesBDvAbavfx/N5keYzzmmSp5Ht8IPqKPydGWdigk4x90yWvktai7 27 | dWuRKF94FXr0GUuBONb/dfHdp4KBtzN7oIF9WydYGGXA9ZmBAkEA8/k01bfwQZIu 28 | AgcdNEM94Zcug1gSspXtUu8exNQX4+PNVbadghZb1+OnUO4d3gvWfqvAnaXD3KV6 29 | N4OtUhQQ0QJBAOIRbKMfaymQ9yE3CQQxYfKmEhHXWARXVwuYqIFqjmhSjSXx0l/P 30 | 7mSHz1I9uDvxkJev8sQgu1TKIyTOdqPH1tkCQQDPa6H1yYoj1Un0Q2Qa2Mg1kTjk 31 | Re6vkjPQ/KcmJEOjZjtekgFbZfLzmwLXFXqjG2FjFFaQMSxR3QYJSJQEYjbhAkEA 32 | sy7OZcjcXnjZeEkv61Pc57/7qIp/6Aj2JGnefZ1gvI1Z9Q5kCa88rA/9Iplq8pA4 33 | ZBKAoDW1ZbJGAsFmxc/6mQJAdPilhci0qFN86IGmf+ZBnwsDflIwHKDaVofti4wQ 34 | sPWhSOb9VQjMXekI4Y2l8fqAVTS2Fn6+8jkVKxXBywSVCw== 35 | -----END RSA PRIVATE KEY----- 36 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/child-process-message-and-exit.js: -------------------------------------------------------------------------------- 1 | 2 | process.send('hello'); 3 | process.exit(0); 4 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/child-process-persistent.js: -------------------------------------------------------------------------------- 1 | setInterval(function () {}, 500); 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/child-process-spawn-node.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | 3 | function onmessage(m) { 4 | console.log('CHILD got message:', m); 5 | assert.ok(m.hello); 6 | process.removeListener('message', onmessage); 7 | } 8 | 9 | process.on('message', onmessage); 10 | process.send({ foo: 'bar' }); 11 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/child_process_should_emit_error.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var exec = require('child_process').exec; 23 | 24 | [0, 1].forEach(function(i) { 25 | exec('ls', function(err, stdout, stderr) { 26 | console.log(i); 27 | throw new Error('hello world'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/create-file.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var fs = require('fs'); 23 | 24 | var file_name = process.argv[2]; 25 | var file_size = parseInt(process.argv[3]); 26 | 27 | fs.truncateSync(file_name, file_size); 28 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/cycles/folder/foo.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | 23 | var root = require('./../root'); 24 | 25 | exports.hello = function() { 26 | return root.calledFromFoo(); 27 | }; 28 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/cycles/root.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | 23 | var foo = exports.foo = require('./folder/foo'); 24 | 25 | exports.hello = 'hello'; 26 | exports.sayHello = function() { 27 | return foo.hello(); 28 | }; 29 | exports.calledFromFoo = function() { 30 | return exports.hello; 31 | }; 32 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/debug-target.js: -------------------------------------------------------------------------------- 1 | var a = 0; 2 | a += 1; 3 | a += 2; 4 | a += 3; 5 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/deprecated.js: -------------------------------------------------------------------------------- 1 | require('util').p('This is deprecated'); 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/destroy-stdin.js: -------------------------------------------------------------------------------- 1 | process.stdin.destroy(); 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/echo-close-check.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common'); 23 | var assert = require('assert'); 24 | var net = require('net'); 25 | 26 | process.stdout.write('hello world\r\n'); 27 | 28 | var stdin = process.openStdin(); 29 | 30 | stdin.on('data', function(data) { 31 | process.stdout.write(data.toString()); 32 | }); 33 | 34 | stdin.on('end', function() { 35 | // If stdin's fd will be closed - createServer may get it 36 | var server = net.createServer(function() { 37 | }).listen(common.PORT, function() { 38 | assert(typeof server._handle.fd !== 'number' || server._handle.fd > 2); 39 | server.close(); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/echo.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common'); 23 | var assert = require('assert'); 24 | 25 | common.print('hello world\r\n'); 26 | 27 | var stdin = process.openStdin(); 28 | 29 | stdin.on('data', function(data) { 30 | process.stdout.write(data.toString()); 31 | }); 32 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/empty.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/empty.js -------------------------------------------------------------------------------- /test/node-tests/fixtures/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/empty.txt -------------------------------------------------------------------------------- /test/node-tests/fixtures/empty/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/empty/.gitkeep -------------------------------------------------------------------------------- /test/node-tests/fixtures/exit.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | process.exit(process.argv[2] || 1); 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/fixture.ini: -------------------------------------------------------------------------------- 1 | ; a comment 2 | root=something 3 | 4 | url = http://example.com/?foo=bar 5 | 6 | [ the section with whitespace ] 7 | this has whitespace = yep ; and a comment; and then another 8 | 9 | just a flag, no value. 10 | 11 | [section] 12 | one=two 13 | Foo=Bar 14 | this=Your Mother! 15 | blank= 16 | 17 | [Section Two] 18 | something else=blah 19 | remove = whitespace -------------------------------------------------------------------------------- /test/node-tests/fixtures/foafssl.crt: -------------------------------------------------------------------------------- 1 | Bag Attributes 2 | friendlyName: Me's Not a Certification Authority ID 3 | localKeyID: 98 CC 02 91 83 8D 14 4A 60 40 B7 11 E8 EF A9 01 4B D7 16 8A 4 | subject=/O=FOAF+SSL/OU=The Community Of Self Signers/UID=http://example.com/#me/CN=Me 5 | issuer=/O=FOAF+SSL/OU=The Community of Self Signers/CN=Not a Certification Authority 6 | -----BEGIN CERTIFICATE----- 7 | MIIDVDCCAr2gAwIBAgIQRLIhwZ2N3ciEdpWb6kPmPzANBgkqhkiG9w0BAQUFADBj 8 | MREwDwYDVQQKDAhGT0FGK1NTTDEmMCQGA1UECwwdVGhlIENvbW11bml0eSBvZiBT 9 | ZWxmIFNpZ25lcnMxJjAkBgNVBAMMHU5vdCBhIENlcnRpZmljYXRpb24gQXV0aG9y 10 | aXR5MB4XDTExMDgzMDE3MzIwNFoXDTEyMDgyMDE5MzIwNFowcDERMA8GA1UECgwI 11 | Rk9BRitTU0wxJjAkBgNVBAsMHVRoZSBDb21tdW5pdHkgT2YgU2VsZiBTaWduZXJz 12 | MSYwJAYKCZImiZPyLGQBAQwWaHR0cDovL2V4YW1wbGUuY29tLyNtZTELMAkGA1UE 13 | AwwCTWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCm9EqcJXkUMSFP 14 | XIevngQBd6i7iayAP34Ju8OlUZ80nNm5xAvkNtCqgjqUFH4myJJIraK+PdTTTowo 15 | lkaUsgR9IXtPEpk3Hqk6g8iauUQHJBMeZfKwFh3pVgzenBNFVVKy9Jzw+wDY13Uy 16 | MkkT9vgP8p0KEx0p2wav+L4ZG3kg3C2uHCbqgqR4R6EDke879qq7PMQP+CEAsDpP 17 | D/GAknjk3f2n3pVO1W3HrZpH7rw313GjZvxgpby3I3O+wYBkmz76DpCScHIQtBuQ 18 | Ayuxi8kfIEbr2vEZH0pOJtcYecTHhnti/NUI6M5m6C0SinHpFYCfz0To3ndAZ/He 19 | XXC5wDaHAgMBAAGjeDB2MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgLsMBEG 20 | CWCGSAGG+EIBAQQEAwIFoDAdBgNVHQ4EFgQU3gJIUFpe8rKklsjEdsxlaT6rZhow 21 | JAYDVR0RAQH/BBowGIYWaHR0cDovL2V4YW1wbGUuY29tLyNtZTANBgkqhkiG9w0B 22 | AQUFAAOBgQBLhwWbYMdeSkVZ4biVUle+XHP4Gv8V9WSfldvgn1PntS1lpVR46Exl 23 | AkLO1SrnN5WHeAjv6VNb3KmTF+QhLt/4a1l9CEEeZSg5ml5aeXE+veobgypDoam+ 24 | NKYAeIW9Wx+HcgBL4leIX3WiCKu/eal+a5ro18LQ8hkZqryHeVESIw== 25 | -----END CERTIFICATE----- 26 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/foafssl.key: -------------------------------------------------------------------------------- 1 | Bag Attributes 2 | friendlyName: Me's Not a Certification Authority ID 3 | localKeyID: 98 CC 02 91 83 8D 14 4A 60 40 B7 11 E8 EF A9 01 4B D7 16 8A 4 | Key Attributes: 5 | -----BEGIN PRIVATE KEY----- 6 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCm9EqcJXkUMSFP 7 | XIevngQBd6i7iayAP34Ju8OlUZ80nNm5xAvkNtCqgjqUFH4myJJIraK+PdTTTowo 8 | lkaUsgR9IXtPEpk3Hqk6g8iauUQHJBMeZfKwFh3pVgzenBNFVVKy9Jzw+wDY13Uy 9 | MkkT9vgP8p0KEx0p2wav+L4ZG3kg3C2uHCbqgqR4R6EDke879qq7PMQP+CEAsDpP 10 | D/GAknjk3f2n3pVO1W3HrZpH7rw313GjZvxgpby3I3O+wYBkmz76DpCScHIQtBuQ 11 | Ayuxi8kfIEbr2vEZH0pOJtcYecTHhnti/NUI6M5m6C0SinHpFYCfz0To3ndAZ/He 12 | XXC5wDaHAgMBAAECggEAEhwrv7Zc5PDTYS1zVnx4iMQ3HGi5uouom1uvxE4PTAC7 13 | qWf3tkCv798Cha+XY5OcMqALKEHCxU0e7QQoEdchn4UzQAePcSg1STCkYQw5seCa 14 | 5lA+vBUaF4aLDNa3TG0N9HWOVKGVnO/6OYC05qKClBBIMqCSKEkm942u6UBOql6q 15 | 71Sj1Nd/4eP9AcvgO5cgyUszM2I25LzXIZW7JLgdqXiJRj8CuY3X5FVURvadENgk 16 | ctw5EjdT7LNdc67Ot9Bs6qcVr2ld/U+4ZSC2+cqtPyn7mnA4hrYXlpA1Ilv3oRwZ 17 | aUJfG5HVV4jjNVHxDqddBh3UhOxJYZ1DNEMndTBx8QKBgQDcsrLfkE6utaj8w/of 18 | Hk/aq1JRNLgSvhoP2wVmK7USvYFj7DIvL4CqyghY5TLgNk272v8mT0Q7R6AtsOUk 19 | Gf50uZFAtIoPvTsvBu6cbRsPTeGJ0i1+LLme/AJu3MexXLF6mlzoGmlx8V7CoFqI 20 | 9hvqBA5rZ6ecoSjmU2q2xWKXKQKBgQDBqNqicSp2jnHiTXYbG/tsnxhFwALdEjvb 21 | EgZprmoBzo1eQFOY/DNBdDiEZBstu9mJBX3XWTU1F4c6tYRocNCMDwLBZAB6NnVM 22 | JjoddJApa5Qg3uoXmk53saZhcVkOzh+P/Dxg9c9O3q4DDUegnkM95ZSbCPtIBq6K 23 | bPA3OS+GLwKBgQCY0022LjGuHbFlRzg+sDjPzW71OLJ2mBln/VyhwYZj8cJVtUuT 24 | DSvmGHzrQduXE0OE4ENq/dzbx9+NhD9IXo+ruIxy6BHqkDkZeY1l2M+yK1YQn/BM 25 | vR/UjeIJbu0BTpS/t4C6YP+/nUrnLy9CRFpUFHb/vQl+FsNBq2XsJob88QKBgQCD 26 | 6B5bbNduf2HEsdxTZMDhYJAo2jtZFxVcBzAFBb7A0k7qNsh6OLY0zBO+4Wy9vujR 27 | 8sKfTuz157u9WmwAs27pJ0RKM3I7zCIjJxqIe5/CBruTlCJAx2LRFljsoEb31aAb 28 | 88Owi12ULAq8m2wBVCsa2uhYnUqC6cIzGTaZdsMPEwKBgQDJXI+J2d36IWzFrByH 29 | yskssFldbLxm/7EexzAYuoSpHuQIxGJYHTHn6CZhqrX8UbxVnS909ES+17kdLZVP 30 | egvaxn1mtfZInnH64PiQDQrsNnbP4Zg8yvLvIcEVIPqnSQ5QrhdR29tjYuDwUIKM 31 | 4BMR2yfkFp6URRX7ZD1UQsduww== 32 | -----END PRIVATE KEY----- 33 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/foo: -------------------------------------------------------------------------------- 1 | 2 | exports.foo = "ok" 3 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/global/plain.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | foo = 'foo'; 23 | global.bar = 'bar'; 24 | 25 | exports.fooBar = {foo: global.foo, bar: bar}; 26 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "version": "0.0.1" 4 | "description": "im broken" 5 | } -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent1-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICbjCCAdcCCQDQ8o4kHKdCPTANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV 3 | UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO 4 | BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA 5 | dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB9 6 | MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK 7 | EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MTEgMB4G 8 | CSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD 9 | gY0AMIGJAoGBAPFDMzOUh98P99mKwmtR8UxzTHtspXlAsp3pHSNWTRmkHVZfO51d 10 | hxs5FXjhXwwxfJ3ucG9BFu40qhOsHsnkAUrC/F+jWMmmbeQbpv3XXLOc3rNvqQJM 11 | GX0qKheNsgtGLDMByj7664cIpa7TbQim8Go3WvLxCVlJAo2d6j+KW+WNAgMBAAEw 12 | DQYJKoZIhvcNAQEFBQADgYEADu1ZIfp79Y2/Vn6/Hn+1+D9KyKzMAwkulc/UKezx 13 | 9XVn6EDnOkZE3sOa/sK+6OpnzZHRW3slEbQT1nyo4Gn+2d0GH5pmDPZ5S1iebxdM 14 | snm5pQHmKbeqHCw1aPsShLX2+rVrfE5ywVOOPIC4IvP8H8vm1Eoj7LecA2FmxMH6 15 | juc= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent1-csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH 3 | EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD 4 | EwZhZ2VudDExIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G 5 | CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDxQzMzlIffD/fZisJrUfFMc0x7bKV5QLKd 6 | 6R0jVk0ZpB1WXzudXYcbORV44V8MMXyd7nBvQRbuNKoTrB7J5AFKwvxfo1jJpm3k 7 | G6b911yznN6zb6kCTBl9KioXjbILRiwzAco++uuHCKWu020IpvBqN1ry8QlZSQKN 8 | neo/ilvljQIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 9 | b3JkMA0GCSqGSIb3DQEBBQUAA4GBAHMP0MU6e7QlbsaJ6g/KNOC5FJn6+M4E5ZaP 10 | tkFHlITUF8SBKWZz6UUYTTdT0/C3KAPT7STHkWCfh0yYgidckdWYB/esF12y0/S7 11 | c4qr4iD548Jx/g0Mn/5B4+9gwFTrsd5uktOrgF7VVsQ1nGr5QKMRbrtGDjCrXA8Q 12 | rjIWhd12 13 | -----END CERTIFICATE REQUEST----- 14 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent1-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXwIBAAKBgQDxQzMzlIffD/fZisJrUfFMc0x7bKV5QLKd6R0jVk0ZpB1WXzud 3 | XYcbORV44V8MMXyd7nBvQRbuNKoTrB7J5AFKwvxfo1jJpm3kG6b911yznN6zb6kC 4 | TBl9KioXjbILRiwzAco++uuHCKWu020IpvBqN1ry8QlZSQKNneo/ilvljQIDAQAB 5 | AoGBAOS++zfHdv+WSz92IZnRaoA6vWQ0gbuyDOhNkrPjalyKTsqKpqIwgB3ehK5E 6 | uHJ+JRI0dWP2icA2LJ9UTSjMRi99yq+8vXi2aUeWD09e1EBBc1JkSA2ZF/nxL4pT 7 | dmJJbhIz4wrbuKUjQBmyxIPs775D5QOnc9d/bVkSq7iB11WhAkEA/eFKyBR2qjUe 8 | SWEAp3RHi4ZqYna6WZ8dsPvoJ/hhyXNAuHZly8aRonjXJsT6kIuzXlMURVypFcrD 9 | EbJeNzonKQJBAPNG75kmQD1z34UlBx6lnwt74/M8Iuu4Dm344zyBrWj+qDoNz4Ye 10 | PEZRo0T9bOKaaI/4jLYATWx1+r4ZXxIlC8UCQQCSOtXL8J145CeRtGGgEgWzg7R7 11 | Ck/DlzaO3kmV3CbW1Z+NoAR6HuF7Z4blOcfowc6KoeenG/v4JVW+N7K0tLYhAkEA 12 | 75dNIWeqnNshp99vw58ZpBW/yi3PtpbunyAfq9eLEXy78XDokQ32DssYITn1orav 13 | hBsleZmSpt8Ks24JU7VogQJBAOxe8AiqFi6rxY5V8vBUxf7YX5rc0E8AJ+vT8yey 14 | 2Mi7sgzKuEV3SE8xdaLwJLaJ1L28zFbGM3TXuTXHHzp9Wh0= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent1.cnf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 1024 3 | days = 999 4 | distinguished_name = req_distinguished_name 5 | attributes = req_attributes 6 | prompt = no 7 | 8 | [ req_distinguished_name ] 9 | C = US 10 | ST = CA 11 | L = SF 12 | O = Joyent 13 | OU = Node.js 14 | CN = agent1 15 | emailAddress = ry@tinyclouds.org 16 | 17 | [ req_attributes ] 18 | challengePassword = A challenge password 19 | 20 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent2-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICcTCCAdoCCQCalREW1v1r6zANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV 3 | UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO 4 | BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR 5 | cnlAdGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAw 6 | WjB9MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYD 7 | VQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEg 8 | MB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEB 9 | BQADgY0AMIGJAoGBANY5OgRa+YpShm6ZgJqfhbBH1vYAIgbbzla1FsCv8KUmg1eH 10 | 6HmAtRVwE/I6kYIa9hLd48IIkdVqUmPXD8KZWrq7EDMLX/HUoPYHdh4caxLkKSzk 11 | h+KtFpunst2fwqog5dfegZQCviF3g2UWN6Zh2nUCfaiX0IWGipnryXD0IvRvAgMB 12 | AAEwDQYJKoZIhvcNAQEFBQADgYEAEhaGIMyK0cmCXZlLCXBiDtXhJ0WGbMIvYHRN 13 | kE1gJ42sHyDHW7SKpL0gISdtUuULV+Zo/qgGAutJHomGgGuLcESWHQe1PChYxwBh 14 | Q8iaNO/itVvP6fXuNKfrWJxwnAxGSYu2/YdFSSfhS+JsSc5aq7EU3+8dS7Q3F9W3 15 | +9ufnF0= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent2-csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH 3 | EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD 4 | EwZhZ2VudDIxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G 5 | CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDWOToEWvmKUoZumYCan4WwR9b2ACIG285W 6 | tRbAr/ClJoNXh+h5gLUVcBPyOpGCGvYS3ePCCJHValJj1w/CmVq6uxAzC1/x1KD2 7 | B3YeHGsS5Cks5IfirRabp7Ldn8KqIOXX3oGUAr4hd4NlFjemYdp1An2ol9CFhoqZ 8 | 68lw9CL0bwIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 9 | b3JkMA0GCSqGSIb3DQEBBQUAA4GBALkokJAd9fZM0tF3qluKGqZVT3rWvoEjm64I 10 | 13niqtvGIUirIPhcNm6oCYOeBMt1N0Yvgr/UYhfuicQFAcxP5u4I2QaV0AYB7fbR 11 | hvaL8BoZ9KlsbqrwyizNnxNqEkM1lcTBevKRad3zuPHcfOWArHt6JtVNJOmgChTp 12 | VsO5mtJV 13 | -----END CERTIFICATE REQUEST----- 14 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent2-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXgIBAAKBgQDWOToEWvmKUoZumYCan4WwR9b2ACIG285WtRbAr/ClJoNXh+h5 3 | gLUVcBPyOpGCGvYS3ePCCJHValJj1w/CmVq6uxAzC1/x1KD2B3YeHGsS5Cks5Ifi 4 | rRabp7Ldn8KqIOXX3oGUAr4hd4NlFjemYdp1An2ol9CFhoqZ68lw9CL0bwIDAQAB 5 | AoGBAMDw1dIqZeoxHabrVirtVilI6tCxmfP3cMYjX5S4YdM89rqVS8pzI6VlRnG6 6 | UmeOBOdFNecCdOZ0VjRZ9HXeTRmPkEhUc9QY5MJXjDp48WK+1LIey33IsfEE35mp 7 | ETrP+3VVRnSioG0X3COX73I0gOM+DhYl5uQF/2Cas2Fryy9hAkEA7g6hlBzhTGPj 8 | wQE8pUBGdVyke6FoDrT/EJhlzG6UOveBVwm20jBeaMSsufqu2fm86UgmW6C2JZzH 9 | 1KrbEXoVyQJBAOZeuGaiCQ+ETFAFjEn782wRq5pcqWOLt5tOwx06cf62PJKtFsXJ 10 | rOuBWlu4zGLD3IIpD3nqh67XvgtFSftGNHcCQDKkni8aLbvIjE0k7Dfjgpm5Cazb 11 | W321d4WaRh3FcHdS7AsOH/x7GbqEDJLMB6KLhGrEVJStjdJWlhRh/JStOjECQQDd 12 | kIxaac29Fskuzac4IRLmBbi+JhDkpSRaQ051dhjdmfh4OfGFGYsulqKJRRuOgkI7 13 | DbLM1zzYdLdbr7CP893RAkEAnyXAB0NQ2EImlFhbQRDirHgq8URu+/cVW3qBrOcL 14 | GIXr1KwvrIN//ZjpFwotKjQViM86nw6PpVywmOiP7Lrvag== 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent2.cnf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 1024 3 | days = 999 4 | distinguished_name = req_distinguished_name 5 | attributes = req_attributes 6 | prompt = no 7 | 8 | [ req_distinguished_name ] 9 | C = US 10 | ST = CA 11 | L = SF 12 | O = Joyent 13 | OU = Node.js 14 | CN = agent2 15 | emailAddress = ry@tinyclouds.org 16 | 17 | [ req_attributes ] 18 | challengePassword = A challenge password 19 | 20 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent3-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICbjCCAdcCCQCDBr594bsJmzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV 3 | UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO 4 | BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlA 5 | dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB9 6 | MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK 7 | EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MzEgMB4G 8 | CSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD 9 | gY0AMIGJAoGBAM69c5za1Aj3bO1Nzl/qt/p3MaadCn7OxP3KKqeu7DiFIKOYq+k5 10 | MVjzfVZqZoy+H5z/Tuan6+7LawGWmJHaIT7POvmsOQhy86AJE07s9Z+5tDk6SPku 11 | tzJohyPlWPlSJ+q/v7pwWU+En55z8ihLtA5On77OZK8JL+qYjOFlhYx5AgMBAAEw 12 | DQYJKoZIhvcNAQEFBQADgYEAX6z18J8/wzKJJb+hFngaIrUt052AsBXOvF83XOg0 13 | dEiQK+X3pZSPCF3a0g1iJQMIHuJvnLUuqUfIDQLqkBEtlrXbT/1UqaDu12neImJ6 14 | XI6O3TkSoyxkH461qMu/Q3Um2RW1o2oVlYdjzZgBeKE2ilhDTsJcdNGZTXP4ZW/j 15 | VHc= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent3-csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH 3 | EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD 4 | EwZhZ2VudDMxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G 5 | CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOvXOc2tQI92ztTc5f6rf6dzGmnQp+zsT9 6 | yiqnruw4hSCjmKvpOTFY831WamaMvh+c/07mp+vuy2sBlpiR2iE+zzr5rDkIcvOg 7 | CRNO7PWfubQ5Okj5LrcyaIcj5Vj5Uifqv7+6cFlPhJ+ec/IoS7QOTp++zmSvCS/q 8 | mIzhZYWMeQIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 9 | b3JkMA0GCSqGSIb3DQEBBQUAA4GBACPgD5L6BWcjXXc+UoC8ZNhSQl3Fc4lsbzdF 10 | VhKfvIh2l1Ywz4xCKkC+mRxKQFbj8KNXKx1xBrkvuzVvVXCwkqhkBLDWFhVCsoG8 11 | Z3YpDz2fu2xOw2Ogjnx5zTNauoxl/oYI9AoWcs6FaOiVFgw7IsejGjReeV4zaeLe 12 | j0XujlKJ 13 | -----END CERTIFICATE REQUEST----- 14 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent3-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXgIBAAKBgQDOvXOc2tQI92ztTc5f6rf6dzGmnQp+zsT9yiqnruw4hSCjmKvp 3 | OTFY831WamaMvh+c/07mp+vuy2sBlpiR2iE+zzr5rDkIcvOgCRNO7PWfubQ5Okj5 4 | LrcyaIcj5Vj5Uifqv7+6cFlPhJ+ec/IoS7QOTp++zmSvCS/qmIzhZYWMeQIDAQAB 5 | AoGBAM4ONbUYxk1Jjt/WtOMU5tpVAr+1tkg9fkoVvf3zcq3Cwo1MFcwWnQCzbzE6 6 | S4vr00Z/kPyEUbtoM/cZSmfUqVxOEc10QGyAm8c88zHiuKmoFFElrYR6kVNUvWZS 7 | TsLb1vznvuxkajdkOzVEyLj7Q+lYbd0dpc18fbMeV8VEFL6BAkEA7SI046SI44Zc 8 | sJ/vIDvl1vbnGo/5kTb3egzVpH52UkmjadeBZG/iN6UxyMKlP9Wpazod332Bnr7p 9 | UYD0S6g1xQJBAN8wNQk9LSDXrUkb/z1WMYbx5UHfJaWBLdVcYfHCsbyzwrdGjH77 10 | 6Rb6QwgP4piAKMRUNLAPPBSFUs/Ma+kCGyUCQQCklhxdcAKu4MAOu0LufYReOkpX 11 | DlzqpFsKNERIgpm/LWsleDVPr7Q0aQzvyeGGN9b6HIFFcEf6FYm9TyLALET9AkA7 12 | dCoMpgFJiGqe2RhrDHTxD6sUmw76Qakl9xAYSNbz/6bVD7QJd62l81C76w9ftHQn 13 | qI7If6ZviPyAYmI0ld0JAkEArE8YZSpszCwaEIrx9XLHPTNPgBkVgsv+LI0cekry 14 | LFXL05GkfJ9GLRoRtrcuLAq/Bk99NJ+F+Rwp9sr7o910Gw== 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent3.cnf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 1024 3 | days = 999 4 | distinguished_name = req_distinguished_name 5 | attributes = req_attributes 6 | prompt = no 7 | 8 | [ req_distinguished_name ] 9 | C = US 10 | ST = CA 11 | L = SF 12 | O = Joyent 13 | OU = Node.js 14 | CN = agent3 15 | emailAddress = ry@tinyclouds.org 16 | 17 | [ req_attributes ] 18 | challengePassword = A challenge password 19 | 20 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent4-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICjDCCAfWgAwIBAgIJAIMGvn3huwmcMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV 3 | BAYTAlVTMQswCQYDVQQIEwJDQTELMAkGA1UEBxMCU0YxDzANBgNVBAoTBkpveWVu 4 | dDEQMA4GA1UECxMHTm9kZS5qczEMMAoGA1UEAxMDY2EyMSAwHgYJKoZIhvcNAQkB 5 | FhFyeUB0aW55Y2xvdWRzLm9yZzAeFw0xNDA3MjMxOTUxMDBaFw00MTEyMDcxOTUx 6 | MDBaMH0xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTELMAkGA1UEBxMCU0YxDzAN 7 | BgNVBAoTBkpveWVudDEQMA4GA1UECxMHTm9kZS5qczEPMA0GA1UEAxMGYWdlbnQ0 8 | MSAwHgYJKoZIhvcNAQkBFhFyeUB0aW55Y2xvdWRzLm9yZzCBnzANBgkqhkiG9w0B 9 | AQEFAAOBjQAwgYkCgYEAyx7VZwjI1e3d42o7XKHAiRvmR2Bx1otBje47UZEcIMzN 10 | 8/a3j2bJOCgxGiD03Jk3XqPywhjFbPQRf8mkbx25JFSLyCbJXwPv4Tw77u/aZO+W 11 | o7oS3f6gS7oGB8eWvpraNXr/K5FniDuo9bWfDxzS9x1bP5k1OiUvWpvbmtM9d78C 12 | AwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEA 13 | VdmQOn9K3mDnF7UP8Dvf4YgCe+NdniwYUdJt2FYcO0IT8dYtANBR0IVS0xywz4Kq 14 | H5osj1I6L6zI8QOmZtRvN1D1NKJInX4uamz3mjYPcdGOFpBbgG+0gwDIFLLCDMU3 15 | VoutP8TVkm5nVbciBbMYacF4wHG/86as0Ts4drM15cg= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent4-csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH 3 | EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD 4 | EwZhZ2VudDQxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G 5 | CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLHtVnCMjV7d3jajtcocCJG+ZHYHHWi0GN 6 | 7jtRkRwgzM3z9rePZsk4KDEaIPTcmTdeo/LCGMVs9BF/yaRvHbkkVIvIJslfA+/h 7 | PDvu79pk75ajuhLd/qBLugYHx5a+mto1ev8rkWeIO6j1tZ8PHNL3HVs/mTU6JS9a 8 | m9ua0z13vwIDAQABoCUwIwYJKoZIhvcNAQkHMRYTFEEgY2hhbGxlbmdlIHBhc3N3 9 | b3JkMA0GCSqGSIb3DQEBBQUAA4GBADL43hM8ZGMd0ev7r5iqFQYrLrNXvisWo5vI 10 | PDBzA7QBkZ4WyDqiUpK75mabmT7cIbnpc05FJV8R35BwafeSReJ7YKd5ru1d1gCn 11 | yupUNKZ+5+n1mxVxWv+Frgw/Rli1tNua2KcspZLOs99RcrND3YCbcB7TSIotfxmg 12 | 3JtGRloX 13 | -----END CERTIFICATE REQUEST----- 14 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent4-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXQIBAAKBgQDLHtVnCMjV7d3jajtcocCJG+ZHYHHWi0GN7jtRkRwgzM3z9reP 3 | Zsk4KDEaIPTcmTdeo/LCGMVs9BF/yaRvHbkkVIvIJslfA+/hPDvu79pk75ajuhLd 4 | /qBLugYHx5a+mto1ev8rkWeIO6j1tZ8PHNL3HVs/mTU6JS9am9ua0z13vwIDAQAB 5 | AoGBAMerv8xRblweQIlV3JTqzQH7UxvHSyDEM+T504YTR7tWmP7CASAOwq9ZkytE 6 | SnCwjSWTtQfooerA4pLj/ajdZyj3JzaTXPahuN/KCZaLPSYLOKHvF7u9larsgnC8 7 | 2Q6jkLJ2TTVqe0w8pc73Ak9A5o2fyjug+BH0KTmr3hcObSXBAkEA6NDv/ofNinJn 8 | 77ELv8k2eVA9psVDWPPapAn2CcEigqBc88L+LM+O1NKDkYgc+ux1QhJa9EWefGJJ 9 | gPiCdZBOvQJBAN9Y4OOb15txc5C5rduWiGyuCyCFWfdmBrW8oOx+fjG5Q/r7R8eE 10 | +CFepik8BOg+QHjtzY1tzOJkCxObt2PsFisCQQDWzigQTNY8vc/d3Bk+C3VCOuGX 11 | JHw970g0f6hNWa/wm+sHUUrYp2xeOhkARniOn2qU2oCmzjErDDhLUX503/91AkBg 12 | 3wLDlc9hK0btiatfp53KTX6j/1KzHDxizMqbaI3BcVKL5DsQzZp1lsDI97BFLuL1 13 | 0GasJeiMdMndGlfjbf17AkA2wpV2ui5/3pc6GVFf4DNZvTFxON75b3LRRXQK9TJ+ 14 | JYwP5YSh+/EPI7KCAvpcX37xU7ezGCc7jDxkApiB7H55 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/agent4.cnf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 1024 3 | days = 999 4 | distinguished_name = req_distinguished_name 5 | attributes = req_attributes 6 | prompt = no 7 | 8 | [ req_distinguished_name ] 9 | C = US 10 | ST = CA 11 | L = SF 12 | O = Joyent 13 | OU = Node.js 14 | CN = agent4 15 | emailAddress = ry@tinyclouds.org 16 | 17 | [ req_attributes ] 18 | challengePassword = A challenge password 19 | 20 | [ ext_key_usage ] 21 | extendedKeyUsage = clientAuth 22 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca1-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICazCCAdQCCQDyB/1ZCqtNHjANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV 3 | UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO 4 | BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA 5 | dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB6 6 | MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK 7 | EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqG 8 | SIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A 9 | MIGJAoGBALlUDB8Via9GfSvlfcIRGS1dr5HMfZz4ZBnHB4HJQbD8TXmNPL5Q5Flc 10 | AptUsjMPR6WxX4SOcl5NetXYZVNQ9jt7fPaLsWmSNbeICQva0bmgAazqIE3EZonm 11 | xNVVJ2luqet4D7oOKqS49lGEdpxC6TqayL3t5Zf+/mrSg9AMJTqhAgMBAAEwDQYJ 12 | KoZIhvcNAQEFBQADgYEAV2DqO9K9IPMD+f5CjWX1ZyklxXwezNacjArETjtMj885 13 | 70+bBGfX2+qnKAIWYh56DwPm3G+3kOqq6lP5njPWkEEOLZnx7R+sSaTVgpkKp4Sh 14 | E9p8/7eIw7AP5SZgqqVJ9ynyFeMkoY3FG2mwyQHAXHP546zReEHmFxYbFyBCN8I= 15 | -----END CERTIFICATE----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca1-cert.srl: -------------------------------------------------------------------------------- 1 | D0F28E241CA7423D 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca1-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,C8ED255DE57E8907 4 | 5 | X4qddPzwn6xPLKHbLPiv4HWhZXGAVOxWyPT8f/9EDpIoWOXt+UmS706knql2uiGN 6 | MgUAUhmt84WTW3v+2YaO+a6lkiUKY/yMHJjHEMrJLZMp/+DC0oc+yOf3FbQCql6m 7 | WE1MRUms8sYSAxl/dUXkmkkEfixzfd3Bi6G81iZIXhGDs7OFrKIiyRnuJn7tzXib 8 | I2gXxsaV/RIbUcWf1ZDKIL072qMlxCj7XmoniYCB21WiR6xAvBGHr5rvbqARqeg8 9 | 4JzbYHwzDCYmAKRsMHo7XxRuwfyP44i36HjNmn2WuNFJIQvVujMWKWkQVr0x1hTK 10 | wdQGaV4QaWJeRkTzNfJdxbrryRvrPHZKw1apuhuD3SzRWNUPpnUb0dhFw2CpfDhJ 11 | faIu4yQ0Jep9hZIvJCZdiTUN4ARH4a2Jnj6c0PqxOaTril6SmAtmZ0jQunvNEGEa 12 | ywdVCaLr19XQzOXbrHVROiqqPVDkIc9zTnirz4MhVMHNxz/f15+/MuXIDWrM3Vgq 13 | 6siUvdxmGsFNM4/k2fwzLn5AqVxqrIrQkXgpYyj6X8GYTQagTHgl83mkG43hWEGi 14 | 91aHQo5tRH/QuJhcHlhOp3NpmcEMCFif7awMsfSJeQ4j8STc7x8purLXwt90Vo/a 15 | zCNitSIqmlgi3vdV/K0V8Sfp+0JHvXoxGCDjyIiwoGYGI5nUO0TNJvdUzfpw5Mc5 16 | ekeBgAeH00Qi1iVh4WJr9+KLbpCqPd6CVQ+Ih15fD9hBNI2OkqYFHub+s0mJ0e2V 17 | Pcl8OTMyITN2JffKj9hzW3jzL/1x//DKeJ9JSlrJeglWmXpo3/lNKA== 18 | -----END RSA PRIVATE KEY----- 19 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca1.cnf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 1024 3 | days = 999 4 | distinguished_name = req_distinguished_name 5 | attributes = req_attributes 6 | prompt = no 7 | output_password = password 8 | 9 | [ req_distinguished_name ] 10 | C = US 11 | ST = CA 12 | L = SF 13 | O = Joyent 14 | OU = Node.js 15 | CN = ca1 16 | emailAddress = ry@tinyclouds.org 17 | 18 | [ req_attributes ] 19 | challengePassword = A challenge password 20 | 21 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICazCCAdQCCQCjhnGuhSJstTANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV 3 | UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO 4 | BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlA 5 | dGlueWNsb3Vkcy5vcmcwHhcNMTQwNzIzMTk1MTAwWhcNNDExMjA3MTk1MTAwWjB6 6 | MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK 7 | EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMjEgMB4GCSqG 8 | SIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A 9 | MIGJAoGBAOnywgPgUUTRrhZmcIV15zLXdozaMZLD3FNwleJMUF6j1BqsfvfSFv6A 10 | LGEJ/boM5pqXC89eIYDkIUUSNp5OJBl1ZrHvjjkoiFNUPpGHxezP2d5Tl7xU01V9 11 | MsUHZWDeeHxR/BdS9f0EpBe9dCBCC9SeqPOma8YXjdb8B1OM9JBrAgMBAAEwDQYJ 12 | KoZIhvcNAQEFBQADgYEAVmx9jU0qPT/R/bkWhs4LKDOGCiVDhA+fk+0Jl2l1ixH7 13 | XUaRwO7O9L9FomraM9De7K7+/gwThY/Hc9cMu6kwdipSM9FQVvfNWL/d4jQ4EoVQ 14 | mIyC455QW0+xVU4adALRV6xBrn/DpF8lBTIyyt5fHKfve8Cmxm1MeVK0fNnTuT8= 15 | -----END CERTIFICATE----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2-cert.srl: -------------------------------------------------------------------------------- 1 | 8306BE7DE1BB099C 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2-crl.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIBeTCB4zANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJVUzELMAkGA1UECBMC 3 | Q0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUu 4 | anMxDDAKBgNVBAMTA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5v 5 | cmcXDTE0MDcyMzE5NTEwMFoXDTE3MDQxNzE5NTEwMFowODAaAgkAgwa+feG7CZoX 6 | DTExMDMxNDE4MjkxNFowGgIJAIMGvn3huwmcFw0xNDA3MjMxOTUxMDBaMA0GCSqG 7 | SIb3DQEBBAUAA4GBANjskxPFHIYOxYD6q42o6wJqHZx5mvslAOhWxkMqwQGu5Z6i 8 | zcKsdbD/l4F+SWB1iXMeQGxxKU4zqcjzo8N2YM9aNzGERqaGueIYu7ghN2n+80Sq 9 | ce5xwjRHxTTq6I1PQArDyuoG4yRAeZBr9uKYtyXsYeZq1EdLooFbUAkPRB+Z 10 | -----END X509 CRL----- 11 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2-database.txt: -------------------------------------------------------------------------------- 1 | R 380729182912Z 110314182914Z 8306BE7DE1BB099A unknown /C=US/ST=CA/L=SF/O=Joyent/OU=Node.js/CN=agent4/emailAddress=ry@tinyclouds.org 2 | R 411207195100Z 140723195100Z 8306BE7DE1BB099C unknown /C=US/ST=CA/L=SF/O=Joyent/OU=Node.js/CN=agent4/emailAddress=ry@tinyclouds.org 3 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,EE51F4BF188048BF 4 | 5 | r/NJ5tr2nsCWRuDEuElhG238GeC+EO2rLw0HEacCToZmfGmExSLLB7xxFIMzy7Bd 6 | ccu8S39AtnHfFEs87Zi5cy6WKk7PZt5ll5gE7kfzDjEl/zx6aQbXsNkOE1d4HDr9 7 | fWfAbm1AwnXU0A93kIJco5P8fUZ4RoHbEndI/gnFv7coAZi4ivZBvAkFEdtEx4Ok 8 | WVTz3wSB0gg6/wkfdbVv435e1YByJz79jZKpLHarc0k0W6l+/2KcR22mCQ+3USBz 9 | xytbNhFwEiBnmp/zfP9ggFZt0ZYXb7r2Ddpc7hUIolA3wTlyjKHjYLcPzOl1PTQU 10 | dAHzKXN5QuXx++Mm6S3G/xo/f5PQOs1WKEWoCi3VPf/JrpuRaHimqXp5oEEugCCz 11 | J3YfIUu05cRBP22jT9n6IsXxtQIbZGcYzhVIenzw6K4O3Cn73iWjJVtfKVePLsF5 12 | cozx4ozrY2uIc9F2nvP9gA28YizArK4Dv5Q0Jt77YZR2aB6A7z0qhtQl/Omzs9/S 13 | ddvbysa98S9xb3okWo6/5bmG3cIIhbr/60L0P6+HwKJROZ4zAQh3LLmiGe7gKpJM 14 | ozqgxAYFUD56lkuUJnhdFoPonkVPZ1hBdBMQymECdfVL+WwWjZ8ZFghclhu932T4 15 | 7Nmp30fQORUld7/PIdAc/wKk4x2IoTcRW/HY73QUwO/BCw/g3YUVqB7G8keh8Mcv 16 | XOdWaQSebtxJ41SnFZfDUTBvGHrmr22YZJeU0gtiJdQR5m86ZG8h9tNK8wXWzNkn 17 | VKMf4M1tTrdr4Uhhoeh3A38zCs0Pa+JopsoWuFjDNteBdYAeopYY2A== 18 | -----END RSA PRIVATE KEY----- 19 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2-serial: -------------------------------------------------------------------------------- 1 | 01 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/keys/ca2.cnf: -------------------------------------------------------------------------------- 1 | [ ca ] 2 | default_ca = CA_default 3 | 4 | [ CA_default ] 5 | serial = ca2-serial 6 | crl = ca2-crl.pem 7 | database = ca2-database.txt 8 | name_opt = CA_default 9 | cert_opt = CA_default 10 | default_crl_days = 999 11 | default_md = md5 12 | 13 | 14 | [ req ] 15 | default_bits = 1024 16 | days = 999 17 | distinguished_name = req_distinguished_name 18 | attributes = req_attributes 19 | prompt = no 20 | output_password = password 21 | 22 | [ req_distinguished_name ] 23 | C = US 24 | ST = CA 25 | L = SF 26 | O = Joyent 27 | OU = Node.js 28 | CN = ca2 29 | emailAddress = ry@tinyclouds.org 30 | 31 | [ req_attributes ] 32 | challengePassword = A challenge password 33 | 34 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file1: -------------------------------------------------------------------------------- 1 | exports.file1 = 'file1'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file1.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file1 = 'file1.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file1.node: -------------------------------------------------------------------------------- 1 | exports.file1 = 'file1.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file1.reg: -------------------------------------------------------------------------------- 1 | exports.file1 = 'file1.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file1.reg2: -------------------------------------------------------------------------------- 1 | exports.file1 = 'file1.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file2 = 'file2.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2.node: -------------------------------------------------------------------------------- 1 | exports.file2 = 'file2.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2.reg: -------------------------------------------------------------------------------- 1 | exports.file2 = 'file2.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2.reg2: -------------------------------------------------------------------------------- 1 | exports.file2 = 'file2.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file2 = 'file2/index.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2/index.node: -------------------------------------------------------------------------------- 1 | exports.file2 = 'file2/index.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2/index.reg: -------------------------------------------------------------------------------- 1 | exports.file2 = 'file2/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file2/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file2 = 'file2/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3.node: -------------------------------------------------------------------------------- 1 | exports.file3 = 'file3.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3.reg: -------------------------------------------------------------------------------- 1 | exports.file3 = 'file3.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3.reg2: -------------------------------------------------------------------------------- 1 | exports.file3 = 'file3.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file3 = 'file3/index.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3/index.node: -------------------------------------------------------------------------------- 1 | exports.file3 = 'file3/index.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3/index.reg: -------------------------------------------------------------------------------- 1 | exports.file3 = 'file3/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file3/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file3 = 'file3/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file4.reg: -------------------------------------------------------------------------------- 1 | exports.file4 = 'file4.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file4.reg2: -------------------------------------------------------------------------------- 1 | exports.file4 = 'file4.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file4/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file4 = 'file4/index.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file4/index.node: -------------------------------------------------------------------------------- 1 | exports.file4 = 'file4/index.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file4/index.reg: -------------------------------------------------------------------------------- 1 | exports.file4 = 'file4/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file4/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file4 = 'file4/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file5.reg2: -------------------------------------------------------------------------------- 1 | exports.file5 = 'file5.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file5/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file5 = 'file5/index.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file5/index.node: -------------------------------------------------------------------------------- 1 | exports.file5 = 'file5/index.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file5/index.reg: -------------------------------------------------------------------------------- 1 | exports.file5 = 'file5/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file5/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file5 = 'file5/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file6/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.file6 = 'file6/index.js'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file6/index.node: -------------------------------------------------------------------------------- 1 | exports.file6 = 'file6/index.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file6/index.reg: -------------------------------------------------------------------------------- 1 | exports.file6 = 'file6/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file6/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file6 = 'file6/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file7/index.node: -------------------------------------------------------------------------------- 1 | exports.file7 = 'file7/index.node'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file7/index.reg: -------------------------------------------------------------------------------- 1 | exports.file7 = 'file7/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file7/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file7 = 'file7/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file8/index.reg: -------------------------------------------------------------------------------- 1 | exports.file8 = 'file8/index.reg'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file8/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file8 = 'file8/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-load-order/file9/index.reg2: -------------------------------------------------------------------------------- 1 | exports.file9 = 'file9/index.reg2'; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-loading-error.node: -------------------------------------------------------------------------------- 1 | foobar 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-require/child/index.js: -------------------------------------------------------------------------------- 1 | exports.loaded = require('target'); 2 | exports.module = module; 3 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/module-require/parent/index.js: -------------------------------------------------------------------------------- 1 | var child = require('../child'); 2 | //console.log(child.module.require, child.module); 3 | console.log(child.module.require('target')); 4 | console.log(child.loaded); 5 | exports.loaded = child.module.require('target'); 6 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/msca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD 3 | VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv 4 | bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv 5 | b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV 6 | UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU 7 | cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds 8 | b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH 9 | iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS 10 | r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4 11 | 04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r 12 | GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9 13 | 3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P 14 | lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ 15 | -----END CERTIFICATE----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/multi-alice.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDnjCCAoYCCQCXooHS0l6bHDANBgkqhkiG9w0BAQUFADCBkDELMAkGA1UEBhMC 3 | QVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdp 4 | dHMgUHR5IEx0ZDEfMB0GA1UECwwWSW5mb3JtYXRpb24gVGVjaG5vbG9neTEUMBIG 5 | A1UECwwLRW5naW5lZXJpbmcxEjAQBgNVBAsMCU1hcmtldGluZzAeFw0xMjAzMDQx 6 | NDA4MDVaFw0xMjA0MDMxNDA4MDVaMIGQMQswCQYDVQQGEwJBVTETMBEGA1UECAwK 7 | U29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMR8w 8 | HQYDVQQLDBZJbmZvcm1hdGlvbiBUZWNobm9sb2d5MRQwEgYDVQQLDAtFbmdpbmVl 9 | cmluZzESMBAGA1UECwwJTWFya2V0aW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A 10 | MIIBCgKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEVwfPQ 11 | Qp4XwtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+1FAE 12 | 0c5oexPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404Wthq 13 | uTqgS7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy25IyB 14 | K3QJc+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWAQsqW 15 | +COL0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABMA0GCSqGSIb3DQEBBQUAA4IB 16 | AQC7kyzjGXy7SnT1tvefdvtdAtErDuD375/sB2l1V72+BNXlIlddmEC8IkAVSKg2 17 | 5Y7MuQ4yMsHlhrdUxj/XOOVMHY/49xsZiN5hF2jb2mdq7KdvlVMYqyf126bW2mOx 18 | cLVSiuucdp88zoJopWBUnNyVOYhh18St9bNosGgPzppGBCpL+MJvoSn3wrnFn8ER 19 | wwN1m3ga590wHa4fny+qlD/hJNww16wbwgdF9NqsuR/e+sj9ZsoIYRCF8iKBajzt 20 | 3o7cZIRlvGtJfJRM87YCAn4BR3JgQPXfbhx31KwtMXtAJNzOHk26bblW3jTC8c7+ 21 | Cu1gNEM083vUq6/UxJUM8lOM 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/nested-index/one/hello.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.hello = 'hello from one!'; 23 | 24 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/nested-index/one/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.hello = require('./hello').hello; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/nested-index/three.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/nested-index/three/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/nested-index/two/hello.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.hello = 'hello from two!'; 23 | 24 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/nested-index/two/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.hello = require('./hello').hello; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/net-fd-passing-receiver.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | process.mixin(require('../common')); 23 | net = require('net'); 24 | 25 | path = process.ARGV[2]; 26 | greeting = process.ARGV[3]; 27 | 28 | receiver = net.createServer(function(socket) { 29 | socket.on('fd', function(fd) { 30 | var peerInfo = process.getpeername(fd); 31 | peerInfo.fd = fd; 32 | var passedSocket = new net.Socket(peerInfo); 33 | 34 | passedSocket.on('eof', function() { 35 | passedSocket.close(); 36 | }); 37 | 38 | passedSocket.on('data', function(data) { 39 | passedSocket.send('[echo] ' + data); 40 | }); 41 | passedSocket.on('close', function() { 42 | receiver.close(); 43 | }); 44 | passedSocket.send('[greeting] ' + greeting); 45 | }); 46 | }); 47 | 48 | /* To signal the test runne we're up and listening */ 49 | receiver.on('listening', function() { 50 | common.print('ready'); 51 | }); 52 | 53 | receiver.listen(path); 54 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/not-main-module.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var assert = require('assert'); 23 | assert.notEqual(module, require.main, 'require.main should not == module'); 24 | assert.notEqual(module, process.mainModule, 25 | 'process.mainModule should not === module'); 26 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/packages/main-index/package-main-module/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.ok = 'ok'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/packages/main-index/package.json: -------------------------------------------------------------------------------- 1 | {"name":"package-name" 2 | ,"version":"1.2.3" 3 | ,"main":"package-main-module"} 4 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/packages/main/package-main-module.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | exports.ok = 'ok'; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/packages/main/package.json: -------------------------------------------------------------------------------- 1 | {"name":"package-name" 2 | ,"version":"1.2.3" 3 | ,"main":"package-main-module"} 4 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/parent-process-nonpersistent.js: -------------------------------------------------------------------------------- 1 | 2 | var spawn = require('child_process').spawn, 3 | path = require('path'), 4 | childPath = path.join(__dirname, 'child-process-persistent.js'); 5 | 6 | var child = spawn(process.execPath, [ childPath ], { 7 | detached: true, 8 | stdio: 'ignore' 9 | }); 10 | 11 | console.log(child.pid); 12 | 13 | child.unref(); 14 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/pass-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB2TCCAUICCQDQv9q5AAtoEzANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJK 3 | UDEOMAwGA1UECBMFVG9reW8xEjAQBgNVBAoUCW5vZGVqc19qcDAeFw0xMTExMjYx 4 | NzA0MDhaFw0yMTExMjMxNzA0MDhaMDExCzAJBgNVBAYTAkpQMQ4wDAYDVQQIEwVU 5 | b2t5bzESMBAGA1UEChQJbm9kZWpzX2pwMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB 6 | iQKBgQChmQeFwsaomtQbw9Nm55Dn6KSR9bkY8PDroQUeTNa90BlIbhGsKYm4l7bE 7 | RaasFgOrkcQpk45fdDVYPjKxraZiGXXKjSIDYeDAIC/+CkwQKrejgCPmJs4gV4g+ 8 | npvwi1gVr2NAg7fkJOyEW2TDp4dsAD8qtG8Aml0C1hJXwFYmBwIDAQABMA0GCSqG 9 | SIb3DQEBBQUAA4GBAGJYkr3VgHUZSyGrdUWeGKiKS4EY3D4ki8Luv9Jf/IpxJLbZ 10 | NGaKUbXSVYSW3US0yR1+lsNvWchmc0wLsbNEHbIiS4BQPkqX7F8FCthM1gwRLQPa 11 | Sofz3dRNFKDmivG9mdbQDPD/duft7Kn6E3JS5myYUJ0dRKeYfOXLXCY2pZpG 12 | -----END CERTIFICATE----- 13 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/pass-csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIBcDCB2gIBADAxMQswCQYDVQQGEwJKUDEOMAwGA1UECBMFVG9reW8xEjAQBgNV 3 | BAoUCW5vZGVqc19qcDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAoZkHhcLG 4 | qJrUG8PTZueQ5+ikkfW5GPDw66EFHkzWvdAZSG4RrCmJuJe2xEWmrBYDq5HEKZOO 5 | X3Q1WD4ysa2mYhl1yo0iA2HgwCAv/gpMECq3o4Aj5ibOIFeIPp6b8ItYFa9jQIO3 6 | 5CTshFtkw6eHbAA/KrRvAJpdAtYSV8BWJgcCAwEAAaAAMA0GCSqGSIb3DQEBBQUA 7 | A4GBAC9g7s3rG6G7JSTUOizY1u9Ij6QM9Y6PqQthr4OJHa+Hln5FJQahpgJmA4kC 8 | WYoWvBMBgFPFBCYAj0yMPohrlAwlbd9MADe4gg3lxuO9UxXDzp/lOVRBAEa4n5i+ 9 | Lw7VEiJtPha4NXgeNzxi5OyBJwxAOPFwsyCdR0SynlifTFHI 10 | -----END CERTIFICATE REQUEST----- 11 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/pass-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,CE30CF10CDD3C074 4 | 5 | A9Vjoxw1Z6pfyxMHXxDi88JVcLN0uWJAjo97nsdzV1cYmEk4bQUe6XVu8UGCzbYX 6 | 1RVeglOwyKfp631l5j5KHNfzA4lEU46uqAkRZbkzaHg6sVK7nuSBamiDqkO+BSEU 7 | kDCDqImcx+wUXjlFsYc2UO3DJen8QVEVYQthpxqS7UGh6SCGKyb8FzHu+nzOtRrZ 8 | y2Y9r8vyllH5+qxyGymkJJgPGYd9a/q3uTjxjBsb252SC6JEMt/njXdtlt3zUCQl 9 | 8aEok8xXIyDFsrhkQ1chXYt/neWdgVh+R9HulVvSLKkACSfX19F2ooIIWhoml4C1 10 | VE9iX7wytbD7LxLK4kWQL0sRi0MQPwBEag6m9K6skcsN8qIRJwJZeevc3xw+08uI 11 | IqUL4Ouy+eNMYQIxxgKBcgVWV51X1HWCcwjBkDp9x/qU+URKBmGcpTKEiOrKGG/I 12 | 8JN3IreJU5EhtGqE15J4ep/hS4CwJ9+CFysRs0vFCw24GS+O2CXWT9rgza4VX1we 13 | dUVnGGodJcXgAf0sNECm8zYk2fjy1SICm+fknsN466d2pmCO43/WpBhZyjbLEHsJ 14 | a5pUVQroZdU2W70eGh2yIGVrMmgVbYPitTBafruW8w03oarG4XWA4caEmJMEVC68 15 | WZxuQ1Wg1J+fNl+Klq3b+4yImmoFrelh2gBANwYKnE9Z+JLtfv01et9DNOXR2DQM 16 | 6pPzrL0JUHetqko4mJTVNvW8h/Jv+0UVwmxmwm6mR4IBcKwQyY5V5VqeFfnXlvM1 17 | xpg33AEKNquAPC8G4pIHwG4aBo9fLp+I3cxPuY6dnR6i2tyQ5ONvvw== 18 | -----END RSA PRIVATE KEY----- 19 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/person.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/person.jpg -------------------------------------------------------------------------------- /test/node-tests/fixtures/person.jpg.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/person.jpg.gz -------------------------------------------------------------------------------- /test/node-tests/fixtures/print-10-lines.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | for (var i = 0; i < 10; i++) { 23 | console.log('count ' + i); 24 | } 25 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/print-chars-from-buffer.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common'); 23 | var assert = require('assert'); 24 | 25 | var n = parseInt(process.argv[2]); 26 | 27 | var b = new Buffer(n); 28 | for (var i = 0; i < n; i++) { 29 | b[i] = 100; 30 | } 31 | 32 | process.stdout.write(b); 33 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/print-chars.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common'); 23 | var assert = require('assert'); 24 | 25 | var n = parseInt(process.argv[2]); 26 | 27 | var s = ''; 28 | for (var i = 0; i < n; i++) { 29 | s += 'c'; 30 | } 31 | 32 | process.stdout.write(s); 33 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/are: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/are -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/dir/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/dir/empty -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/empty -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/files: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/files -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/for: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/for -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/just: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/just -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/testing.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/readdir/these: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/readdir/these -------------------------------------------------------------------------------- /test/node-tests/fixtures/recvfd.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // See test/simple/test-sendfd.js for a complete description of what this 23 | // script is doing and how it fits into the test as a whole. 24 | 25 | var net = require('net'); 26 | 27 | var receivedData = []; 28 | var receivedFDs = []; 29 | var numSentMessages = 0; 30 | 31 | function processData(s) { 32 | if (receivedData.length == 0 || receivedFDs.length == 0) { 33 | return; 34 | } 35 | 36 | var fd = receivedFDs.shift(); 37 | var d = receivedData.shift(); 38 | 39 | // Augment our received object before sending it back across the pipe. 40 | d.pid = process.pid; 41 | 42 | // Create a stream around the FD that we received and send a serialized 43 | // version of our modified object back. Clean up when we're done. 44 | var pipeStream = new net.Stream(fd); 45 | 46 | var drainFunc = function() { 47 | pipeStream.destroy(); 48 | 49 | if (++numSentMessages == 2) { 50 | s.destroy(); 51 | } 52 | }; 53 | 54 | pipeStream.on('drain', drainFunc); 55 | pipeStream.resume(); 56 | 57 | if (pipeStream.write(JSON.stringify(d) + '\n')) { 58 | drainFunc(); 59 | } 60 | } 61 | 62 | // Create a UNIX socket to the path defined by argv[2] and read a file 63 | // descriptor and misc data from it. 64 | var s = new net.Stream(); 65 | s.on('fd', function(fd) { 66 | receivedFDs.unshift(fd); 67 | processData(s); 68 | }); 69 | s.on('data', function(data) { 70 | data.toString('utf8').trim().split('\n').forEach(function(d) { 71 | receivedData.unshift(JSON.parse(d)); 72 | }); 73 | processData(s); 74 | }); 75 | s.connect(process.argv[2]); 76 | 77 | // vim:ts=2 sw=2 et 78 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/registerExt.hello.world: -------------------------------------------------------------------------------- 1 | exports.test = 'passed' 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/registerExt.test: -------------------------------------------------------------------------------- 1 | this is custom source 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/registerExt2.test: -------------------------------------------------------------------------------- 1 | This is for the object return test 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/sample.png -------------------------------------------------------------------------------- /test/node-tests/fixtures/semicolon.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | ; 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/should_exit.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | function tmp() {} 23 | process.on('SIGINT', tmp); 24 | process.removeListener('SIGINT', tmp); 25 | setInterval(function() { 26 | process.stdout.write('keep alive\n'); 27 | }, 1000); 28 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/stdio-filter.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var util = require('util'); 23 | 24 | var regexIn = process.argv[2]; 25 | var replacement = process.argv[3]; 26 | var re = new RegExp(regexIn, 'g'); 27 | var stdin = process.openStdin(); 28 | 29 | stdin.on('data', function(data) { 30 | data = data.toString(); 31 | process.stdout.write(data.replace(re, replacement)); 32 | }); 33 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test-fs-readfile-error.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | require('fs').readFile('/'); // throws EISDIR 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test-init-index/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | (function() { 23 | require('util').print('Loaded successfully!'); 24 | })(); 25 | 26 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test-init-native/fs.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | (function() { 23 | var fs = require('fs'); 24 | if (fs.readFile) { 25 | require('util').print('fs loaded successfully'); 26 | } 27 | })(); 28 | 29 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test-regress-GH-4015.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | function load() { 4 | fs.statSync('.'); 5 | load(); 6 | } 7 | load(); 8 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDXDCCAsWgAwIBAgIJAKL0UG+mRkSPMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNV 3 | BAYTAlVLMRQwEgYDVQQIEwtBY2tuYWNrIEx0ZDETMBEGA1UEBxMKUmh5cyBKb25l 4 | czEQMA4GA1UEChMHbm9kZS5qczEdMBsGA1UECxMUVGVzdCBUTFMgQ2VydGlmaWNh 5 | dGUxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wOTExMTEwOTUyMjJaFw0yOTExMDYw 6 | OTUyMjJaMH0xCzAJBgNVBAYTAlVLMRQwEgYDVQQIEwtBY2tuYWNrIEx0ZDETMBEG 7 | A1UEBxMKUmh5cyBKb25lczEQMA4GA1UEChMHbm9kZS5qczEdMBsGA1UECxMUVGVz 8 | dCBUTFMgQ2VydGlmaWNhdGUxEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG 9 | 9w0BAQEFAAOBjQAwgYkCgYEA8d8Hc6atq78Jt1HLp9agA/wpQfsFvkYUdZ1YsdvO 10 | kL2janjwHQgMMCy/Njal3FUEW0OLPebKZUJ8L44JBXSlVxU4zyiiSOWld8EkTetR 11 | AVT3WKQq3ud+cnxv7g8rGRQp1UHZwmdbZ1wEfAYq8QjYx6m1ciMgRo7DaDQhD29k 12 | d+UCAwEAAaOB4zCB4DAdBgNVHQ4EFgQUL9miTJn+HKNuTmx/oMWlZP9cd4QwgbAG 13 | A1UdIwSBqDCBpYAUL9miTJn+HKNuTmx/oMWlZP9cd4ShgYGkfzB9MQswCQYDVQQG 14 | EwJVSzEUMBIGA1UECBMLQWNrbmFjayBMdGQxEzARBgNVBAcTClJoeXMgSm9uZXMx 15 | EDAOBgNVBAoTB25vZGUuanMxHTAbBgNVBAsTFFRlc3QgVExTIENlcnRpZmljYXRl 16 | MRIwEAYDVQQDEwlsb2NhbGhvc3SCCQCi9FBvpkZEjzAMBgNVHRMEBTADAQH/MA0G 17 | CSqGSIb3DQEBBQUAA4GBADRXXA2xSUK5W1i3oLYWW6NEDVWkTQ9RveplyeS9MOkP 18 | e7yPcpz0+O0ZDDrxR9chAiZ7fmdBBX1Tr+pIuCrG/Ud49SBqeS5aMJGVwiSd7o1n 19 | dhU2Sz3Q60DwJEL1VenQHiVYlWWtqXBThe9ggqRPnCfsCRTP8qifKkjk45zWPcpN 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDXDCCAsWgAwIBAgIJAKL0UG+mRkSPMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNV 3 | BAYTAlVLMRQwEgYDVQQIEwtBY2tuYWNrIEx0ZDETMBEGA1UEBxMKUmh5cyBKb25l 4 | czEQMA4GA1UEChMHbm9kZS5qczEdMBsGA1UECxMUVGVzdCBUTFMgQ2VydGlmaWNh 5 | dGUxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wOTExMTEwOTUyMjJaFw0yOTExMDYw 6 | OTUyMjJaMH0xCzAJBgNVBAYTAlVLMRQwEgYDVQQIEwtBY2tuYWNrIEx0ZDETMBEG 7 | A1UEBxMKUmh5cyBKb25lczEQMA4GA1UEChMHbm9kZS5qczEdMBsGA1UECxMUVGVz 8 | dCBUTFMgQ2VydGlmaWNhdGUxEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG 9 | 9w0BAQEFAAOBjQAwgYkCgYEA8d8Hc6atq78Jt1HLp9agA/wpQfsFvkYUdZ1YsdvO 10 | kL2janjwHQgMMCy/Njal3FUEW0OLPebKZUJ8L44JBXSlVxU4zyiiSOWld8EkTetR 11 | AVT3WKQq3ud+cnxv7g8rGRQp1UHZwmdbZ1wEfAYq8QjYx6m1ciMgRo7DaDQhD29k 12 | d+UCAwEAAaOB4zCB4DAdBgNVHQ4EFgQUL9miTJn+HKNuTmx/oMWlZP9cd4QwgbAG 13 | A1UdIwSBqDCBpYAUL9miTJn+HKNuTmx/oMWlZP9cd4ShgYGkfzB9MQswCQYDVQQG 14 | EwJVSzEUMBIGA1UECBMLQWNrbmFjayBMdGQxEzARBgNVBAcTClJoeXMgSm9uZXMx 15 | EDAOBgNVBAoTB25vZGUuanMxHTAbBgNVBAsTFFRlc3QgVExTIENlcnRpZmljYXRl 16 | MRIwEAYDVQQDEwlsb2NhbGhvc3SCCQCi9FBvpkZEjzAMBgNVHRMEBTADAQH/MA0G 17 | CSqGSIb3DQEBBQUAA4GBADRXXA2xSUK5W1i3oLYWW6NEDVWkTQ9RveplyeS9MOkP 18 | e7yPcpz0+O0ZDDrxR9chAiZ7fmdBBX1Tr+pIuCrG/Ud49SBqeS5aMJGVwiSd7o1n 19 | dhU2Sz3Q60DwJEL1VenQHiVYlWWtqXBThe9ggqRPnCfsCRTP8qifKkjk45zWPcpN 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_cert.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strongloop/zone/5c778e4a3d7ea82f3f85ebf801e54ef4b7126d7b/test/node-tests/fixtures/test_cert.pfx -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_dsa_params.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PARAMETERS----- 2 | MIICIAKCAQEAiJCR40HCtA6pk864XhKceke8N4chlrpwcphAXpHwSQGHlv1JJFyj 3 | aPqugWtzwZH55g7qpIiT3fmg6V6PfzNfx4sQGlSjckZaN02WRUAacn0va6UbwyYV 4 | 7LZzuHlHzayHLl/btGeTF+zL+9eMLKfll+r+5bJXDMWh3xUD1Nldf+fsIsbVZI9Q 5 | Nzf3L1/07XVTLedQYaE77OqVuu+cfoBtb+K5MsQdHMMN20BGjKIvGkJICuC448Gk 6 | Dx1wpxz2vSJEi6FqXruM6c9yrPvhJKSfbVFYK2n82MMXMNNu9Dwqwsv6Ig6dIVyw 7 | dKDrSw1Nz9j9TWA5BolNta3yMPHrEjCuIQIVAKq0ZZ0/36sZE1cqt6j0hZTisWUV 8 | AoIBAFbI9MKn9DBJ7lo7+LRblgNKg9lk4D/6NBBRgOeCN4WnOxHQrqpSTUBG+VcA 9 | BDKEfoHfEPI9KZKpEgpzGTpr7mGxDPLHfGL+vvf1EYbmcTDrUWlf9B/3+L3uwIdd 10 | v3NYLepyEZ8L8g6eRGSQ4Svg1oSR/GAUTeGJczPg6qW0b/LTpf4eeDNWYGF6aogJ 11 | UphnPcZ0Xqw+yvq/i1uzAVirUxp9Crb7km0dfA0G/HBiSdcEt6l8LdQd6qmcL0nx 12 | cm9x6L+tSol5hXNynV0wcxdCQz4Xj5na+NoRGb9jPYxgLkoq07hwAkqkQDyF61tx 13 | fWgGc7zmh/x6JMGe/Xhg1TvgxLs= 14 | -----END DSA PARAMETERS----- 15 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_dsa_privkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIDPwIBAAKCAQEAiJCR40HCtA6pk864XhKceke8N4chlrpwcphAXpHwSQGHlv1J 3 | JFyjaPqugWtzwZH55g7qpIiT3fmg6V6PfzNfx4sQGlSjckZaN02WRUAacn0va6Ub 4 | wyYV7LZzuHlHzayHLl/btGeTF+zL+9eMLKfll+r+5bJXDMWh3xUD1Nldf+fsIsbV 5 | ZI9QNzf3L1/07XVTLedQYaE77OqVuu+cfoBtb+K5MsQdHMMN20BGjKIvGkJICuC4 6 | 48GkDx1wpxz2vSJEi6FqXruM6c9yrPvhJKSfbVFYK2n82MMXMNNu9Dwqwsv6Ig6d 7 | IVywdKDrSw1Nz9j9TWA5BolNta3yMPHrEjCuIQIVAKq0ZZ0/36sZE1cqt6j0hZTi 8 | sWUVAoIBAFbI9MKn9DBJ7lo7+LRblgNKg9lk4D/6NBBRgOeCN4WnOxHQrqpSTUBG 9 | +VcABDKEfoHfEPI9KZKpEgpzGTpr7mGxDPLHfGL+vvf1EYbmcTDrUWlf9B/3+L3u 10 | wIddv3NYLepyEZ8L8g6eRGSQ4Svg1oSR/GAUTeGJczPg6qW0b/LTpf4eeDNWYGF6 11 | aogJUphnPcZ0Xqw+yvq/i1uzAVirUxp9Crb7km0dfA0G/HBiSdcEt6l8LdQd6qmc 12 | L0nxcm9x6L+tSol5hXNynV0wcxdCQz4Xj5na+NoRGb9jPYxgLkoq07hwAkqkQDyF 13 | 61txfWgGc7zmh/x6JMGe/Xhg1TvgxLsCggEBAIXcOokkhVjC+i/I/grM9qTh6fCV 14 | jzSbOsIVi9Hfj7GCTRYA/QFnNbiWbOWzP7t2cEQFLfZoJmTK71+htZql9/GRMzV+ 15 | dnyhwuRh9YWkuCOlFHD7hDFBC+e1VqhV7ltaokqkZU18BsmgZG/fxeqOAfElEKLE 16 | 796rOAXmtx8F14Mn+IQteEAmifF1140C0bFzH67RSZU13pRCB7TKbruTevnhdQct 17 | LOzhgpMuoEWAjSWni5+WklOg/LxrMZ7MFz+Kqph1PxSX7kg/S8yCjNFtaviY7HrJ 18 | E7wUqi3Z/VPV4HKGeHzX1k1Z9RE/oJTsR2yT2rtJvSGO9lDk6Fj5tIv1fC8CFQCd 19 | 3V7C07NVeTiUU1WTP2nFNgMqEQ== 20 | -----END DSA PRIVATE KEY----- 21 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_dsa_pubkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQCIkJHjQcK0DqmTzrheEpx6R7w3hyGW 3 | unBymEBekfBJAYeW/UkkXKNo+q6Ba3PBkfnmDuqkiJPd+aDpXo9/M1/HixAaVKNy 4 | Rlo3TZZFQBpyfS9rpRvDJhXstnO4eUfNrIcuX9u0Z5MX7Mv714wsp+WX6v7lslcM 5 | xaHfFQPU2V1/5+wixtVkj1A3N/cvX/TtdVMt51BhoTvs6pW675x+gG1v4rkyxB0c 6 | ww3bQEaMoi8aQkgK4LjjwaQPHXCnHPa9IkSLoWpeu4zpz3Ks++EkpJ9tUVgrafzY 7 | wxcw0270PCrCy/oiDp0hXLB0oOtLDU3P2P1NYDkGiU21rfIw8esSMK4hAhUAqrRl 8 | nT/fqxkTVyq3qPSFlOKxZRUCggEAVsj0wqf0MEnuWjv4tFuWA0qD2WTgP/o0EFGA 9 | 54I3hac7EdCuqlJNQEb5VwAEMoR+gd8Q8j0pkqkSCnMZOmvuYbEM8sd8Yv6+9/UR 10 | huZxMOtRaV/0H/f4ve7Ah12/c1gt6nIRnwvyDp5EZJDhK+DWhJH8YBRN4YlzM+Dq 11 | pbRv8tOl/h54M1ZgYXpqiAlSmGc9xnRerD7K+r+LW7MBWKtTGn0KtvuSbR18DQb8 12 | cGJJ1wS3qXwt1B3qqZwvSfFyb3Hov61KiXmFc3KdXTBzF0JDPhePmdr42hEZv2M9 13 | jGAuSirTuHACSqRAPIXrW3F9aAZzvOaH/HokwZ79eGDVO+DEuwOCAQYAAoIBAQCF 14 | 3DqJJIVYwvovyP4KzPak4enwlY80mzrCFYvR34+xgk0WAP0BZzW4lmzlsz+7dnBE 15 | BS32aCZkyu9fobWapffxkTM1fnZ8ocLkYfWFpLgjpRRw+4QxQQvntVaoVe5bWqJK 16 | pGVNfAbJoGRv38XqjgHxJRCixO/eqzgF5rcfBdeDJ/iELXhAJonxddeNAtGxcx+u 17 | 0UmVNd6UQge0ym67k3r54XUHLSzs4YKTLqBFgI0lp4uflpJToPy8azGezBc/iqqY 18 | dT8Ul+5IP0vMgozRbWr4mOx6yRO8FKot2f1T1eByhnh819ZNWfURP6CU7Edsk9q7 19 | Sb0hjvZQ5OhY+bSL9Xwv 20 | -----END PUBLIC KEY----- 21 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXQIBAAKBgQDx3wdzpq2rvwm3Ucun1qAD/ClB+wW+RhR1nVix286QvaNqePAd 3 | CAwwLL82NqXcVQRbQ4s95splQnwvjgkFdKVXFTjPKKJI5aV3wSRN61EBVPdYpCre 4 | 535yfG/uDysZFCnVQdnCZ1tnXAR8BirxCNjHqbVyIyBGjsNoNCEPb2R35QIDAQAB 5 | AoGBAJNem9C4ftrFNGtQ2DB0Udz7uDuucepkErUy4MbFsc947GfENjDKJXr42Kx0 6 | kYx09ImS1vUpeKpH3xiuhwqe7tm4FsCBg4TYqQle14oxxm7TNeBwwGC3OB7hiokb 7 | aAjbPZ1hAuNs6ms3Ybvvj6Lmxzx42m8O5DXCG2/f+KMvaNUhAkEA/ekrOsWkNoW9 8 | 2n3m+msdVuxeek4B87EoTOtzCXb1dybIZUVv4J48VAiM43hhZHWZck2boD/hhwjC 9 | M5NWd4oY6QJBAPPcgBVNdNZSZ8hR4ogI4nzwWrQhl9MRbqqtfOn2TK/tjMv10ALg 10 | lPmn3SaPSNRPKD2hoLbFuHFERlcS79pbCZ0CQQChX3PuIna/gDitiJ8oQLOg7xEM 11 | wk9TRiDK4kl2lnhjhe6PDpaQN4E4F0cTuwqLAoLHtrNWIcOAQvzKMrYdu1MhAkBm 12 | Et3qDMnjDAs05lGT72QeN90/mPAcASf5eTTYGahv21cb6IBxM+AnwAPpqAAsHhYR 13 | 9h13Y7uYbaOjvuF23LRhAkBoI9eaSMn+l81WXOVUHnzh3ZwB4GuTyxMXXNOhuiFd 14 | 0z4LKAMh99Z4xQmqSoEkXsfM4KPpfhYjF/bwIcP5gOei 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_rsa_privkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF 3 | NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F 4 | UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB 5 | AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA 6 | QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK 7 | kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg 8 | f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u 9 | 412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc 10 | mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 11 | kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA 12 | gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW 13 | G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI 14 | 7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_rsa_privkey_2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICWQIBAAKBgQCsMgRdxxEeeXscPvqFzp/6/IIdoeKSlBn7361FWZwMQUG0qCbr 3 | XYtdXPyqp2B4GThviIqiaJZITCTY87CiV7bFvH2lmUMJLsCc3BaQ4XFQbEU5D5jN 4 | FfP7g78MEKbCb9rEfYMI2EGwbfKRUZUrYeBadzIMHEMEHDyiBXrCohTXMQIBIwKB 5 | gHEoLsFITRQGr/yeah1qhmMa9ms+fvKb1o+S/NXNLAgNoDTjh0o2KGHspgm+cpgQ 6 | kszzU8nPszbS86SC4cnEnKy/g3uw3Lf55a2P8vgh1P386/PzI+Im8s6E/EpDwn/P 7 | R2E5gqTfePl8m7r9oeIARZXysmHHgBtEm5pTUav6QvOLAkEA2arx2R/3Yb6yZ5oO 8 | 3ldZEzCBNmB6mCoczrH6jjBosb4Gj7TK+asNlbinw1gj8sgdkzAw6jGnJ2IUfftm 9 | QMykwQJBAMqFDclCf2b9cwi82+Xg+mjlT8BEf+l5xdRrweOyjB6DmUhgeqDISJUK 10 | JgxGr4TxIQ6DGeEWxChGzzU6utlRnnECQDf4wdi/E7oMdwSylhvqkz9y32XBCZTX 11 | oQHzQG20rTUE+l93oeht0EsSOcSEYQPqUL9yyr/g4dbtVbn+0SabBcsCQEs4u/pL 12 | 5i2RVpzYbu77yrk/OuEDf/eiQipT6O4sX+4Tn1VlqePynp3B8N/8/11DnpBclJVu 13 | 2yTnGcNQVAeTWBsCQFMekiY/KbwAgTopqpCUg5CLNph91FVW5PIntLmd5gSj8ZJS 14 | uNuro8CURrOe8iiI3pG9m4KkbDdOBSOMADXJojE= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_rsa_pubkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3 3 | 6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6 4 | Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw 5 | oYi+1hqp1fIekaxsyQIDAQAB 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/test_rsa_pubkey_2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PUBLIC KEY----- 2 | MIGHAoGBAKwyBF3HER55exw++oXOn/r8gh2h4pKUGfvfrUVZnAxBQbSoJutdi11c 3 | /KqnYHgZOG+IiqJolkhMJNjzsKJXtsW8faWZQwkuwJzcFpDhcVBsRTkPmM0V8/uD 4 | vwwQpsJv2sR9gwjYQbBt8pFRlSth4Fp3MgwcQwQcPKIFesKiFNcxAgEj 5 | -----END RSA PUBLIC KEY----- 6 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/throws_error.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | throw new Error('blah'); 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/throws_error1.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | throw new Error('blah'); 23 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/throws_error2.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | 23 | JSON.parse(undefined); 24 | 25 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/throws_error3.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | process.nextTick(function() { 23 | JSON.parse(undefined); 24 | }); 25 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/utf8-bom.js: -------------------------------------------------------------------------------- 1 | module.exports = 42; 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/utf8-bom.json: -------------------------------------------------------------------------------- 1 | 42 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/x.txt: -------------------------------------------------------------------------------- 1 | xyz 2 | -------------------------------------------------------------------------------- /test/node-tests/fixtures/x1024.txt: -------------------------------------------------------------------------------- 1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-close-after-write.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common.js'); 23 | var assert = require('assert'); 24 | var zlib = require('zlib'); 25 | 26 | var closed = false; 27 | 28 | zlib.gzip('hello', function(err, out) { 29 | var unzip = zlib.createGunzip(); 30 | unzip.write(out); 31 | unzip.close(function() { 32 | closed = true; 33 | }); 34 | }); 35 | 36 | process.on('exit', function() { 37 | assert(closed); 38 | }); 39 | -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-dictionary-fail.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common.js'); 23 | var assert = require('assert'); 24 | var zlib = require('zlib'); 25 | 26 | // Should raise an error, not trigger an assertion in src/node_zlib.cc 27 | (function() { 28 | var stream = zlib.createInflate(); 29 | 30 | stream.on('error', common.mustCall(function(err) { 31 | assert(/Missing dictionary/.test(err.message)); 32 | })); 33 | 34 | // String "test" encoded with dictionary "dict". 35 | stream.write(Buffer([0x78,0xBB,0x04,0x09,0x01,0xA5])); 36 | })(); 37 | 38 | // Should raise an error, not trigger an assertion in src/node_zlib.cc 39 | (function() { 40 | var stream = zlib.createInflate({ dictionary: Buffer('fail') }); 41 | 42 | stream.on('error', common.mustCall(function(err) { 43 | assert(/Bad dictionary/.test(err.message)); 44 | })); 45 | 46 | // String "test" encoded with dictionary "dict". 47 | stream.write(Buffer([0x78,0xBB,0x04,0x09,0x01,0xA5])); 48 | })(); 49 | -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-from-gzip.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // test unzipping a file that was created with a non-node gzip lib, 23 | // piped in as fast as possible. 24 | 25 | var common = require('../common.js'); 26 | var assert = require('assert'); 27 | var zlib = require('zlib'); 28 | var path = require('path'); 29 | 30 | var gunzip = zlib.createGunzip(); 31 | 32 | var fs = require('fs'); 33 | 34 | var fixture = path.resolve(common.fixturesDir, 'person.jpg.gz'); 35 | var unzippedFixture = path.resolve(common.fixturesDir, 'person.jpg'); 36 | var outputFile = path.resolve(common.tmpDir, 'person.jpg'); 37 | var expect = fs.readFileSync(unzippedFixture); 38 | var inp = fs.createReadStream(fixture); 39 | var out = fs.createWriteStream(outputFile); 40 | 41 | inp.pipe(gunzip).pipe(out); 42 | out.on('close', function() { 43 | var actual = fs.readFileSync(outputFile); 44 | assert.equal(actual.length, expect.length, 'length should match'); 45 | for (var i = 0, l = actual.length; i < l; i++) { 46 | assert.equal(actual[i], expect[i], 'byte[' + i + ']'); 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-invalid-input.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // test uncompressing invalid input 23 | 24 | var common = require('../common.js'), 25 | assert = require('assert'), 26 | zlib = require('zlib'); 27 | 28 | var nonStringInputs = [1, true, {a: 1}, ['a']]; 29 | 30 | console.error('Doing the non-strings'); 31 | nonStringInputs.forEach(function(input) { 32 | // zlib.gunzip should not throw an error when called with bad input. 33 | assert.doesNotThrow(function() { 34 | zlib.gunzip(input, function(err, buffer) { 35 | // zlib.gunzip should pass the error to the callback. 36 | assert.ok(err); 37 | }); 38 | }); 39 | }); 40 | 41 | console.error('Doing the unzips'); 42 | // zlib.Unzip classes need to get valid data, or else they'll throw. 43 | var unzips = [ zlib.Unzip(), 44 | zlib.Gunzip(), 45 | zlib.Inflate(), 46 | zlib.InflateRaw() ]; 47 | var hadError = []; 48 | unzips.forEach(function (uz, i) { 49 | console.error('Error for '+uz.constructor.name); 50 | uz.on('error', function(er) { 51 | console.error('Error event', er); 52 | hadError[i] = true; 53 | }); 54 | 55 | uz.on('end', function(er) { 56 | throw new Error('end event should not be emitted '+uz.constructor.name); 57 | }); 58 | 59 | // this will trigger error event 60 | uz.write('this is not valid compressed data.'); 61 | }); 62 | 63 | process.on('exit', function() { 64 | assert.deepEqual(hadError, [true, true, true, true], 'expect 4 errors'); 65 | }); 66 | -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-write-after-close.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common.js'); 23 | var assert = require('assert'); 24 | var zlib = require('zlib'); 25 | 26 | var closed = false; 27 | 28 | zlib.gzip('hello', function(err, out) { 29 | var unzip = zlib.createGunzip(); 30 | unzip.close(function() { 31 | closed = true; 32 | }); 33 | assert.throws(function() { 34 | unzip.write(out); 35 | }); 36 | }); 37 | 38 | process.on('exit', function() { 39 | assert(closed); 40 | }); 41 | -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-write-after-flush.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common'); 23 | var assert = require('assert'); 24 | var zlib = require('zlib'); 25 | var fs = require('fs'); 26 | 27 | var gzip = zlib.createGzip(); 28 | var gunz = zlib.createUnzip(); 29 | 30 | gzip.pipe(gunz); 31 | 32 | var output = ''; 33 | var input = 'A line of data\n'; 34 | gunz.setEncoding('utf8'); 35 | gunz.on('data', function(c) { 36 | output += c; 37 | }); 38 | 39 | process.on('exit', function() { 40 | assert.equal(output, input); 41 | 42 | // Make sure that the flush flag was set back to normal 43 | assert.equal(gzip._flushFlag, zlib.Z_NO_FLUSH); 44 | 45 | console.log('ok'); 46 | }); 47 | 48 | // make sure that flush/write doesn't trigger an assert failure 49 | gzip.flush(); write(); 50 | function write() { 51 | gzip.write(input); 52 | gzip.end(); 53 | gunz.read(0); 54 | } 55 | -------------------------------------------------------------------------------- /test/node-tests/simple/test-zlib-zero-byte.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | var common = require('../common'); 23 | var assert = require('assert'); 24 | 25 | var zlib = require('zlib'); 26 | var gz = zlib.Gzip() 27 | var emptyBuffer = new Buffer(0); 28 | var received = 0; 29 | gz.on('data', function(c) { 30 | received += c.length; 31 | }); 32 | var ended = false; 33 | gz.on('end', function() { 34 | ended = true; 35 | }); 36 | var finished = false; 37 | gz.on('finish', function() { 38 | finished = true; 39 | }); 40 | gz.write(emptyBuffer); 41 | gz.end(); 42 | 43 | process.on('exit', function() { 44 | assert.equal(received, 20); 45 | assert(ended); 46 | assert(finished); 47 | console.log('ok'); 48 | }); 49 | -------------------------------------------------------------------------------- /test/node-tests/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /test/zone-tests/_common.js: -------------------------------------------------------------------------------- 1 | 2 | // Enable zones 3 | require('../../').enable(); 4 | 5 | // Export a global 'isv010' that is true when running on node v0.10.x, or false 6 | // otherwise. 7 | global.isv010 = require('../../lib/isv010.js'); 8 | 9 | // Create a global 'test' that has all assert methods on it, wrapped 10 | // such that the number of assertions is counted. 11 | // In addition, the test can use test.expect() to set the number of expected 12 | // assertions, and should call test.done() to signal that the test completed 13 | // successfully. 14 | 15 | var assert = require('assert'); 16 | 17 | var test = global.test = {}; 18 | 19 | var expected = null; 20 | var seen = 0; 21 | var done = false; 22 | 23 | test.expect = function(n) { 24 | if (expected !== null) 25 | throw new Error('number of expected assertions already set'); 26 | 27 | expected = n; 28 | }; 29 | 30 | test.done = function() { 31 | if (done) 32 | throw new Error('test already done'); 33 | 34 | if (expected !== null && 35 | expected !== seen) 36 | throw new Error('Too few or too many assertions.\n' + 37 | expected + ' assertions expected but ' + seen + ' seen.'); 38 | 39 | done = true; 40 | }; 41 | 42 | process.on('exit', function() { 43 | if (!done) 44 | throw new Error('Test not done'); 45 | }); 46 | 47 | function wrapAssert(fn) { 48 | return function() { 49 | seen++; 50 | return fn.apply(assert, arguments); 51 | } 52 | } 53 | 54 | for (var key in assert) { 55 | if (assert.hasOwnProperty(key)) 56 | test[key] = wrapAssert(assert[key]); 57 | } 58 | -------------------------------------------------------------------------------- /test/zone-tests/test-after-task.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(2); 4 | var afterHook = function() { test.ok(true, 'expecting a call'); }; 5 | 6 | zone.create(function() { test.ok(test, 'running the main function'); }, 7 | {afterTask: afterHook}); 8 | test.done(); 9 | -------------------------------------------------------------------------------- /test/zone-tests/test-async-event-cleanup.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(1); 4 | 5 | var outer = zone.create(function Outer() { 6 | process.nextTick(createMiddleZone); 7 | }); 8 | 9 | function createMiddleZone() { 10 | zone.create(function() { 11 | this.name = 'In the middle'; 12 | failAsync(1); 13 | }); 14 | } 15 | 16 | var failAsync = zone.define(function AsyncFailZone(timeout) { 17 | setTimeout(function() { 18 | function_that_doesnt_exist(); 19 | }, timeout); 20 | }); 21 | 22 | outer.setCallback(function(err, res) { 23 | test.ok(err !== null); 24 | test.done(); 25 | }); 26 | -------------------------------------------------------------------------------- /test/zone-tests/test-before-task-with-error.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(6); 4 | 5 | var beforeHook = function() { 6 | test.equal(zone.name, 'ChildZone'); 7 | test.ok(true, 'expecting a call'); 8 | throw new Error('expected error'); 9 | }; 10 | 11 | var failureCb = function(err) { 12 | test.ok(zone === zone.root); 13 | test.ok(/expected/.test(err)); 14 | test.done(); 15 | }; 16 | 17 | var childZone = zone.create(function ChildZone() { 18 | test.equal(global.zone.name, 'ChildZone'); 19 | test.ok(test, 'running the main function'); 20 | }, {beforeTask: beforeHook, errorCallback: failureCb}); 21 | -------------------------------------------------------------------------------- /test/zone-tests/test-before-task.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(2); 4 | 5 | var beforeHook = function() { 6 | test.ok(true, 'expecting a call'); 7 | }; 8 | 9 | zone.create(function() { 10 | test.ok(test, 'running the main function'); 11 | test.done(); 12 | }, { beforeTask: beforeHook }); 13 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-auto-exit.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(2); 4 | 5 | var zoneFunc = function() { // no-op 6 | }; 7 | 8 | var cb = function(err) { 9 | test.strictEqual(err, null); 10 | test.strictEqual(arguments.length, 1); 11 | test.done(); 12 | }; 13 | 14 | zone.create(zoneFunc).setCallback(cb); 15 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-catch.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // Test catch callback. 4 | test.expect(1); 5 | 6 | var zoneFunc = function() { 7 | zone.throw(new Error()); 8 | }; 9 | 10 | var cb = function(err) { 11 | test.ok(err instanceof Error); 12 | test.done(); 13 | }; 14 | 15 | zone.create(zoneFunc).catch (cb); 16 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-errback-with-error.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(3); 4 | 5 | var zoneFunc = function() { 6 | zone.return(42); 7 | throw new Error(); 8 | }; 9 | 10 | var cb = function(err, a, b) { 11 | test.ok(err instanceof Error); 12 | test.equal(a, undefined); 13 | test.equal(b, undefined); 14 | test.done(); 15 | }; 16 | zone.create(zoneFunc).setCallback(cb); 17 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-errback-with-result.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(3); 4 | 5 | var zoneFunc = function() { 6 | zone.return(42); 7 | }; 8 | 9 | var cb = function(err, a, b) { 10 | test.strictEqual(err, null); 11 | test.strictEqual(a, 42); 12 | test.strictEqual(b, undefined); 13 | test.done(); 14 | }; 15 | 16 | zone.create(zoneFunc).setCallback(cb); 17 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-then-with-error.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(1); 4 | 5 | var zoneFunc = function() { 6 | throw new Error(); 7 | }; 8 | 9 | var successCb = function onSuccess() { 10 | test.fail(); 11 | }; 12 | 13 | var errorCb = function onError(err) { 14 | test.ok(err instanceof Error); 15 | test.done(); 16 | }; 17 | 18 | zone.create(zoneFunc).then(successCb, errorCb); 19 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-then-with-success.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(3); 4 | 5 | var zoneFunc = function() { 6 | this.return(1, 2, 3); 7 | }; 8 | 9 | var successCb = function onSuccess(a, b, c) { 10 | test.strictEqual(a, 1); 11 | test.strictEqual(b, 2); 12 | test.strictEqual(c, 3); 13 | test.done(); 14 | }; 15 | 16 | var errorCb = function onError(err) { 17 | test.fail(); 18 | }; 19 | 20 | zone.create(zoneFunc).then(successCb, errorCb); 21 | -------------------------------------------------------------------------------- /test/zone-tests/test-callback-throw-non-error.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(2); 4 | 5 | var zoneFunc = function() { 6 | throw 133; 7 | }; 8 | 9 | var cb = function(err) { 10 | test.ok(err instanceof Error); 11 | test.strictEqual(err.value, 133); 12 | test.done(); 13 | }; 14 | 15 | zone.create(zoneFunc).catch (cb); 16 | -------------------------------------------------------------------------------- /test/zone-tests/test-child-process-exec-error.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var execFile = require('child_process').execFile; 4 | 5 | test.expect(2); 6 | var zoneFunc = function ExecFileZone() { 7 | execFile('inv$alid~file', [], callback); 8 | 9 | function callback(err, stdout, stderr) { 10 | test.ok(zone === execFileZone); 11 | throw err; 12 | } 13 | }; 14 | 15 | var errorFunc = function(err) { 16 | test.strictEqual(err.code, 'ENOENT'); 17 | test.done(); 18 | }; 19 | 20 | var execFileZone = zone.create(zoneFunc).catch (errorFunc); 21 | -------------------------------------------------------------------------------- /test/zone-tests/test-child-process-exec.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var exec = require('child_process').exec; 4 | 5 | test.expect(3); 6 | var execZone = zone.create(function ExecZone() { 7 | exec('echo hello world', callback); 8 | 9 | function callback(err, stdout, stderr) { 10 | test.ok(zone === execZone); 11 | test.ok(!err); 12 | test.ok(/hello world/.test(stdout)); 13 | } 14 | }).then(function() { test.done(); }); 15 | -------------------------------------------------------------------------------- /test/zone-tests/test-child-process-spawn-cleanup.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var spawn = require('child_process').spawn; 4 | 5 | test.expect(4); 6 | var zoneFunc = function SpawnZone() { 7 | function onClose(code, signal) { test.ok(true); } 8 | 9 | var p = spawn('cat', ['-']); 10 | p.on('close', onClose); 11 | 12 | setTimeout(function() { 13 | test.ok(zone === spawnZone); 14 | throw new Error('expected error'); 15 | }); 16 | }; 17 | var cb = function(err) { 18 | test.ok(zone === zone.root); 19 | test.ok(/expected/.test(err)); 20 | test.done(); 21 | }; 22 | var spawnZone = zone.create(zoneFunc).catch (cb); 23 | -------------------------------------------------------------------------------- /test/zone-tests/test-clean-exit-waits-for-fs-stat.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // Zones should wait for async operations before completing. 4 | 5 | test.expect(1); 6 | 7 | var fs = require('fs'); 8 | var cleanupOrder = []; 9 | 10 | zone.create(function ChildZone1() { 11 | zone.create(function ChildZone2() { 12 | var z = zone.create(function ChildZone3() { 13 | fs.stat(__dirname + '/../assets/file1', function(err) { 14 | cleanupOrder.push('fs.stat complete'); 15 | }); 16 | 17 | }).then(function() { 18 | cleanupOrder.push('ChildZone3 exit'); 19 | }); 20 | }); 21 | }).then(function() { 22 | test.deepEqual(cleanupOrder, ['fs.stat complete', 'ChildZone3 exit']); 23 | test.done(); 24 | }); 25 | -------------------------------------------------------------------------------- /test/zone-tests/test-clean-exit-waits-for-timeout.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // If there is no error, Zones should wait for timeouts. 4 | 5 | test.expect(1); 6 | 7 | var fs = require('fs'); 8 | var cleanupOrder = []; 9 | 10 | zone.create(function ChildZone1() { 11 | zone.create(function ChildZone2() { 12 | zone.create(function ChildZone3() { 13 | setTimeout(function() { 14 | cleanupOrder.push('timeout complete'); 15 | }, 50); 16 | }).then(function() { 17 | cleanupOrder.push('ChildZone3 exit'); 18 | }); 19 | }); 20 | }).then(function() { 21 | test.deepEqual(cleanupOrder, ['timeout complete', 'ChildZone3 exit']); 22 | test.done(); 23 | }); 24 | -------------------------------------------------------------------------------- /test/zone-tests/test-dns-lookup.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var dns = require('dns'); 4 | 5 | test.expect(2); 6 | 7 | zone.create(function ChildZone() { 8 | var childZone = zone; 9 | 10 | dns.lookup('localhost', function(err, address, family) { 11 | if (err) 12 | throw err; 13 | 14 | test.ok(typeof address === 'string'); 15 | test.ok(zone === childZone); 16 | }); 17 | }).then(function() { 18 | test.done(); 19 | }); 20 | -------------------------------------------------------------------------------- /test/zone-tests/test-dns-resolve-localhost-in-zone.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var dns = require('dns'); 4 | 5 | test.expect(3); 6 | zone.create(function ChildZone() { 7 | var childZone = zone; 8 | var async = false; 9 | 10 | dns.resolve('localhost', function(err, addresses) { 11 | test.ok(err || typeof addresses === 'object'); 12 | test.ok(zone === childZone); 13 | test.ok(async); 14 | }); 15 | 16 | async = true; 17 | 18 | }).then(function() { 19 | test.done(); 20 | }); 21 | -------------------------------------------------------------------------------- /test/zone-tests/test-dns-resolve4.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var dns = require('dns'); 4 | 5 | test.expect(2); 6 | 7 | dns.resolve4('www.strongloop.com', function(err, addresses) { 8 | if (err) { 9 | throw err; 10 | } 11 | test.ok(typeof addresses === 'object'); 12 | test.ok(zone === zone.root); 13 | test.done(); 14 | }); 15 | -------------------------------------------------------------------------------- /test/zone-tests/test-dns-resolve6-in-zone.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var dns = require('dns'); 4 | 5 | test.expect(2); 6 | zone.create(function ChildZone() { 7 | var childZone = zone; 8 | 9 | dns.resolve6('www.strongloop.com', function(err, addresses) { 10 | if (err) { 11 | throw err; 12 | } 13 | test.ok(typeof addresses === 'object'); 14 | test.ok(zone === childZone); 15 | }); 16 | }).then(function() { test.done(); }); 17 | -------------------------------------------------------------------------------- /test/zone-tests/test-dns-reverse.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var dns = require('dns'); 4 | 5 | test.expect(2); 6 | 7 | zone.create(function ChildZone() { 8 | var childZone = zone; 9 | 10 | dns.reverse('127.0.0.1', function(err, domains) { 11 | if (err) 12 | throw err; 13 | 14 | test.ok(typeof domains === 'object'); 15 | test.ok(zone === childZone); 16 | }); 17 | }).then(function() { 18 | test.done(); 19 | }); 20 | -------------------------------------------------------------------------------- /test/zone-tests/test-ee-add-remove-listener.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | var emitter = new EventEmitter(); 5 | var listener = function(data) { test.ok(true); }; 6 | var done = function(data) { test.done(); }; 7 | 8 | test.expect(1); 9 | emitter.on('myevent', listener); 10 | emitter.once('done', done); 11 | emitter.emit('myevent', 'FOO'); 12 | emitter.removeListener('myevent', listener); 13 | emitter.emit('myevent', 'FOO'); 14 | emitter.emit('done', 'done'); 15 | -------------------------------------------------------------------------------- /test/zone-tests/test-ee-emit-once.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | var emitter = new EventEmitter(); 5 | var listener = function(data) { test.ok(true); }; 6 | var done = function(data) { test.done(); }; 7 | 8 | test.expect(1); 9 | emitter.once('myevent', listener); 10 | emitter.once('done', done); 11 | emitter.emit('myevent', 'FOO'); 12 | emitter.emit('myevent', 'FOO'); 13 | emitter.emit('done', 'done'); 14 | -------------------------------------------------------------------------------- /test/zone-tests/test-ee-in-root-zone.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | var emitter = new EventEmitter(); 5 | 6 | test.expect(2); 7 | setTimeout(function() { 8 | test.ok(true); 9 | emitter.emit('myevent', 'FOO'); 10 | }, 10); 11 | 12 | emitter.on('myevent', function(ray) { 13 | test.equal(ray, 'FOO'); 14 | test.done(); 15 | }); 16 | -------------------------------------------------------------------------------- /test/zone-tests/test-ee-x-zone-1.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | var emitter = new EventEmitter(); 5 | test.expect(2); 6 | 7 | var ChildZone = function ChildZone(test, emitter) { 8 | setTimeout(function() { 9 | test.ok(true); 10 | emitter.emit('myevent', 'FOO'); 11 | }, 10); 12 | 13 | emitter.once('myevent', function(ray) { test.equal(ray, 'FOO'); }); 14 | }; 15 | 16 | var doneCB = function() { test.done(); }; 17 | 18 | c = zone.define(ChildZone, {successCallback: doneCB}); 19 | c(test, emitter); 20 | -------------------------------------------------------------------------------- /test/zone-tests/test-ee-x-zone-2.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | var emitter = new EventEmitter(); 5 | test.expect(2); 6 | 7 | var ChildZone = function ChildZone(test, emitter) { 8 | emitter.once('myevent', function(ray) { test.equal(ray, 'FOO'); }); 9 | }; 10 | 11 | var doneCB = function() { test.done(); }; 12 | 13 | c = zone.define(ChildZone, {successCallback: doneCB}); 14 | c(test, emitter); 15 | 16 | setTimeout(function() { 17 | test.ok(true); 18 | emitter.emit('myevent', 'FOO'); 19 | }, 10); 20 | -------------------------------------------------------------------------------- /test/zone-tests/test-ee-x-zone-3.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | 5 | test.expect(3); 6 | var step = 0; 7 | 8 | zone.create(function OuterZone() { 9 | var emitter = new EventEmitter(); 10 | 11 | zone.create(function InnerZone() { 12 | emitter.on('something', function() { 13 | test.equal(step++, 0); 14 | }); 15 | 16 | }).then(function() { 17 | test.equal(step++, 1); 18 | }); 19 | 20 | emitter.emit('something'); 21 | 22 | }).then(function() { 23 | test.equal(step++, 2); 24 | test.done(); 25 | }); 26 | -------------------------------------------------------------------------------- /test/zone-tests/test-error-catch.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | //In the synchronous case, zones should clean up in child -> parent order 4 | var cleanupOrder = []; 5 | 6 | test.expect(1); 7 | 8 | zone.create(function ChildZone1() { 9 | zone.create(function ChildZone2() { 10 | zone.create(function ChildZone3() { 11 | throw new Error('monkey wrench'); 12 | }).catch (function() { 13 | cleanupOrder.push('ChildZone3'); 14 | }); 15 | }).then(function() { 16 | cleanupOrder.push('ChildZone2'); 17 | }); 18 | }).then(function() { 19 | cleanupOrder.push('ChildZone1'); 20 | test.deepEqual(cleanupOrder, ['ChildZone3', 'ChildZone2', 'ChildZone1']); 21 | test.done(); 22 | }); 23 | -------------------------------------------------------------------------------- /test/zone-tests/test-error-exit-cancels-timeout.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // Timeouts can be cancelled so Zone should not wait for it. 4 | test.expect(1); 5 | 6 | var fs = require('fs'); 7 | var cleanupOrder = []; 8 | 9 | zone.create(function ChildZone1() { 10 | zone.create(function ChildZone2() { 11 | zone.create(function ChildZone3() { 12 | process.setTimeout(function() { 13 | cleanupOrder.push('timeout complete'); 14 | }, 5000); 15 | 16 | throw new Error('monkey wrench'); 17 | }).catch (function() { 18 | cleanupOrder.push('exception caught'); 19 | }); 20 | }); 21 | }).then(function() { 22 | test.deepEqual(cleanupOrder, ['exception caught']); 23 | test.done(); 24 | }); 25 | -------------------------------------------------------------------------------- /test/zone-tests/test-error-exit-waits-for-fs-stat.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // Zones should wait for async operations before completing. 4 | test.expect(1); 5 | 6 | var fs = require('fs'); 7 | var cleanupOrder = []; 8 | 9 | zone.create(function ChildZone1() { 10 | zone.create(function ChildZone2() { 11 | zone.create(function ChildZone3() { 12 | fs.stat('./assets/file1', function() { 13 | cleanupOrder.push('fs.stat complete'); 14 | }); 15 | 16 | }).then(function() { 17 | cleanupOrder.push('ChildZone3 exit'); 18 | }); 19 | }); 20 | }).then(function() { 21 | test.deepEqual(cleanupOrder, ['fs.stat complete', 'ChildZone3 exit']); 22 | test.done(); 23 | }); 24 | -------------------------------------------------------------------------------- /test/zone-tests/test-error-propogation.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // If children don't have a catch block, errors should propagate to parent. 4 | test.expect(1); 5 | 6 | var cleanupOrder = []; 7 | 8 | zone.create(function ChildZone1() { 9 | zone.create(function ChildZone2() { 10 | zone.create(function ChildZone3() { 11 | process.nextTick(function() { 12 | throw new Error('monkey wrench'); 13 | }); 14 | }); 15 | }); 16 | }).catch (function() { 17 | test.ok(true, 'Error was propogated'); 18 | test.done(); 19 | }); 20 | -------------------------------------------------------------------------------- /test/zone-tests/test-event-emitter-cleanup.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // A throw within a zone should cause the listener to unregister from the 4 | // emitter. 5 | test.expect(1); 6 | 7 | var EventEmitter = require('events').EventEmitter; 8 | var cleanupOrder = []; 9 | 10 | zone.create(function ChildZone1() { 11 | var emitter = new EventEmitter(); 12 | 13 | zone.create(function ChildZone() { 14 | emitter.on('event', function() { 15 | cleanupOrder.push('event reveived'); 16 | }); 17 | emitter.on('throw', function() { 18 | cleanupOrder.push('throw reveived'); 19 | throw new Error('monkey wrench'); 20 | }); 21 | }).catch (function(err) { 22 | cleanupOrder.push('ChildZone exited'); 23 | }); 24 | 25 | process.nextTick(function() { 26 | emitter.emit('event', 'foo'); 27 | }); 28 | process.nextTick(function() { 29 | emitter.emit('throw', 'foo'); 30 | }); 31 | setTimeout(function() { 32 | //this event should not trigger the listener 33 | emitter.emit('event', 'foo'); 34 | }, 50); 35 | }).then(function() { 36 | test.deepEqual(cleanupOrder, 37 | ['event reveived', 'throw reveived', 'ChildZone exited']); 38 | test.done(); 39 | }); 40 | -------------------------------------------------------------------------------- /test/zone-tests/test-fd-auto-close-on-error.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var fs = require('fs'); 4 | var resolve = require('path').resolve; 5 | 6 | var fileName1 = resolve(__dirname, '../assets', 'file1'); 7 | var fd1; 8 | 9 | var childZone = function ChildZone1() { 10 | fs.open(fileName1, 'w+', function(err, fd) { 11 | test.ok(true); 12 | 13 | if (err) throw err; 14 | fd1 = fd; 15 | 16 | throw new Error('expected error'); 17 | }); 18 | }; 19 | 20 | var errorCb = function(err) { 21 | test.ok(/expected/.test(err)); 22 | assertFileClosed(test, fd1); 23 | test.done(); 24 | }; 25 | 26 | test.expect(3); 27 | zone.create(childZone).catch (errorCb); 28 | 29 | function assertFileClosed(test, fd) { 30 | try { 31 | fs.fstatSync(fd); 32 | test.ok(false); 33 | } catch (err) { 34 | console.log(err); 35 | test.strictEqual(err.code, 'EBADF'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/zone-tests/test-fd-auto-close.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var fs = require('fs'); 4 | var resolve = require('path').resolve; 5 | 6 | var fileName2 = resolve(__dirname, '../assets', 'file2'); 7 | var fd2; 8 | 9 | var childZone = function ChildZone2() { fd2 = fs.openSync(fileName2, 'w+'); }; 10 | var errorCb = function() { 11 | assertFileClosed(test, fd2); 12 | test.done(); 13 | }; 14 | 15 | test.expect(1); 16 | zone.create(childZone).then(errorCb); 17 | 18 | function assertFileClosed(test, fd) { 19 | try { 20 | fs.fstatSync(fd); 21 | test.ok(false); 22 | } catch (err) { 23 | console.log(err); 24 | test.strictEqual(err.code, 'EBADF'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/zone-tests/test-http-agent-patching.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(2); 4 | 5 | var http = require('http'); 6 | var agent1, agent2, agent3; 7 | 8 | agent1 = http.globalAgent; 9 | 10 | zone.create(function() { 11 | agent2 = http.globalAgent; 12 | }); 13 | 14 | zone.create(function() { 15 | agent3 = http.globalAgent; 16 | }); 17 | 18 | test.notStrictEqual(agent1, agent2); 19 | test.notStrictEqual(agent1, agent3); 20 | test.done(); 21 | -------------------------------------------------------------------------------- /test/zone-tests/test-linked-list-head.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(11); 4 | 5 | var LinkedList = require('../../lib/linked-list.js'); 6 | var l = new LinkedList('test'); 7 | 8 | for (var i = 0; i < 10; i++) { 9 | l.push(i); 10 | } 11 | 12 | for (i = 0; i < 10; i++) { 13 | test.equal(l.head(), i); 14 | l.shift(); 15 | } 16 | 17 | test.equal(l.head(), null); 18 | test.done(); 19 | -------------------------------------------------------------------------------- /test/zone-tests/test-linked-list-push-pop.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(11); 4 | 5 | var LinkedList = require('../../lib/linked-list.js'); 6 | var l = new LinkedList('test'); 7 | 8 | for (var i = 0; i < 10; i++) { 9 | l.push(i); 10 | } 11 | 12 | for (i = 9; i >= 0; i--) { 13 | test.equal(l.pop(), i); 14 | } 15 | 16 | test.equal(l.pop(), null); 17 | test.done(); 18 | -------------------------------------------------------------------------------- /test/zone-tests/test-linked-list-remove.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(3); 4 | 5 | var LinkedList = require('../../lib/linked-list.js'); 6 | var l = new LinkedList('test'); 7 | 8 | for (var i = 0; i < 10; i++) { 9 | l.push({value: i}); 10 | } 11 | 12 | x = l.head(); 13 | l.remove(x); 14 | test.equal(l.head().value, 1); 15 | 16 | x = l.tail(); 17 | l.remove(x); 18 | test.equal(l.tail().value, 8); 19 | 20 | i = l.iterator(); 21 | i.next(); 22 | i.next(); 23 | i.next(); 24 | x = i.next(); 25 | l.remove(x); 26 | 27 | i = l.iterator(); 28 | i.next(); 29 | i.next(); 30 | i.next(); 31 | x = i.next(); 32 | test.equal(x.value, 5); 33 | test.done(); 34 | -------------------------------------------------------------------------------- /test/zone-tests/test-linked-list-shift-unshift.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(11); 4 | 5 | var LinkedList = require('../../lib/linked-list.js'); 6 | var l = new LinkedList('test'); 7 | 8 | for (var i = 0; i < 10; i++) { 9 | l.unshift(i); 10 | } 11 | 12 | for (i = 9; i >= 0; i--) { 13 | test.equal(l.shift(), i); 14 | } 15 | 16 | test.equal(l.shift(), null); 17 | test.done(); 18 | -------------------------------------------------------------------------------- /test/zone-tests/test-linked-list-tail.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(11); 4 | 5 | var LinkedList = require('../../lib/linked-list.js'); 6 | var l = new LinkedList('test'); 7 | 8 | for (var i = 0; i < 10; i++) { 9 | l.push(i); 10 | } 11 | 12 | for (i = 9; i >= 0; i--) { 13 | test.equal(l.tail(), i); 14 | l.pop(); 15 | } 16 | 17 | test.equal(l.tail(), null); 18 | test.done(); 19 | -------------------------------------------------------------------------------- /test/zone-tests/test-require-module.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(1); 4 | 5 | var m = require('module'); 6 | test.strictEqual(typeof m.Module, 'function'); 7 | 8 | test.done(); 9 | -------------------------------------------------------------------------------- /test/zone-tests/test-simple-cleanup.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | // In the synchronous case, zones should clean up in child -> parent order. 4 | test.expect(1); 5 | 6 | var cleanupOrder = []; 7 | 8 | zone.create(function ChildZone1() { 9 | zone.create(function ChildZone2() { 10 | zone.create(function ChildZone3() { 11 | 12 | }).then(function() { 13 | cleanupOrder.push('ChildZone3'); 14 | }); 15 | }).then(function() { 16 | cleanupOrder.push('ChildZone2'); 17 | }); 18 | }).then(function() { 19 | cleanupOrder.push('ChildZone1'); 20 | test.deepEqual(cleanupOrder, ['ChildZone3', 'ChildZone2', 'ChildZone1']); 21 | test.done(); 22 | }); 23 | -------------------------------------------------------------------------------- /test/zone-tests/test-stream-write-callbacks.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(3); 4 | 5 | var net = require('net'); 6 | 7 | zone.create(function TestZone() { 8 | var server = net.createServer(function(conn) { 9 | var zone1 = zone.create(function Zone1() { 10 | var afterWrite = function afterWrite() { 11 | test.ok(zone === zone1); 12 | }; 13 | 14 | conn.write('small', afterWrite); 15 | }); 16 | 17 | var zone2 = zone.create(function Zone2() { 18 | var afterWrite = function afterWrite() { 19 | test.ok(zone === zone2); 20 | }; 21 | 22 | var string = new Array(1024 * 1024).join('x'); 23 | conn.write(string, afterWrite); 24 | }); 25 | 26 | var zone3 = zone.create(function Zone3() { 27 | var afterEnd = function afterEnd() { 28 | test.ok(zone === zone3); 29 | }; 30 | 31 | var buf = new Buffer(1024 * 1024); 32 | buf.fill(42); 33 | conn.end(buf, afterEnd); 34 | }); 35 | 36 | process._rawDebug('# closing server'); 37 | server.close(); 38 | }); 39 | 40 | server.listen(0); 41 | 42 | var conn = net.connect(server.address().port); 43 | conn.resume(); 44 | 45 | }).then(function() { 46 | console.log('all done'); 47 | test.done(); 48 | }); 49 | -------------------------------------------------------------------------------- /test/zone-tests/test-stream-write-from-root.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | var net = require('net'); 4 | 5 | test.expect(1); 6 | 7 | if (!isv010) 8 | process.stdout.cork(); 9 | 10 | process.stdout.write('Write from root zone\n', function() { 11 | test.ok(zone === zone.root); 12 | test.done(); 13 | }); 14 | 15 | if (!isv010) 16 | process.stdout.uncork(); 17 | -------------------------------------------------------------------------------- /test/zone-tests/test-stream-write-from-zone.js: -------------------------------------------------------------------------------- 1 | require('./_common.js'); 2 | 3 | test.expect(1); 4 | 5 | if (!isv010) 6 | process.stdout.cork(); 7 | 8 | process.stdout.write('Write from root zone\n', function() { 9 | test.ok(zone === zone.root); 10 | test.done(); 11 | }); 12 | 13 | if (!isv010) 14 | process.stdout.uncork(); 15 | --------------------------------------------------------------------------------