diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index f334c01fd5..8974af647c 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -1,7 +1,7 @@ libDir = node.path.join(node.path.dirname(__filename), "../lib"); node.libraryPaths.unshift(libDir); -include("/utils.js"); +node.mixin(require("/utils.js")); http = require("/http.js"); fixed = "" @@ -16,7 +16,7 @@ http.createServer(function (req, res) { var arg = commands[2]; var status = 200; - //p(req.headers); + p(req.uri.params); if (command == "bytes") { var n = parseInt(arg, 10) diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js index 2e1e35465a..e338ad3806 100644 --- a/benchmark/process_loop.js +++ b/benchmark/process_loop.js @@ -1,6 +1,6 @@ libDir = node.path.join(node.path.dirname(__filename), "../lib"); node.libraryPaths.unshift(libDir); -include("/utils.js"); +node.mixin(require("/utils.js")); function next (i) { if (i <= 0) return; diff --git a/benchmark/run.js b/benchmark/run.js index d9c2668687..869ae55a63 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -1,6 +1,6 @@ libDir = node.path.join(node.path.dirname(__filename), "../lib"); node.libraryPaths.unshift(libDir); -include("/utils.js"); +node.mixin(require("/utils.js")); var benchmarks = [ "static_http_server.js" , "timers.js" , "process_loop.js" diff --git a/bin/node-repl b/bin/node-repl index 20f04e89fc..00975dc379 100755 --- a/bin/node-repl +++ b/bin/node-repl @@ -1,6 +1,6 @@ #!/usr/bin/env node -include("/utils.js"); +node.mixin(require("/utils.js")); puts("Welcome to the Node.js REPL."); puts("Enter ECMAScript at the prompt."); puts("Tip 1: Use 'rlwrap node-repl' for a better interface"); diff --git a/doc/api.txt b/doc/api.txt index f766eca474..4e6fbb0f23 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -16,8 +16,8 @@ An example of a web server written with Node which responds with "Hello World": ---------------------------------------- -include("/utils.js"); -include("/http.js"); +node.mixin(require("/utils.js")); +node.mixin(require("/http.js")); createServer(function (request, response) { response.sendHeader(200, {"Content-Type": "text/plain"}); response.sendBody("Hello World\n"); @@ -61,11 +61,23 @@ error reporting. The filename of the script being executed. +require(path)+ :: -+include(path)+ :: See the modules section. +node.libraryPaths+ :: -The search path for absolute path arguments to +require()+ and +include()+. +The search path for absolute path arguments to +require()+. + ++node.mixin([deep], target, object1, [objectN])+ :: +Extend one object with one or more others, returning the modified object. +If no target is specified, the +process+ namespace itself is extended. +Keep in mind that the target object will be modified, and will be returned +from +node.mixin()+. ++ +If a boolean true is specified as the first argument, Node performs a deep +copy, recursively copying any objects it finds. Otherwise, the copy will +share structure with the original object(s). ++ +Undefined properties are not copied. However, properties inherited from the +object's prototype will be copied over. === The +process+ Object @@ -119,7 +131,7 @@ Executes the command as a child process, buffers the output and returns it in a promise callback. + ---------------------------------------- -include("/utils.js"); +node.mixin(require("/utils.js")); exec("ls /").addCallback(function (stdout, stderr) { puts(stdout); }); @@ -269,7 +281,7 @@ The contents of +foo.js+: ---------------------------------------- var circle = require("circle.js"); -include("/utils.js"); +node.mixin(require("/utils.js")); puts("The area of a circle of radius 4 is " + circle.area(4)); ---------------------------------------- @@ -292,24 +304,20 @@ The module +circle.js+ has exported the functions +area()+ and object. (Alternatively, one can use +this+ instead of +exports+.) Variables local to the module will be private. In this example the variable +PI+ is private to +circle.js+. The function +puts()+ comes from the module -+"/utils.js"+. Because +include("/utils.js")+ was called, +puts()+ is in the -global namespace. ++"/utils.js"+. The module path is relative to the file calling +require()+. That is, +circle.js+ must be in the same directory as +foo.js+ for +require()+ to find it. -Like +require()+ the function +include()+ also loads a module. Instead of -returning a namespace object, +include()+ will add the module's exports into -the global namespace. For example: +Use +node.mixin()+ to include modules into the global namespace. ---------------------------------------- -include("circle.js"); -include("/utils.js"); +node.mixin(process, require("circle.js"), require("/utils.js")); puts("The area of a cirlce of radius 4 is " + area(4)); ---------------------------------------- -When an absolute path is given to +require()+ or +include()+, like +When an absolute path is given to +require()+, like +require("/mjsunit.js")+ the module is searched for in the +node.libraryPaths+ array. +node.libraryPaths+ on my system looks like this: @@ -567,8 +575,7 @@ Objects returned from +node.fs.stat()+ are of this type. === HTTP -To use the HTTP server and client one must +require("/http.js")+ or -+include("/http.js")+. +To use the HTTP server and client one must +require("/http.js")+. The HTTP interfaces in Node are designed to support many features of the protocol which have been traditionally difficult to use. @@ -990,8 +997,7 @@ stream.addListener('complete', function() { === TCP -To use the TCP server and client one must +require("/tcp.js")+ or -+include("/tcp.js")+. +To use the TCP server and client one must +require("/tcp.js")+. ==== +tcp.Server+ @@ -999,7 +1005,7 @@ Here is an example of a echo server which listens for connections on port 7000 ---------------------------------------- -include("/tcp.js"); +node.mixin(require("/tcp.js")); var server = createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { @@ -1237,8 +1243,8 @@ result of the last expression. The library is called +/repl.js+ and it can be used like this: ------------------------------------ -include("/utils.js"); -include("/tcp.js"); +node.mixin(require("/utils.js")); +node.mixin(require("/tcp.js")); nconnections = 0; createServer(function (c) { error("Connection!"); diff --git a/src/node.js b/src/node.js index 1cf7989150..57a40c269a 100644 --- a/src/node.js +++ b/src/node.js @@ -13,7 +13,7 @@ node.createChildProcess = function (command) { }; node.exec = function () { - throw new Error("node.exec() has moved. Use include('/utils.js') to bring it back."); + throw new Error("node.exec() has moved. Use require('/utils.js') to bring it back."); } node.http.createServer = function () { @@ -28,6 +28,61 @@ node.tcp.createConnection = function (port, host) { throw new Error("node.tcp.createConnection() has moved. Use require('/tcp.js') to access it."); }; +/* From jQuery.extend in the jQuery JavaScript Library v1.3.2 + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + */ +node.mixin = function() { + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !node.isFunction(target) ) + target = {}; + + // mixin process itself if only one argument is passed + if ( length == i ) { + target = process; + --i; + } + + for ( ; i < length; i++ ) + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) + // Extend the base object + for ( var name in options ) { + var src = target[ name ], copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) + continue; + + // Recurse if we're merging object values + if ( deep && copy && typeof copy === "object" && !copy.nodeType ) + target[ name ] = node.mixin( deep, + // Never move original objects, clone them + src || ( copy.length != null ? [ ] : { } ) + , copy ); + + // Don't bring in undefined values + else if ( copy !== undefined ) + target[ name ] = copy; + + } + + // Return the modified object + return target; +}; + // Timers function setTimeout (callback, after) { @@ -207,27 +262,12 @@ node.Module.prototype.loadScript = function (loadPromise) { return requireAsync(url).wait(); } - function includeAsync (url) { - var promise = requireAsync(url) - promise.addCallback(function (t) { - // copy properties into global namespace. - for (var prop in t) { - if (t.hasOwnProperty(prop)) process[prop] = t[prop]; - } - }); - return promise; - } - - function include (url) { - includeAsync(url).wait(); - } - // create wrapper function - var wrapper = "function (__filename, exports, require, include) { " + content + "\n};"; + var wrapper = "function (__filename, exports, require) { " + content + "\n};"; var compiled_wrapper = node.compile(wrapper, self.filename); node.loadingModules.unshift(self); - compiled_wrapper.apply(self.target, [self.filename, self.target, require, include]); + compiled_wrapper.apply(self.target, [self.filename, self.target, require]); node.loadingModules.shift(); self.waitChildrenLoad(function () { diff --git a/src/util.js b/src/util.js index 0a477bbc0b..4c79f0a875 100644 --- a/src/util.js +++ b/src/util.js @@ -70,21 +70,21 @@ node.path = new function () { puts = function () { - throw new Error("puts() has moved. Use include('/utils.js') to bring it back."); + throw new Error("puts() has moved. Use require('/utils.js') to bring it back."); } print = function () { - throw new Error("print() has moved. Use include('/utils.js') to bring it back."); + throw new Error("print() has moved. Use require('/utils.js') to bring it back."); } p = function () { - throw new Error("p() has moved. Use include('/utils.js') to bring it back."); + throw new Error("p() has moved. Use require('/utils.js') to bring it back."); } node.debug = function () { - throw new Error("node.debug() has moved. Use include('/utils.js') to bring it back."); + throw new Error("node.debug() has moved. Use require('/utils.js') to bring it back."); } node.error = function () { - throw new Error("node.error() has moved. Use include('/utils.js') to bring it back."); + throw new Error("node.error() has moved. Use require('/utils.js') to bring it back."); } diff --git a/test/mjsunit/common.js b/test/mjsunit/common.js index b74dac6209..53338ab0c3 100644 --- a/test/mjsunit/common.js +++ b/test/mjsunit/common.js @@ -5,10 +5,6 @@ exports.libDir = node.path.join(exports.testDir, "../../lib"); node.libraryPaths.unshift(exports.libDir); var mjsunit = require("/mjsunit.js"); -include("/utils.js"); -// Copy mjsunit namespace out -for (var prop in mjsunit) { - if (mjsunit.hasOwnProperty(prop)) exports[prop] = mjsunit[prop]; -} - +var utils = require("/utils.js"); +node.mixin(exports, mjsunit, utils); diff --git a/test/mjsunit/disabled/test-cat.js b/test/mjsunit/disabled/test-cat.js index c3bc3fb496..22045bb569 100644 --- a/test/mjsunit/disabled/test-cat.js +++ b/test/mjsunit/disabled/test-cat.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("../common.js")); http = require("/http.js"); PORT = 8888; diff --git a/test/mjsunit/disabled/test-http-stress.js b/test/mjsunit/disabled/test-http-stress.js index 7397f1dcb8..3746683e39 100644 --- a/test/mjsunit/disabled/test-http-stress.js +++ b/test/mjsunit/disabled/test-http-stress.js @@ -1,4 +1,4 @@ -include('../mjsunit.js'); +node.mixin(require('../common.js')); var PORT = 8003; var request_count = 1000; diff --git a/test/mjsunit/disabled/test-remote-module-loading.js b/test/mjsunit/disabled/test-remote-module-loading.js index cead6d6bb0..2789b2e1c2 100644 --- a/test/mjsunit/disabled/test-remote-module-loading.js +++ b/test/mjsunit/disabled/test-remote-module-loading.js @@ -9,7 +9,7 @@ var s = node.http.createServer(function (req, res) { }); s.listen(8000); -include("mjsunit.js"); +node.mixin(require("../common.js")); var a = require("http://localhost:8000/") assertInstanceof(a.A, Function); diff --git a/test/mjsunit/disabled/test_dns.js b/test/mjsunit/disabled/test_dns.js index dc14ad5545..ccfcf00abe 100644 --- a/test/mjsunit/disabled/test_dns.js +++ b/test/mjsunit/disabled/test_dns.js @@ -1,3 +1,4 @@ +node.mixin(require("../common.js")); for (var i = 2; i < ARGV.length; i++) { var name = ARGV[i] puts("looking up " + name); diff --git a/test/mjsunit/test-buffered-file.js b/test/mjsunit/test-buffered-file.js index dc10100f8b..a27a3a714c 100644 --- a/test/mjsunit/test-buffered-file.js +++ b/test/mjsunit/test-buffered-file.js @@ -1,10 +1,10 @@ -include("common.js"); +node.mixin(require("common.js")); var testTxt = node.path.join(fixturesDir, "test.txt"); var libDir = node.path.join(testDir, "../../lib"); node.libraryPaths.unshift(libDir); -include("/file.js"); +node.mixin(require("/file.js")); var fileUnlinked = false; diff --git a/test/mjsunit/test-delayed-require.js b/test/mjsunit/test-delayed-require.js index 1070516074..3501bed6f9 100644 --- a/test/mjsunit/test-delayed-require.js +++ b/test/mjsunit/test-delayed-require.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); setTimeout(function () { a = require("fixtures/a.js"); diff --git a/test/mjsunit/test-event-emitter-add-listeners.js b/test/mjsunit/test-event-emitter-add-listeners.js index fa392c6090..6d42ff7289 100644 --- a/test/mjsunit/test-event-emitter-add-listeners.js +++ b/test/mjsunit/test-event-emitter-add-listeners.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var e = new node.EventEmitter(); diff --git a/test/mjsunit/test-exec.js b/test/mjsunit/test-exec.js index 7e386fdd68..65702cff10 100644 --- a/test/mjsunit/test-exec.js +++ b/test/mjsunit/test-exec.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); success_count = 0; error_count = 0; diff --git a/test/mjsunit/test-file-cat-noexist.js b/test/mjsunit/test-file-cat-noexist.js index 6b652d97a3..a35fb595d1 100644 --- a/test/mjsunit/test-file-cat-noexist.js +++ b/test/mjsunit/test-file-cat-noexist.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var got_error = false; var filename = node.path.join(fixturesDir, "does_not_exist.txt"); diff --git a/test/mjsunit/test-fs-stat.js b/test/mjsunit/test-fs-stat.js index 403a4ccb4d..33c14ba3d8 100644 --- a/test/mjsunit/test-fs-stat.js +++ b/test/mjsunit/test-fs-stat.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var got_error = false; var success_count = 0; diff --git a/test/mjsunit/test-fs-write.js b/test/mjsunit/test-fs-write.js index 6c4c2bdd9e..b72d4bd328 100644 --- a/test/mjsunit/test-fs-write.js +++ b/test/mjsunit/test-fs-write.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var path = node.path.join(fixturesDir, "write.txt"); var expected = "hello"; diff --git a/test/mjsunit/test-http-cat.js b/test/mjsunit/test-http-cat.js index 4e122655c0..625d287674 100644 --- a/test/mjsunit/test-http-cat.js +++ b/test/mjsunit/test-http-cat.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); http = require("/http.js"); PORT = 8888; diff --git a/test/mjsunit/test-http-client-race.js b/test/mjsunit/test-http-client-race.js index 8087d7e3db..1fbeff2b92 100644 --- a/test/mjsunit/test-http-client-race.js +++ b/test/mjsunit/test-http-client-race.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); http = require("/http.js"); PORT = 8888; diff --git a/test/mjsunit/test-http-client-upload.js b/test/mjsunit/test-http-client-upload.js index 6e95f11d84..f24acea9d4 100644 --- a/test/mjsunit/test-http-client-upload.js +++ b/test/mjsunit/test-http-client-upload.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); http = require("/http.js"); var PORT = 18032; diff --git a/test/mjsunit/test-http-malformed-request.js b/test/mjsunit/test-http-malformed-request.js index 72ddb611d6..3c7173c4eb 100644 --- a/test/mjsunit/test-http-malformed-request.js +++ b/test/mjsunit/test-http-malformed-request.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); http = require("/http.js"); diff --git a/test/mjsunit/test-http-proxy.js b/test/mjsunit/test-http-proxy.js index f902661b59..94fa4f0c44 100644 --- a/test/mjsunit/test-http-proxy.js +++ b/test/mjsunit/test-http-proxy.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); http = require("/http.js"); var PROXY_PORT = 8869; diff --git a/test/mjsunit/test-http-server.js b/test/mjsunit/test-http-server.js index 7495afa428..3d3bb50842 100644 --- a/test/mjsunit/test-http-server.js +++ b/test/mjsunit/test-http-server.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); http = require("/http.js"); diff --git a/test/mjsunit/test-http.js b/test/mjsunit/test-http.js index c8d5b2772c..ebdd6ee4f8 100644 --- a/test/mjsunit/test-http.js +++ b/test/mjsunit/test-http.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); http = require("/http.js"); PORT = 8888; diff --git a/test/mjsunit/test-mkdir-rmdir.js b/test/mjsunit/test-mkdir-rmdir.js index 08c2fa7dc8..6fedb5c1f8 100644 --- a/test/mjsunit/test-mkdir-rmdir.js +++ b/test/mjsunit/test-mkdir-rmdir.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var dirname = node.path.dirname(__filename); var fixtures = node.path.join(dirname, "fixtures"); diff --git a/test/mjsunit/test-module-loading.js b/test/mjsunit/test-module-loading.js index 814f7006f0..cfa3bda311 100644 --- a/test/mjsunit/test-module-loading.js +++ b/test/mjsunit/test-module-loading.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); debug("load test-module-loading.js"); diff --git a/test/mjsunit/test-multipart.js b/test/mjsunit/test-multipart.js index c8ba90cac7..262429fe53 100644 --- a/test/mjsunit/test-multipart.js +++ b/test/mjsunit/test-multipart.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); http = require("/http.js"); var multipart = require('/multipart.js'); diff --git a/test/mjsunit/test-process-buffering.js b/test/mjsunit/test-process-buffering.js index c55fa519d5..a5c09d8858 100644 --- a/test/mjsunit/test-process-buffering.js +++ b/test/mjsunit/test-process-buffering.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var pwd_called = false; diff --git a/test/mjsunit/test-process-kill.js b/test/mjsunit/test-process-kill.js index 8487190a8f..6851e0b2f6 100644 --- a/test/mjsunit/test-process-kill.js +++ b/test/mjsunit/test-process-kill.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var exit_status = -1; diff --git a/test/mjsunit/test-process-simple.js b/test/mjsunit/test-process-simple.js index 76d2ca9bef..2fb1976625 100644 --- a/test/mjsunit/test-process-simple.js +++ b/test/mjsunit/test-process-simple.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var cat = node.createChildProcess("cat"); diff --git a/test/mjsunit/test-process-spawn-loop.js b/test/mjsunit/test-process-spawn-loop.js index 0d92c33430..2b63dea67b 100644 --- a/test/mjsunit/test-process-spawn-loop.js +++ b/test/mjsunit/test-process-spawn-loop.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var N = 40; var finished = false; diff --git a/test/mjsunit/test-promise-wait.js b/test/mjsunit/test-promise-wait.js index 527473577c..aa7b04383a 100644 --- a/test/mjsunit/test-promise-wait.js +++ b/test/mjsunit/test-promise-wait.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var p1_done = false; var p1 = new node.Promise(); diff --git a/test/mjsunit/test-readdir.js b/test/mjsunit/test-readdir.js index 59813866cf..2bf09c63b3 100644 --- a/test/mjsunit/test-readdir.js +++ b/test/mjsunit/test-readdir.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var got_error = false; diff --git a/test/mjsunit/test-tcp-binary.js b/test/mjsunit/test-tcp-binary.js index db431a9d06..881a9bed93 100644 --- a/test/mjsunit/test-tcp-binary.js +++ b/test/mjsunit/test-tcp-binary.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); PORT = 23123; diff --git a/test/mjsunit/test-tcp-many-clients.js b/test/mjsunit/test-tcp-many-clients.js index 0bb644aa2c..5cc3ad24ca 100644 --- a/test/mjsunit/test-tcp-many-clients.js +++ b/test/mjsunit/test-tcp-many-clients.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); // settings var port = 20743; diff --git a/test/mjsunit/test-tcp-pingpong-delay.js b/test/mjsunit/test-tcp-pingpong-delay.js index 298aff922a..687c8d731c 100644 --- a/test/mjsunit/test-tcp-pingpong-delay.js +++ b/test/mjsunit/test-tcp-pingpong-delay.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); diff --git a/test/mjsunit/test-tcp-pingpong.js b/test/mjsunit/test-tcp-pingpong.js index d1e068da34..a974bf9240 100644 --- a/test/mjsunit/test-tcp-pingpong.js +++ b/test/mjsunit/test-tcp-pingpong.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); diff --git a/test/mjsunit/test-tcp-reconnect.js b/test/mjsunit/test-tcp-reconnect.js index c6cf6b9eee..d1d6e531d2 100644 --- a/test/mjsunit/test-tcp-reconnect.js +++ b/test/mjsunit/test-tcp-reconnect.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); var N = 50; var port = 8921; diff --git a/test/mjsunit/test-tcp-throttle-kernel-buffer.js b/test/mjsunit/test-tcp-throttle-kernel-buffer.js index 86cf4613fa..d5144b6ddf 100644 --- a/test/mjsunit/test-tcp-throttle-kernel-buffer.js +++ b/test/mjsunit/test-tcp-throttle-kernel-buffer.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); PORT = 20444; N = 30*1024; // 500kb diff --git a/test/mjsunit/test-tcp-throttle.js b/test/mjsunit/test-tcp-throttle.js index bcd3bcbb3c..cf3b028c54 100644 --- a/test/mjsunit/test-tcp-throttle.js +++ b/test/mjsunit/test-tcp-throttle.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); PORT = 20443; N = 200; diff --git a/test/mjsunit/test-tcp-timeout.js b/test/mjsunit/test-tcp-timeout.js index c60fcec32b..dacb1e1211 100644 --- a/test/mjsunit/test-tcp-timeout.js +++ b/test/mjsunit/test-tcp-timeout.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); tcp = require("/tcp.js"); port = 9992; exchanges = 0; diff --git a/test/mjsunit/test-timers.js b/test/mjsunit/test-timers.js index f1b43aad49..53c4b9dcdf 100644 --- a/test/mjsunit/test-timers.js +++ b/test/mjsunit/test-timers.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); var WINDOW = 200; // why is does this need to be so big? diff --git a/test/mjsunit/test-utf8-scripts.js b/test/mjsunit/test-utf8-scripts.js index c2950d3b22..cb820bcac3 100644 --- a/test/mjsunit/test-utf8-scripts.js +++ b/test/mjsunit/test-utf8-scripts.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); // üäö diff --git a/test/mjsunit/test-wait-ordering.js b/test/mjsunit/test-wait-ordering.js index cc0522201c..40e99dfc3a 100644 --- a/test/mjsunit/test-wait-ordering.js +++ b/test/mjsunit/test-wait-ordering.js @@ -1,4 +1,4 @@ -include("common.js"); +node.mixin(require("common.js")); function timer (t) { var promise = new node.Promise();