diff options
46 files changed, 136 insertions, 93 deletions
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index f334c01fd59..8974af647c9 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 2e1e35465a9..e338ad3806d 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 d9c26686878..869ae55a63b 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 20f04e89fce..00975dc3795 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 f766eca474e..4e6fbb0f23c 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 1cf79891507..57a40c269a8 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 0a477bbc0b0..4c79f0a875a 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 b74dac6209f..53338ab0c36 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 c3bc3fb4962..22045bb569b 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 7397f1dcb8c..3746683e392 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 cead6d6bb0c..2789b2e1c2f 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 dc14ad5545b..ccfcf00abe8 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 dc10100f8b7..a27a3a714cd 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 1070516074e..3501bed6f9d 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 fa392c60902..6d42ff7289e 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 7e386fdd68d..65702cff103 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 6b652d97a39..a35fb595d15 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 403a4ccb4dd..33c14ba3d88 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 6c4c2bdd9ef..b72d4bd328d 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 4e122655c01..625d2876742 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 8087d7e3dba..1fbeff2b924 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 6e95f11d84a..f24acea9d43 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 72ddb611d63..3c7173c4eb7 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 f902661b596..94fa4f0c444 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 7495afa4287..3d3bb50842a 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 c8d5b2772c5..ebdd6ee4f87 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 08c2fa7dc8b..6fedb5c1f87 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 814f7006f06..cfa3bda3115 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 c8ba90cac7a..262429fe531 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 c55fa519d5a..a5c09d8858e 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 8487190a8f1..6851e0b2f67 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 76d2ca9bef5..2fb19766257 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 0d92c334301..2b63dea67bb 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 527473577c9..aa7b04383ac 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 59813866cf2..2bf09c63b36 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 db431a9d066..881a9bed930 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 0bb644aa2cb..5cc3ad24cae 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 298aff922ac..687c8d731cb 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 d1e068da34a..a974bf92409 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 c6cf6b9eee2..d1d6e531d2b 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 86cf4613fa4..d5144b6ddfc 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 bcd3bcbb3c0..cf3b028c544 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 c60fcec32b6..dacb1e1211b 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 f1b43aad49c..53c4b9dcdfa 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 c2950d3b22e..cb820bcac3c 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 cc0522201c3..40e99dfc3a0 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(); |