diff --git a/.eslintignore b/.eslintignore index 9a143fda7d93d8..c29ea07ce66841 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,4 @@ lib/punycode.js +test/fixtures +test/**/node_modules +test/parallel/test-fs-non-number-arguments-throw.js diff --git a/.eslintrc b/.eslintrc index 8c7ffdc27b3d44..e023327fbb7d00 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,7 @@ ecmaFeatures: octalLiterals: true binaryLiterals: true generators: true + forOf: true rules: # Possible Errors @@ -54,6 +55,10 @@ rules: space-infix-ops: 2 ## require spaces return, throw, case space-return-throw-case: 2 + ## no space before function, eg. 'function()' + space-before-function-paren: [2, "never"] + ## require space before blocks, eg 'function() {' + space-before-blocks: [2, "always"] ## require parens for Constructor new-parens: 2 ## max 80 length diff --git a/Makefile b/Makefile index 451f81dde5dbea..94f130f5fb3287 100644 --- a/Makefile +++ b/Makefile @@ -375,7 +375,7 @@ bench-idle: ./$(NODE_EXE) benchmark/idle_clients.js & jslint: - ./$(NODE_EXE) tools/eslint/bin/eslint.js src lib --reset --quiet + ./$(NODE_EXE) tools/eslint/bin/eslint.js src lib test --reset --quiet CPPLINT_EXCLUDE ?= CPPLINT_EXCLUDE += src/node_lttng.cc diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 00000000000000..d5d95584ea6811 --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,5 @@ +## Test-specific linter rules + +rules: + ## allow unreachable code + no-unreachable: 0 diff --git a/test/addons/async-hello-world/test.js b/test/addons/async-hello-world/test.js index 83f5e7206ec073..a284a019f01a8b 100644 --- a/test/addons/async-hello-world/test.js +++ b/test/addons/async-hello-world/test.js @@ -1,15 +1,16 @@ +'use strict'; var assert = require('assert'); var binding = require('./build/Release/binding'); var called = false; -process.on('exit', function () { +process.on('exit', function() { assert(called); }); -binding(5, function (err, val) { +binding(5, function(err, val) { assert.equal(null, err); assert.equal(10, val); - process.nextTick(function () { + process.nextTick(function() { called = true; }); }); diff --git a/test/addons/at-exit/test.js b/test/addons/at-exit/test.js index 4466b898afe597..c36f59b976e983 100644 --- a/test/addons/at-exit/test.js +++ b/test/addons/at-exit/test.js @@ -1 +1,2 @@ +'use strict'; var binding = require('./build/Release/binding'); diff --git a/test/addons/hello-world-function-export/test.js b/test/addons/hello-world-function-export/test.js index 238e105381dd54..1056386583faf1 100644 --- a/test/addons/hello-world-function-export/test.js +++ b/test/addons/hello-world-function-export/test.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var binding = require('./build/Release/binding'); assert.equal('world', binding()); diff --git a/test/addons/hello-world/test.js b/test/addons/hello-world/test.js index 18008db58124b2..c0492292fd7250 100644 --- a/test/addons/hello-world/test.js +++ b/test/addons/hello-world/test.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var binding = require('./build/Release/binding'); assert.equal('world', binding.hello()); diff --git a/test/addons/repl-domain-abort/test.js b/test/addons/repl-domain-abort/test.js index f0d968d173f005..a520df03805ccb 100644 --- a/test/addons/repl-domain-abort/test.js +++ b/test/addons/repl-domain-abort/test.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var repl = require('repl'); var stream = require('stream'); diff --git a/test/addons/smalloc-alloc/test.js b/test/addons/smalloc-alloc/test.js index 47197be631ed17..76648e04c4ce07 100644 --- a/test/addons/smalloc-alloc/test.js +++ b/test/addons/smalloc-alloc/test.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var binding = require('./build/Release/binding'); var obj = binding.alloc(16); diff --git a/test/common.js b/test/common.js index ec0b387328d6b7..94d6f2109576b9 100644 --- a/test/common.js +++ b/test/common.js @@ -1,3 +1,4 @@ +'use strict'; var path = require('path'); var fs = require('fs'); var assert = require('assert'); @@ -107,8 +108,8 @@ if (process.env.NODE_COMMON_PIPE) { if (process.platform === 'win32') { exports.faketimeCli = false; } else { - exports.faketimeCli = path.join(__dirname, "..", "tools", "faketime", "src", - "faketime"); + exports.faketimeCli = path.join(__dirname, '..', 'tools', 'faketime', 'src', + 'faketime'); } var ifaces = os.networkInterfaces(); @@ -307,7 +308,7 @@ exports.mustCall = function(fn, expected) { var context = { expected: expected, actual: 0, - stack: (new Error).stack, + stack: (new Error()).stack, name: fn.name || '' }; @@ -345,11 +346,11 @@ if (process.platform === 'win32') { */ exports.getServiceName = function getServiceName(port, protocol) { if (port == null) { - throw new Error("Missing port number"); + throw new Error('Missing port number'); } if (typeof protocol !== 'string') { - throw new Error("Protocol must be a string"); + throw new Error('Protocol must be a string'); } /* @@ -360,10 +361,10 @@ exports.getServiceName = function getServiceName(port, protocol) { try { /* - * I'm not a big fan of readFileSync, but reading /etc/services asynchronously - * here would require implementing a simple line parser, which seems overkill - * for a simple utility function that is not running concurrently with any - * other one. + * I'm not a big fan of readFileSync, but reading /etc/services + * asynchronously here would require implementing a simple line parser, + * which seems overkill for a simple utility function that is not running + * concurrently with any other one. */ var servicesContent = fs.readFileSync(etcServicesFileName, { encoding: 'utf8'}); @@ -380,7 +381,7 @@ exports.getServiceName = function getServiceName(port, protocol) { } return serviceName; -} +}; exports.hasMultiLocalhost = function hasMultiLocalhost() { var TCP = process.binding('tcp_wrap').TCP; @@ -397,7 +398,7 @@ exports.isValidHostname = function(str) { '(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$'); return !!str.match(re) && str.length <= 255; -} +}; exports.fileExists = function(pathname) { try { diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js index c3f219874e43af..714a22c2a22fdc 100644 --- a/test/debugger/helper-debugger-repl.js +++ b/test/debugger/helper-debugger-repl.js @@ -1,3 +1,4 @@ +'use strict'; process.env.NODE_DEBUGGER_TIMEOUT = 2000; var common = require('../common'); var assert = require('assert'); @@ -55,7 +56,7 @@ function startDebugger(scriptToDebug) { quitCalled = true; child.stdin.write('quit'); child.kill('SIGTERM'); - } + }; setTimeout(function() { console.error('dying badly buffer=%j', buffer); diff --git a/test/debugger/test-debug-break-on-uncaught.js b/test/debugger/test-debug-break-on-uncaught.js index 57095d93abf9a0..397c4225d27f7e 100644 --- a/test/debugger/test-debug-break-on-uncaught.js +++ b/test/debugger/test-debug-break-on-uncaught.js @@ -1,3 +1,4 @@ +'use strict'; var path = require('path'); var assert = require('assert'); var spawn = require('child_process').spawn; @@ -44,7 +45,7 @@ function runScenario(scriptName, throwsInFile, throwsOnLine, next) { child.on('close', function() { assert(asserted, 'debugger did not pause on exception'); if (next) next(); - }) + }); var exceptions = []; diff --git a/test/debugger/test-debugger-client.js b/test/debugger/test-debugger-client.js index 4bb27c277eab72..972c94707ee56b 100644 --- a/test/debugger/test-debugger-client.js +++ b/test/debugger/test-debugger-client.js @@ -1,3 +1,4 @@ +'use strict'; process.env.NODE_DEBUGGER_TIMEOUT = 2000; var common = require('../common'); var assert = require('assert'); @@ -66,7 +67,7 @@ var d = 'Content-Length: 466\r\n\r\n' + '{"seq":10,"type":"event","event":"afterCompile","success":true,' + '"body":{"script":{"handle":1,"type":"script","name":"dns.js",' + '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,' + - '"sourceStart":"(function (module, exports, require) {' + + '"sourceStart":"(function(module, exports, require) {' + 'var dns = process.binding(\'cares\')' + ';\\nvar ne","sourceLength":6137,"scriptType":2,"compilationType":0,' + '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":' + @@ -127,8 +128,8 @@ addTest(function(client, done) { var connectCount = 0; -var script = 'setTimeout(function () { console.log("blah"); });' + - 'setInterval(function () {}, 1000000);'; +var script = 'setTimeout(function() { console.log("blah"); });' + + 'setInterval(function() {}, 1000000);'; var nodeProcess; diff --git a/test/debugger/test-debugger-debug-brk.js b/test/debugger/test-debugger-debug-brk.js index 7bf7d639f5362c..3b54f853bc8de3 100644 --- a/test/debugger/test-debugger-debug-brk.js +++ b/test/debugger/test-debugger-debug-brk.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/debugger/test-debugger-remote.js b/test/debugger/test-debugger-remote.js index 641199a1714af7..abb67c19cbf0cd 100644 --- a/test/debugger/test-debugger-remote.js +++ b/test/debugger/test-debugger-remote.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/debugger/test-debugger-repl-break-in-module.js b/test/debugger/test-debugger-repl-break-in-module.js index 8d33d126438064..995f6fe0db3a3d 100644 --- a/test/debugger/test-debugger-repl-break-in-module.js +++ b/test/debugger/test-debugger-repl-break-in-module.js @@ -1,3 +1,4 @@ +'use strict'; var repl = require('./helper-debugger-repl.js'); repl.startDebugger('break-in-module/main.js'); diff --git a/test/debugger/test-debugger-repl-restart.js b/test/debugger/test-debugger-repl-restart.js index 9d83d67188a63c..d3b2c169dea0a8 100644 --- a/test/debugger/test-debugger-repl-restart.js +++ b/test/debugger/test-debugger-repl-restart.js @@ -1,3 +1,4 @@ +'use strict'; var repl = require('./helper-debugger-repl.js'); repl.startDebugger('breakpoints.js'); @@ -7,7 +8,7 @@ var linesWithBreakpoint = [ // We slice here, because addTest will change the given array. repl.addTest('sb(6)', linesWithBreakpoint.slice()); -var initialLines = repl.initialLines.slice() +var initialLines = repl.initialLines.slice(); initialLines.splice(2, 0, /Restoring/, /Warning/); // Restart the debugged script diff --git a/test/debugger/test-debugger-repl-term.js b/test/debugger/test-debugger-repl-term.js index a42a253c5a9aee..741adf682ab1dd 100644 --- a/test/debugger/test-debugger-repl-term.js +++ b/test/debugger/test-debugger-repl-term.js @@ -1,3 +1,4 @@ +'use strict'; process.env.NODE_FORCE_READLINE = 1; var repl = require('./helper-debugger-repl.js'); diff --git a/test/debugger/test-debugger-repl-utf8.js b/test/debugger/test-debugger-repl-utf8.js index 0fccf2477b03ab..c32216e5d6dc66 100644 --- a/test/debugger/test-debugger-repl-utf8.js +++ b/test/debugger/test-debugger-repl-utf8.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var script = common.fixturesDir + '/breakpoints_utf8.js'; process.env.NODE_DEBUGGER_TEST_SCRIPT = script; diff --git a/test/debugger/test-debugger-repl.js b/test/debugger/test-debugger-repl.js index 788ea9cb6a273f..2e44da55d72859 100644 --- a/test/debugger/test-debugger-repl.js +++ b/test/debugger/test-debugger-repl.js @@ -1,3 +1,4 @@ +'use strict'; var repl = require('./helper-debugger-repl.js'); repl.startDebugger('breakpoints.js'); diff --git a/test/disabled/GH-670.js b/test/disabled/GH-670.js index af65bbdc0ffc95..28f90a72ad487a 100644 --- a/test/disabled/GH-670.js +++ b/test/disabled/GH-670.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var https = require('https'); diff --git a/test/disabled/test-cat.js b/test/disabled/test-cat.js index 02d2d41a6663c8..e37820ba4b338c 100644 --- a/test/disabled/test-cat.js +++ b/test/disabled/test-cat.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common.js'); var assert = require('assert'); var http = require('http'); diff --git a/test/disabled/test-child-process-custom-fds.js b/test/disabled/test-child-process-custom-fds.js index d64586c508d9f1..12087684727dbf 100644 --- a/test/disabled/test-child-process-custom-fds.js +++ b/test/disabled/test-child-process-custom-fds.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-child-process-customfd-bounded.js b/test/disabled/test-child-process-customfd-bounded.js index 203e6acaf379c5..98da4ef4d1391e 100644 --- a/test/disabled/test-child-process-customfd-bounded.js +++ b/test/disabled/test-child-process-customfd-bounded.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var bigish = Array(200); diff --git a/test/disabled/test-child-process-uid-gid.js b/test/disabled/test-child-process-uid-gid.js index 5ab570b813f48f..90708bc2ca4016 100644 --- a/test/disabled/test-child-process-uid-gid.js +++ b/test/disabled/test-child-process-uid-gid.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/disabled/test-debug-brk-file.js b/test/disabled/test-debug-brk-file.js index ca2af1b7121811..4b5823f56a64e1 100644 --- a/test/disabled/test-debug-brk-file.js +++ b/test/disabled/test-debug-brk-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/disabled/test-debug-brk-no-arg.js b/test/disabled/test-debug-brk-no-arg.js index 547cd1b287a9ed..7e678a76dfc8f8 100644 --- a/test/disabled/test-debug-brk-no-arg.js +++ b/test/disabled/test-debug-brk-no-arg.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/disabled/test-dgram-multicast.js b/test/disabled/test-dgram-multicast.js index d66bd63e50dcbe..f2668d24c9a51a 100644 --- a/test/disabled/test-dgram-multicast.js +++ b/test/disabled/test-dgram-multicast.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-dgram-send-error.js b/test/disabled/test-dgram-send-error.js index 00901dd563f7d8..1ed594a389a8c4 100644 --- a/test/disabled/test-dgram-send-error.js +++ b/test/disabled/test-dgram-send-error.js @@ -1,3 +1,4 @@ +'use strict'; // Some operating systems report errors when an UDP message is sent to an // unreachable host. This error can be reported by sendto() and even by // recvfrom(). Node should not propagate this error to the user. diff --git a/test/disabled/test-dgram-unix-anon.js b/test/disabled/test-dgram-unix-anon.js index 1a8b5e3a57bd73..417ff8c2915f32 100644 --- a/test/disabled/test-dgram-unix-anon.js +++ b/test/disabled/test-dgram-unix-anon.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-dgram-unix.js b/test/disabled/test-dgram-unix.js index f2a24a9c361c8e..d8ebd81a92da9d 100644 --- a/test/disabled/test-dgram-unix.js +++ b/test/disabled/test-dgram-unix.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-eio-race.js b/test/disabled/test-eio-race.js index b9e14f76b22f5d..32585894d0d7c3 100644 --- a/test/disabled/test-eio-race.js +++ b/test/disabled/test-eio-race.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -36,7 +37,7 @@ function tryToKillEventLoop() { // Generate a lot of thread pool events var pos = 0; -fs.open(filename, 'r', 0666, function(err, fd) { +fs.open(filename, 'r', 0o666, function(err, fd) { if (err) throw err; function readChunk() { diff --git a/test/disabled/test-eio-race2.js b/test/disabled/test-eio-race2.js index 487486a15d8245..16c0468775adf8 100644 --- a/test/disabled/test-eio-race2.js +++ b/test/disabled/test-eio-race2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/disabled/test-eio-race3.js b/test/disabled/test-eio-race3.js index 820128ae463fcd..872a105dd5ac90 100644 --- a/test/disabled/test-eio-race3.js +++ b/test/disabled/test-eio-race3.js @@ -1,3 +1,4 @@ +'use strict'; /* XXX Can this test be modified to not call the now-removed wait()? */ var common = require('../common'); diff --git a/test/disabled/test-eio-race4.js b/test/disabled/test-eio-race4.js index e8a2e591362d83..d22c4225b1544e 100644 --- a/test/disabled/test-eio-race4.js +++ b/test/disabled/test-eio-race4.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/disabled/test-fs-largefile.js b/test/disabled/test-fs-largefile.js index 21406e3aad0431..498bfa45a06dda 100644 --- a/test/disabled/test-fs-largefile.js +++ b/test/disabled/test-fs-largefile.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'), diff --git a/test/disabled/test-http-abort-stream-end.js b/test/disabled/test-http-abort-stream-end.js index b0a23d92defe26..cfa531cedf5523 100644 --- a/test/disabled/test-http-abort-stream-end.js +++ b/test/disabled/test-http-abort-stream-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-http-agent2.js b/test/disabled/test-http-agent2.js index c1ccd70a1e4fd4..928194757b3a5d 100644 --- a/test/disabled/test-http-agent2.js +++ b/test/disabled/test-http-agent2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/disabled/test-http-big-proxy-responses.js b/test/disabled/test-http-big-proxy-responses.js index fe70473f587a30..9727edbb80639f 100644 --- a/test/disabled/test-http-big-proxy-responses.js +++ b/test/disabled/test-http-big-proxy-responses.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'), diff --git a/test/disabled/test-http-head-request.js b/test/disabled/test-http-head-request.js index 2dfe20bc3d06d8..c6fa78fe2b7309 100644 --- a/test/disabled/test-http-head-request.js +++ b/test/disabled/test-http-head-request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-http-stress.js b/test/disabled/test-http-stress.js index 09a0b7e48a9e47..e4b51e07ca31df 100644 --- a/test/disabled/test-http-stress.js +++ b/test/disabled/test-http-stress.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-http-tls.js b/test/disabled/test-http-tls.js index 384849d00df140..867c3a076aefdc 100644 --- a/test/disabled/test-http-tls.js +++ b/test/disabled/test-http-tls.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-https-loop-to-google.js b/test/disabled/test-https-loop-to-google.js index cb29f2c226fb14..e498895ed23be0 100644 --- a/test/disabled/test-https-loop-to-google.js +++ b/test/disabled/test-https-loop-to-google.js @@ -1,3 +1,4 @@ +'use strict'; // Failing test for https // Will fail with "socket hang up" for 4 out of 10 requests @@ -7,26 +8,20 @@ var common = require('../common'); var https = require('https'); -for (var i = 0; i < 10; ++i) -{ - https.get( - { - host: 'www.google.com', - path: '/accounts/o8/id', - port: 443 - }, function(res) - { - var data = ''; - res.on('data', function(chunk) - { - data += chunk; - }); - res.on('end', function() - { - console.log(res.statusCode); - }); - }).on('error', function(error) - { - console.log(error); - }); +for (var i = 0; i < 10; ++i) { + https.get({ + host: 'www.google.com', + path: '/accounts/o8/id', + port: 443 + }, function(res) { + var data = ''; + res.on('data', function(chunk) { + data += chunk; + }); + res.on('end', function() { + console.log(res.statusCode); + }); + }).on('error', function(error) { + console.log(error); + }); } diff --git a/test/disabled/test-idle-watcher.js b/test/disabled/test-idle-watcher.js index b1038d56fd1b9e..6cf78ad1740953 100644 --- a/test/disabled/test-idle-watcher.js +++ b/test/disabled/test-idle-watcher.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-net-fd-passing.js b/test/disabled/test-net-fd-passing.js index 7b73056393ec3f..380032a2e66b5b 100644 --- a/test/disabled/test-net-fd-passing.js +++ b/test/disabled/test-net-fd-passing.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/disabled/test-net-tls-pummel.js b/test/disabled/test-net-tls-pummel.js index 0312d70ea722cb..0fb63d33f441fe 100644 --- a/test/disabled/test-net-tls-pummel.js +++ b/test/disabled/test-net-tls-pummel.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-net-tls.js b/test/disabled/test-net-tls.js index 9783b7ee3c81a1..01797fc689f44f 100644 --- a/test/disabled/test-net-tls.js +++ b/test/disabled/test-net-tls.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/disabled/test-process-title.js b/test/disabled/test-process-title.js index 1cd361dd87c572..629d78d72373a7 100644 --- a/test/disabled/test-process-title.js +++ b/test/disabled/test-process-title.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/disabled/test-readline.js b/test/disabled/test-readline.js index 1572036a8749d9..9bb9943bd2a403 100644 --- a/test/disabled/test-readline.js +++ b/test/disabled/test-readline.js @@ -1,3 +1,4 @@ +'use strict'; // Can't test this when 'make test' doesn't assign a tty to the stdout. // Yet another use-case for require('tty').spawn ? var common = require('../common'); @@ -36,10 +37,10 @@ var readlineFakeStream = function() { } }); var _stdoutWrite = process.stdout.write; - process.stdout.write = function (data) { + process.stdout.write = function(data) { data.split('').forEach(rl.written_bytes.push.bind(rl.written_bytes)); _stdoutWrite.apply(this, arguments); - } + }; rl.written_bytes = written_bytes; return rl; }; @@ -49,7 +50,7 @@ var written_bytes_length, refreshed; rl.write('foo'); assert.equal(3, rl.cursor); -[key.xterm, key.rxvt, key.gnome, key.putty].forEach(function (key) { +[key.xterm, key.rxvt, key.gnome, key.putty].forEach(function(key) { rl.write.apply(rl, key.home); assert.equal(0, rl.cursor); rl.write.apply(rl, key.end); @@ -72,7 +73,7 @@ rl.write.apply(rl, key.xterm.home); {cursor: 7, key: key.xterm.metab}, {cursor: 4, key: key.xterm.metab}, {cursor: 0, key: key.xterm.metab}, -].forEach(function (action) { +].forEach(function(action) { written_bytes_length = rl.written_bytes.length; rl.write.apply(rl, action.key); assert.equal(action.cursor, rl.cursor); @@ -83,7 +84,14 @@ rl.write.apply(rl, key.xterm.home); rl = readlineFakeStream(); rl.write('foo bar.hop/zoo'); rl.write.apply(rl, key.xterm.home); -['bar.hop/zoo', '.hop/zoo', 'hop/zoo', '/zoo', 'zoo', ''].forEach(function (expectedLine) { +[ + 'bar.hop/zoo', + '.hop/zoo', + 'hop/zoo', + '/zoo', + 'zoo', + '' +].forEach(function(expectedLine) { rl.write.apply(rl, key.xterm.metad); assert.equal(0, rl.cursor); assert.equal(expectedLine, rl.line); diff --git a/test/disabled/test-remote-module-loading.js b/test/disabled/test-remote-module-loading.js index c4d90fb80d0c50..d589ecf35be4b7 100644 --- a/test/disabled/test-remote-module-loading.js +++ b/test/disabled/test-remote-module-loading.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-sendfd.js b/test/disabled/test-sendfd.js index 0e1dd6f1bff37a..4eefbeab549685 100644 --- a/test/disabled/test-sendfd.js +++ b/test/disabled/test-sendfd.js @@ -1,3 +1,4 @@ +'use strict'; // Test sending and receiving a file descriptor. // // This test is pretty complex. It ends up spawning test/fixtures/recvfd.js diff --git a/test/disabled/test-setuidgid.js b/test/disabled/test-setuidgid.js index 90923b922d7711..bf3726ab006d36 100644 --- a/test/disabled/test-setuidgid.js +++ b/test/disabled/test-setuidgid.js @@ -1,3 +1,4 @@ +'use strict'; // Requires special privileges var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/test-tls-large-push.js b/test/disabled/test-tls-large-push.js index a5e206e477bef2..80a3cf52209a2f 100644 --- a/test/disabled/test-tls-large-push.js +++ b/test/disabled/test-tls-large-push.js @@ -1,3 +1,5 @@ +/* eslint-disable no-debugger */ +'use strict'; // Server sends a large string. Client counts bytes and pauses every few // seconds. Makes sure that pause and resume work properly. var common = require('../common'); @@ -39,7 +41,7 @@ server.listen(common.PORT, function() { /* client.pause(); - process.nextTick(function () { + process.nextTick(function() { client.resume(); }); */ diff --git a/test/disabled/test-tls-server.js b/test/disabled/test-tls-server.js index 20cc3f9fc79c39..c1e62bf01cea20 100644 --- a/test/disabled/test-tls-server.js +++ b/test/disabled/test-tls-server.js @@ -1,3 +1,4 @@ +'use strict'; // Example of new TLS API. Test with: // // $> openssl s_client -connect localhost:12346 \ diff --git a/test/disabled/test-tty-stdio.js b/test/disabled/test-tty-stdio.js index 0d963958abb5bd..57d7ee67759d5a 100644 --- a/test/disabled/test-tty-stdio.js +++ b/test/disabled/test-tty-stdio.js @@ -1,3 +1,4 @@ +'use strict'; // Can't test this when 'make test' doesn't assign a tty to the stdout. var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/tls-client.js b/test/disabled/tls-client.js index 48c715b29baf47..b47b681f95d026 100644 --- a/test/disabled/tls-client.js +++ b/test/disabled/tls-client.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var tls = require('tls'); var fs = require('fs'); diff --git a/test/disabled/tls_client.js b/test/disabled/tls_client.js index 65d18dd7f21256..425cb54a5910fd 100644 --- a/test/disabled/tls_client.js +++ b/test/disabled/tls_client.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/disabled/tls_server.js b/test/disabled/tls_server.js index 1174b8f6d04fcc..b3f43b564d067a 100644 --- a/test/disabled/tls_server.js +++ b/test/disabled/tls_server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/fixtures/child-process-persistent.js b/test/fixtures/child-process-persistent.js index 226ab3329d91d4..45a50f5a263ad6 100644 --- a/test/fixtures/child-process-persistent.js +++ b/test/fixtures/child-process-persistent.js @@ -1 +1 @@ -setInterval(function () {}, 500); +setInterval(function() {}, 500); diff --git a/test/gc/node_modules/weak/lib/weak.js b/test/gc/node_modules/weak/lib/weak.js index 8081a76c45f9f1..535caf615c648e 100644 --- a/test/gc/node_modules/weak/lib/weak.js +++ b/test/gc/node_modules/weak/lib/weak.js @@ -1,3 +1,4 @@ +'use strict'; var bindings try { bindings = require('../build/Release/weakref.node') @@ -13,6 +14,6 @@ module.exports = bindings.create // backwards-compat with node-weakref bindings.weaken = bindings.create -Object.keys(bindings).forEach(function (name) { +Object.keys(bindings).forEach(function(name) { module.exports[name] = bindings[name] }) diff --git a/test/gc/test-http-client-connaborted.js b/test/gc/test-http-client-connaborted.js index c58b4d5f752457..20a4b38481ae0c 100644 --- a/test/gc/test-http-client-connaborted.js +++ b/test/gc/test-http-client-connaborted.js @@ -1,3 +1,4 @@ +'use strict'; // just like test/gc/http-client.js, // but aborting every connection that comes in. @@ -15,7 +16,7 @@ var http = require('http'), assert = require('assert'), PORT = common.PORT; -console.log('We should do '+ todo +' requests'); +console.log('We should do ' + todo + ' requests'); var http = require('http'); var server = http.createServer(serverHandler); @@ -25,9 +26,9 @@ function getall() { if (count >= todo) return; - (function(){ + (function() { function cb(res) { - done+=1; + done += 1; statusLater(); } @@ -39,7 +40,7 @@ function getall() { count++; weak(req, afterGC); - })() + })(); setImmediate(getall); } @@ -47,7 +48,7 @@ function getall() { for (var i = 0; i < 10; i++) getall(); -function afterGC(){ +function afterGC() { countGC ++; } diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js index bf9fb7c1fba9f8..98d046e180f11b 100644 --- a/test/gc/test-http-client-onerror.js +++ b/test/gc/test-http-client-onerror.js @@ -1,3 +1,4 @@ +'use strict'; // just like test/gc/http-client.js, // but with an on('error') handler that does nothing. @@ -17,7 +18,7 @@ var http = require('http'), assert = require('assert'), PORT = common.PORT; -console.log('We should do '+ todo +' requests'); +console.log('We should do ' + todo + ' requests'); var http = require('http'); var server = http.createServer(serverHandler); @@ -27,10 +28,10 @@ function getall() { if (count >= todo) return; - (function(){ + (function() { function cb(res) { res.resume(); - done+=1; + done += 1; statusLater(); } function onerror(er) { @@ -45,7 +46,7 @@ function getall() { count++; weak(req, afterGC); - })() + })(); setImmediate(getall); } @@ -53,7 +54,7 @@ function getall() { for (var i = 0; i < 10; i++) getall(); -function afterGC(){ +function afterGC() { countGC ++; } diff --git a/test/gc/test-http-client-timeout.js b/test/gc/test-http-client-timeout.js index 727d133f711ad8..5bb2d2b05b4fb0 100644 --- a/test/gc/test-http-client-timeout.js +++ b/test/gc/test-http-client-timeout.js @@ -1,10 +1,11 @@ +'use strict'; // just like test/gc/http-client.js, // but with a timeout set function serverHandler(req, res) { - setTimeout(function () { + setTimeout(function() { req.resume(); - res.writeHead(200) + res.writeHead(200); res.end('hello\n'); }, 100); } @@ -19,7 +20,7 @@ var http = require('http'), assert = require('assert'), PORT = common.PORT; -console.log('We should do '+ todo +' requests'); +console.log('We should do ' + todo + ' requests'); var http = require('http'); var server = http.createServer(serverHandler); @@ -29,10 +30,10 @@ function getall() { if (count >= todo) return; - (function(){ + (function() { function cb(res) { res.resume(); - done+=1; + done += 1; statusLater(); } @@ -42,13 +43,13 @@ function getall() { port: PORT }, cb); req.on('error', cb); - req.setTimeout(10, function(){ - console.log('timeout (expected)') + req.setTimeout(10, function() { + console.log('timeout (expected)'); }); count++; weak(req, afterGC); - })() + })(); setImmediate(getall); } @@ -56,7 +57,7 @@ function getall() { for(var i = 0; i < 10; i++) getall(); -function afterGC(){ +function afterGC() { countGC ++; } diff --git a/test/gc/test-http-client.js b/test/gc/test-http-client.js index 6aedda7edef755..7c3259d38b0ba1 100644 --- a/test/gc/test-http-client.js +++ b/test/gc/test-http-client.js @@ -1,3 +1,4 @@ +'use strict'; // just a simple http server and client. function serverHandler(req, res) { @@ -15,7 +16,7 @@ var http = require('http'), assert = require('assert'), PORT = common.PORT; -console.log('We should do '+ todo +' requests'); +console.log('We should do ' + todo + ' requests'); var http = require('http'); var server = http.createServer(serverHandler); @@ -26,11 +27,11 @@ function getall() { if (count >= todo) return; - (function(){ + (function() { function cb(res) { res.resume(); - console.error('in cb') - done+=1; + console.error('in cb'); + done += 1; res.on('end', gc); } @@ -38,11 +39,11 @@ function getall() { hostname: 'localhost', pathname: '/', port: PORT - }, cb) + }, cb); count++; weak(req, afterGC); - })() + })(); setImmediate(getall); } @@ -50,7 +51,7 @@ function getall() { for (var i = 0; i < 10; i++) getall(); -function afterGC(){ +function afterGC() { countGC ++; } diff --git a/test/gc/test-net-timeout.js b/test/gc/test-net-timeout.js index 2ef03b2632d045..6c3b4f245be452 100644 --- a/test/gc/test-net-timeout.js +++ b/test/gc/test-net-timeout.js @@ -1,3 +1,4 @@ +'use strict'; // just like test/gc/http-client-timeout.js, // but using a net server/client instead @@ -11,7 +12,7 @@ function serverHandler(sock) { sock.on('error', function(err) { assert.strictEqual(err.code, 'ECONNRESET'); }); - timer = setTimeout(function () { + timer = setTimeout(function() { sock.end('hello\n'); }, 100); } @@ -26,7 +27,7 @@ var net = require('net'), assert = require('assert'), PORT = common.PORT; -console.log('We should do '+ todo +' requests'); +console.log('We should do ' + todo + ' requests'); var server = net.createServer(serverHandler); server.listen(PORT, getall); @@ -35,7 +36,7 @@ function getall() { if (count >= todo) return; - (function(){ + (function() { var req = net.connect(PORT, '127.0.0.1'); req.resume(); req.setTimeout(10, function() { @@ -55,7 +56,7 @@ function getall() { for (var i = 0; i < 10; i++) getall(); -function afterGC(){ +function afterGC() { countGC ++; } diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index d60fb0bd3442c2..4cf5d7226f2c50 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), dgram = require('dgram'), @@ -144,7 +145,7 @@ if (process.argv[2] !== 'child') { // bind the address explicitly for sending // INADDR_BROADCAST to only one interface sendSocket.bind(common.PORT, bindAddress); - sendSocket.on('listening', function () { + sendSocket.on('listening', function() { sendSocket.setBroadcast(true); }); @@ -162,9 +163,7 @@ if (process.argv[2] !== 'child') { sendSocket.send(buf, 0, buf.length, common.PORT, LOCAL_BROADCAST_HOST, function(err) { - if (err) throw err; - console.error('[PARENT] sent %s to %s:%s', util.inspect(buf.toString()), LOCAL_BROADCAST_HOST, common.PORT); diff --git a/test/internet/test-dgram-multicast-multi-process.js b/test/internet/test-dgram-multicast-multi-process.js index 66c92b285c2a4c..05acb844e54490 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), dgram = require('dgram'), @@ -129,7 +130,7 @@ if (process.argv[2] !== 'child') { sendSocket.bind(); // The socket is actually created async now - sendSocket.on('listening', function () { + sendSocket.on('listening', function() { sendSocket.setTTL(1); sendSocket.setBroadcast(true); sendSocket.setMulticastTTL(1); @@ -206,7 +207,7 @@ if (process.argv[2] === 'child') { listenSocket.bind(common.PORT); - listenSocket.on('listening', function () { + listenSocket.on('listening', function() { listenSocket.addMembership(LOCAL_BROADCAST_HOST); }); } diff --git a/test/internet/test-dns-txt-sigsegv.js b/test/internet/test-dns-txt-sigsegv.js index 75d34c21c06dd8..eba5c66c464981 100644 --- a/test/internet/test-dns-txt-sigsegv.js +++ b/test/internet/test-dns-txt-sigsegv.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dns = require('dns'); diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index b980b822c112b4..eb7bab85475b2a 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'), dns = require('dns'), @@ -500,7 +501,8 @@ TEST(function test_lookup_null_all(done) { TEST(function test_lookup_all_ipv4(done) { - var req = dns.lookup('www.google.com', {all: true, family: 4}, function(err, ips) { + var req = dns.lookup('www.google.com', {all: true, family: 4}, + function(err, ips) { if (err) throw err; assert.ok(Array.isArray(ips)); assert.ok(ips.length > 0); @@ -518,7 +520,8 @@ TEST(function test_lookup_all_ipv4(done) { TEST(function test_lookup_all_ipv6(done) { - var req = dns.lookup('www.google.com', {all: true, family: 6}, function(err, ips) { + var req = dns.lookup('www.google.com', {all: true, family: 6}, + function(err, ips) { if (err) throw err; assert.ok(Array.isArray(ips)); assert.ok(ips.length > 0); diff --git a/test/internet/test-http-dns-fail.js b/test/internet/test-http-dns-fail.js index 7d1cfbf630472d..151597de14cb0e 100644 --- a/test/internet/test-http-dns-fail.js +++ b/test/internet/test-http-dns-fail.js @@ -1,3 +1,4 @@ +'use strict'; /* * Repeated requests for a domain that fails to resolve * should trigger the error event after each attempt. diff --git a/test/internet/test-http-https-default-ports.js b/test/internet/test-http-https-default-ports.js index 26732ee086f1fa..1133221e6b7d44 100644 --- a/test/internet/test-http-https-default-ports.js +++ b/test/internet/test-http-https-default-ports.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/internet/test-net-connect-timeout.js b/test/internet/test-net-connect-timeout.js index a55cf5e4bbf260..d122229397fd75 100644 --- a/test/internet/test-net-connect-timeout.js +++ b/test/internet/test-net-connect-timeout.js @@ -1,3 +1,4 @@ +'use strict'; // This example attempts to time out before the connection is established // https://groups.google.com/forum/#!topic/nodejs/UE0ZbfLt6t8 // https://groups.google.com/forum/#!topic/nodejs-dev/jR7-5UDqXkw diff --git a/test/internet/test-net-connect-unref.js b/test/internet/test-net-connect-unref.js index dc0462ffd0238b..a712490d31f566 100644 --- a/test/internet/test-net-connect-unref.js +++ b/test/internet/test-net-connect-unref.js @@ -1,9 +1,10 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); var client, killed = false, ended = false; -var TIMEOUT = 10 * 1000 +var TIMEOUT = 10 * 1000; client = net.createConnection(53, '8.8.8.8', function() { client.unref(); diff --git a/test/internet/test-tls-connnect-melissadata.js b/test/internet/test-tls-connnect-melissadata.js index 61239c89c80c3f..96ff41af30cbcc 100644 --- a/test/internet/test-tls-connnect-melissadata.js +++ b/test/internet/test-tls-connnect-melissadata.js @@ -1,3 +1,4 @@ +'use strict'; // Test for authorized access to the server which has a cross root // certification between Starfield Class 2 and ValiCert Class 2 var tls = require('tls'); diff --git a/test/internet/test-tls-reuse-host-from-socket.js b/test/internet/test-tls-reuse-host-from-socket.js index 2f6392ce83455a..f3864908155f0e 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/internet/test-tls-reuse-host-from-socket.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/2100bytes.js b/test/message/2100bytes.js index 59fe3c152325ad..b05f5e9e1d7168 100644 --- a/test/message/2100bytes.js +++ b/test/message/2100bytes.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); diff --git a/test/message/error_exit.js b/test/message/error_exit.js index 51c25697494878..7805fd21935377 100644 --- a/test/message/error_exit.js +++ b/test/message/error_exit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/eval_messages.js b/test/message/eval_messages.js index 157cf881f60e6f..603acafe0936c4 100644 --- a/test/message/eval_messages.js +++ b/test/message/eval_messages.js @@ -1,3 +1,4 @@ +'use strict'; // USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); diff --git a/test/message/hello_world.js b/test/message/hello_world.js index 996e08d51a2e62..1e6b030393c6cf 100644 --- a/test/message/hello_world.js +++ b/test/message/hello_world.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/max_tick_depth.js b/test/message/max_tick_depth.js index 1e43cae1c1670d..cacd795810605a 100644 --- a/test/message/max_tick_depth.js +++ b/test/message/max_tick_depth.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); process.maxTickDepth = 10; diff --git a/test/message/nexttick_throw.js b/test/message/nexttick_throw.js index 21361edf333abb..3c0e2d8e379fd9 100644 --- a/test/message/nexttick_throw.js +++ b/test/message/nexttick_throw.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/stack_overflow.js b/test/message/stack_overflow.js index f822afd22c5757..7d1033c3ab2b1a 100644 --- a/test/message/stack_overflow.js +++ b/test/message/stack_overflow.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/stdin_messages.js b/test/message/stdin_messages.js index 8c4e47d00095e6..eefa9e756dc312 100644 --- a/test/message/stdin_messages.js +++ b/test/message/stdin_messages.js @@ -1,3 +1,4 @@ +'use strict'; // USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); diff --git a/test/message/throw_custom_error.js b/test/message/throw_custom_error.js index 34a007920dafea..270b37d14ddead 100644 --- a/test/message/throw_custom_error.js +++ b/test/message/throw_custom_error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/throw_custom_error.out b/test/message/throw_custom_error.out index f003972940053c..bfb928d48dd08e 100644 --- a/test/message/throw_custom_error.out +++ b/test/message/throw_custom_error.out @@ -1,5 +1,5 @@ before -*test*message*throw_custom_error.js:7 +*test*message*throw_custom_error.js:8 throw ({ name: 'MyCustomError', message: 'This is a custom message' }); ^ MyCustomError: This is a custom message diff --git a/test/message/throw_in_line_with_tabs.js b/test/message/throw_in_line_with_tabs.js index dc035c42cade3d..50c69ca681019d 100644 --- a/test/message/throw_in_line_with_tabs.js +++ b/test/message/throw_in_line_with_tabs.js @@ -1,9 +1,11 @@ +/* eslint-disable indent */ +'use strict'; var common = require('../common'); var assert = require('assert'); console.error('before'); -(function () { +(function() { // these lines should contain tab! throw ({ foo: 'bar' }); })(); diff --git a/test/message/throw_in_line_with_tabs.out b/test/message/throw_in_line_with_tabs.out index 11eadab34bead1..e83b05768433b8 100644 --- a/test/message/throw_in_line_with_tabs.out +++ b/test/message/throw_in_line_with_tabs.out @@ -1,5 +1,5 @@ before -*test*message*throw_in_line_with_tabs.js:8 +*test*message*throw_in_line_with_tabs.js:10 throw ({ foo: 'bar' }); ^ [object Object] diff --git a/test/message/throw_non_error.js b/test/message/throw_non_error.js index 817b557906a512..33e0a051d65a1d 100644 --- a/test/message/throw_non_error.js +++ b/test/message/throw_non_error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/throw_non_error.out b/test/message/throw_non_error.out index 4b39de5acfa7e5..c859d5f16a511e 100644 --- a/test/message/throw_non_error.out +++ b/test/message/throw_non_error.out @@ -1,5 +1,5 @@ before -*test*message*throw_non_error.js:7 +*test*message*throw_non_error.js:8 throw ({ foo: 'bar' }); ^ [object Object] diff --git a/test/message/throw_null.js b/test/message/throw_null.js index 27e86a8ff0e1e7..ab8fb565a61e54 100644 --- a/test/message/throw_null.js +++ b/test/message/throw_null.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/throw_null.out b/test/message/throw_null.out index be5cb3f7b8729a..eb3eeb1294e727 100644 --- a/test/message/throw_null.out +++ b/test/message/throw_null.out @@ -1,5 +1,5 @@ -*test*message*throw_null.js:4 +*test*message*throw_null.js:5 throw null; -^ +^ null diff --git a/test/message/throw_undefined.js b/test/message/throw_undefined.js index dcc54d74d2d3cc..f855cdd2f7dabd 100644 --- a/test/message/throw_undefined.js +++ b/test/message/throw_undefined.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/throw_undefined.out b/test/message/throw_undefined.out index 1aa6e15b37f4f5..27aedd9ee46f15 100644 --- a/test/message/throw_undefined.out +++ b/test/message/throw_undefined.out @@ -1,5 +1,5 @@ -*test*message*throw_undefined.js:4 +*test*message*throw_undefined.js:5 throw undefined; ^ undefined diff --git a/test/message/timeout_throw.js b/test/message/timeout_throw.js index 4ccf0bdd27dfce..aaf3fbc8d2f48f 100644 --- a/test/message/timeout_throw.js +++ b/test/message/timeout_throw.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/message/undefined_reference_in_new_context.js b/test/message/undefined_reference_in_new_context.js index 01d9698f22b257..7256c0d8e36088 100644 --- a/test/message/undefined_reference_in_new_context.js +++ b/test/message/undefined_reference_in_new_context.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/message/vm_display_runtime_error.js b/test/message/vm_display_runtime_error.js index 22c10d6022bd92..d01ab0b540b3cb 100644 --- a/test/message/vm_display_runtime_error.js +++ b/test/message/vm_display_runtime_error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/message/vm_display_syntax_error.js b/test/message/vm_display_syntax_error.js index b0172264e71ffc..179263478b84b8 100644 --- a/test/message/vm_display_syntax_error.js +++ b/test/message/vm_display_syntax_error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/message/vm_dont_display_runtime_error.js b/test/message/vm_dont_display_runtime_error.js index 7aa81844b8f4ed..6b4c824cbe5eff 100644 --- a/test/message/vm_dont_display_runtime_error.js +++ b/test/message/vm_dont_display_runtime_error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); @@ -5,17 +6,17 @@ var vm = require('vm'); console.error('beginning'); try { - vm.runInThisContext('throw new Error("boo!")', { - filename: 'test.vm', - displayErrors: false - }); + vm.runInThisContext('throw new Error("boo!")', { + filename: 'test.vm', + displayErrors: false + }); } catch (e) {} console.error('middle'); vm.runInThisContext('throw new Error("boo!")', { - filename: 'test.vm', - displayErrors: false + filename: 'test.vm', + displayErrors: false }); console.error('end'); diff --git a/test/message/vm_dont_display_syntax_error.js b/test/message/vm_dont_display_syntax_error.js index 724bea22148fdd..42b1ab14cba76f 100644 --- a/test/message/vm_dont_display_syntax_error.js +++ b/test/message/vm_dont_display_syntax_error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); @@ -5,17 +6,17 @@ var vm = require('vm'); console.error('beginning'); try { - vm.runInThisContext('var 5;', { - filename: 'test.vm', - displayErrors: false - }); + vm.runInThisContext('var 5;', { + filename: 'test.vm', + displayErrors: false + }); } catch (e) {} console.error('middle'); vm.runInThisContext('var 5;', { - filename: 'test.vm', - displayErrors: false + filename: 'test.vm', + displayErrors: false }); console.error('end'); diff --git a/test/parallel/test-arm-math-exp-regress-1376.js b/test/parallel/test-arm-math-exp-regress-1376.js index e81766a1d8a815..160b7b5dcce764 100644 --- a/test/parallel/test-arm-math-exp-regress-1376.js +++ b/test/parallel/test-arm-math-exp-regress-1376.js @@ -1,3 +1,4 @@ +'use strict'; // See https://github.com/nodejs/io.js/issues/1376 // and https://code.google.com/p/v8/issues/detail?id=4019 diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 1e2e8e6d557807..ce84eabc34e1d4 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var a = require('assert'); @@ -144,10 +145,14 @@ if (typeof Symbol === 'symbol') { } // primitive wrappers and object -assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), ['a']), a.AssertionError); -assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), {0: 'a'}), a.AssertionError); -assert.doesNotThrow(makeBlock(a.deepEqual, new Number(1), {}), a.AssertionError); -assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}), a.AssertionError); +assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), ['a']), + a.AssertionError); +assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), {0: 'a'}), + a.AssertionError); +assert.doesNotThrow(makeBlock(a.deepEqual, new Number(1), {}), + a.AssertionError); +assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}), + a.AssertionError); //deepStrictEqual assert.doesNotThrow(makeBlock(a.deepStrictEqual, new Date(2000, 3, 14), @@ -313,9 +318,9 @@ try { assert.equal(true, threw, 'a.doesNotThrow is not catching type matching errors'); -assert.throws(function() {assert.ifError(new Error('test error'))}); -assert.doesNotThrow(function() {assert.ifError(null)}); -assert.doesNotThrow(function() {assert.ifError()}); +assert.throws(function() {assert.ifError(new Error('test error'));}); +assert.doesNotThrow(function() {assert.ifError(null);}); +assert.doesNotThrow(function() {assert.ifError();}); // make sure that validating using constructor really works threw = false; @@ -373,7 +378,7 @@ function testAssertionMessage(actual, expected) { } catch (e) { assert.equal(e.toString(), ['AssertionError:', expected, '==', '\'\''].join(' ')); - assert.ok(e.generatedMessage, "Message not marked as generated"); + assert.ok(e.generatedMessage, 'Message not marked as generated'); } } @@ -393,7 +398,7 @@ testAssertionMessage([1, 2, 3], '[ 1, 2, 3 ]'); testAssertionMessage(/a/, '/a/'); testAssertionMessage(/abc/gim, '/abc/gim'); testAssertionMessage(function f() {}, '[Function: f]'); -testAssertionMessage(function () {}, '[Function]'); +testAssertionMessage(function() {}, '[Function]'); testAssertionMessage({}, '{}'); testAssertionMessage(circular, '{ y: 1, x: [Circular] }'); testAssertionMessage({a: undefined, b: null}, '{ a: undefined, b: null }'); @@ -402,7 +407,7 @@ testAssertionMessage({a: NaN, b: Infinity, c: -Infinity}, // #2893 try { - assert.throws(function () { + assert.throws(function() { assert.ifError(null); }); } catch (e) { @@ -415,14 +420,14 @@ assert.ok(threw); try { assert.equal(1, 2); } catch (e) { - assert.equal(e.toString().split('\n')[0], 'AssertionError: 1 == 2') + assert.equal(e.toString().split('\n')[0], 'AssertionError: 1 == 2'); assert.ok(e.generatedMessage, 'Message not marked as generated'); } try { assert.equal(1, 2, 'oh no'); } catch (e) { - assert.equal(e.toString().split('\n')[0], 'AssertionError: oh no') + assert.equal(e.toString().split('\n')[0], 'AssertionError: oh no'); assert.equal(e.generatedMessage, false, 'Message incorrectly marked as generated'); } diff --git a/test/parallel/test-bad-unicode.js b/test/parallel/test-bad-unicode.js index ba31ba3e234970..6dcabc8fd47b96 100644 --- a/test/parallel/test-bad-unicode.js +++ b/test/parallel/test-bad-unicode.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'), exception = null; diff --git a/test/parallel/test-beforeexit-event-exit.js b/test/parallel/test-beforeexit-event-exit.js index 8d0d43d45bb4d4..43d213a8f95055 100644 --- a/test/parallel/test-beforeexit-event-exit.js +++ b/test/parallel/test-beforeexit-event-exit.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); process.on('beforeExit', function() { diff --git a/test/parallel/test-beforeexit-event.js b/test/parallel/test-beforeexit-event.js index 8bfdbe108eccb1..f3bd127b408b08 100644 --- a/test/parallel/test-beforeexit-event.js +++ b/test/parallel/test-beforeexit-event.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var net = require('net'); var util = require('util'); @@ -19,7 +20,7 @@ function tryImmediate() { function tryTimer() { console.log('set a timeout'); - setTimeout(function () { + setTimeout(function() { console.log('timeout cb, do another once beforeExit'); revivals++; process.once('beforeExit', tryListen); diff --git a/test/parallel/test-buffer-ascii.js b/test/parallel/test-buffer-ascii.js index e7625f3a0c5458..efc3a72c662595 100644 --- a/test/parallel/test-buffer-ascii.js +++ b/test/parallel/test-buffer-ascii.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-buffer-concat.js b/test/parallel/test-buffer-concat.js index 54c4b13cb9dc90..b023dba4cdd3e3 100644 --- a/test/parallel/test-buffer-concat.js +++ b/test/parallel/test-buffer-concat.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -14,7 +15,7 @@ var flatLongLen = Buffer.concat(long, 40); assert(flatZero.length === 0); assert(flatOne.toString() === 'asdf'); assert(flatOne === one[0]); -assert(flatLong.toString() === (new Array(10+1).join('asdf'))); -assert(flatLongLen.toString() === (new Array(10+1).join('asdf'))); +assert(flatLong.toString() === (new Array(10 + 1).join('asdf'))); +assert(flatLongLen.toString() === (new Array(10 + 1).join('asdf'))); -console.log("ok"); +console.log('ok'); diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 32748dcaaab727..7ffbae525f8984 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-buffer-inspect.js b/test/parallel/test-buffer-inspect.js index f663d23edce8dc..707f778255ad51 100644 --- a/test/parallel/test-buffer-inspect.js +++ b/test/parallel/test-buffer-inspect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-buffer-iterator.js b/test/parallel/test-buffer-iterator.js index ab02934bf9e794..05371d6d793fed 100644 --- a/test/parallel/test-buffer-iterator.js +++ b/test/parallel/test-buffer-iterator.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-buffer-slice.js b/test/parallel/test-buffer-slice.js index 3d8f9c62d2ce36..53434eab8e3f8f 100644 --- a/test/parallel/test-buffer-slice.js +++ b/test/parallel/test-buffer-slice.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -7,5 +8,5 @@ var buff = new Buffer(Buffer.poolSize + 1); var slicedBuffer = buff.slice(); assert.equal(slicedBuffer.parent, buff, - "slicedBufffer should have its parent set to the original " + - " buffer"); + 'slicedBufffer should have its parent set to the original ' + + ' buffer'); diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js index abfbff4f80ac68..53411933a00f9d 100644 --- a/test/parallel/test-buffer.js +++ b/test/parallel/test-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -127,8 +128,8 @@ assert.strictEqual(Math.floor(c.length / 2), copied); for (var i = 0; i < Math.floor(c.length / 2); i++) { assert.strictEqual(b[b.length - Math.floor(c.length / 2) + i], c[i]); } -for (var i = Math.floor(c.length /2) + 1; i < c.length; i++) { - assert.strictEqual(c[c.length-1], c[i]); +for (var i = Math.floor(c.length / 2) + 1; i < c.length; i++) { + assert.strictEqual(c[c.length - 1], c[i]); } // try to copy 513 bytes, and check we don't overrun c @@ -843,7 +844,7 @@ Buffer(Buffer(0), 0, 0); // GH-5110 -(function () { +(function() { var buffer = new Buffer('test'), string = JSON.stringify(buffer); @@ -1068,7 +1069,7 @@ assert.equal(buf.readInt8(0), -1); // see https://github.com/joyent/node/issues/5881 SlowBuffer(0).slice(0, 1); // make sure a zero length slice doesn't set the .parent attribute - assert.equal(Buffer(5).slice(0,0).parent, undefined); + assert.equal(Buffer(5).slice(0, 0).parent, undefined); // and make sure a proper slice does have a parent assert.ok(typeof Buffer(5).slice(0, 5).parent === 'object'); })(); @@ -1087,7 +1088,7 @@ assert.throws(function() { (function() { var a = [0]; for (var i = 0; i < 7; ++i) a = a.concat(a); - a = a.map(function(_, i) { return i }); + a = a.map(function(_, i) { return i; }); var b = Buffer(a); var c = Buffer(b); assert.equal(b.length, a.length); @@ -1100,11 +1101,11 @@ assert.throws(function() { })(); -assert.throws(function () { +assert.throws(function() { new Buffer(smalloc.kMaxLength + 1); }, RangeError); -assert.throws(function () { +assert.throws(function() { new SlowBuffer(smalloc.kMaxLength + 1); }, RangeError); diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 2c74a470443b42..739c3256fb33ae 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-buffering.js b/test/parallel/test-child-process-buffering.js index 997e64248ababb..a37e1dbbbd7574 100644 --- a/test/parallel/test-child-process-buffering.js +++ b/test/parallel/test-child-process-buffering.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -23,7 +24,7 @@ function pwd(callback) { childExited = true; }); - child.on('close', function () { + child.on('close', function() { callback(output); pwd_called = true; childClosed = true; diff --git a/test/parallel/test-child-process-cwd.js b/test/parallel/test-child-process-cwd.js index 2ff459e9a33982..5d3f0d9496a313 100644 --- a/test/parallel/test-child-process-cwd.js +++ b/test/parallel/test-child-process-cwd.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; @@ -26,7 +27,7 @@ function testCwd(options, forCode, forData) { assert.strictEqual(forCode, code); }); - child.on('close', function () { + child.on('close', function() { forData && assert.strictEqual(forData, data.replace(/[\s\r\n]+$/, '')); returns--; }); diff --git a/test/parallel/test-child-process-default-options.js b/test/parallel/test-child-process-default-options.js index ee0cb59842b9be..93165ded6d165d 100644 --- a/test/parallel/test-child-process-default-options.js +++ b/test/parallel/test-child-process-default-options.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-detached.js b/test/parallel/test-child-process-detached.js index 1cc2a5022ed49a..25b811a8caa991 100644 --- a/test/parallel/test-child-process-detached.js +++ b/test/parallel/test-child-process-detached.js @@ -1,23 +1,25 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); var spawn = require('child_process').spawn; -var childPath = path.join(__dirname, '..', 'fixtures', 'parent-process-nonpersistent.js'); +var childPath = path.join(__dirname, '..', 'fixtures', + 'parent-process-nonpersistent.js'); var persistentPid = -1; var child = spawn(process.execPath, [ childPath ]); -child.stdout.on('data', function (data) { +child.stdout.on('data', function(data) { persistentPid = parseInt(data, 10); }); -process.on('exit', function () { +process.on('exit', function() { assert(persistentPid !== -1); - assert.throws(function () { + assert.throws(function() { process.kill(child.pid); }); - assert.doesNotThrow(function () { + assert.doesNotThrow(function() { process.kill(persistentPid); }); }); diff --git a/test/parallel/test-child-process-disconnect.js b/test/parallel/test-child-process-disconnect.js index 95b26a7c4ad125..fd5153f3965b21 100644 --- a/test/parallel/test-child-process-disconnect.js +++ b/test/parallel/test-child-process-disconnect.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var fork = require('child_process').fork; diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js index cf40dedd8a6eb1..17b05791315994 100644 --- a/test/parallel/test-child-process-double-pipe.js +++ b/test/parallel/test-child-process-double-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var is_windows = process.platform === 'win32'; var common = require('../common'); @@ -95,5 +96,5 @@ sed.stdout.on('data', function(data) { }); sed.stdout.on('end', function(code) { - assert.equal(result, 'hellO' + os.EOL + 'nOde' + os.EOL +'wOrld' + os.EOL); + assert.equal(result, 'hellO' + os.EOL + 'nOde' + os.EOL + 'wOrld' + os.EOL); }); diff --git a/test/parallel/test-child-process-env.js b/test/parallel/test-child-process-env.js index a6a164a66c4c72..6f2051f1282b84 100644 --- a/test/parallel/test-child-process-env.js +++ b/test/parallel/test-child-process-env.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-exec-buffer.js b/test/parallel/test-child-process-exec-buffer.js index b680e3b3c1ee5a..0ab05080a2cb87 100644 --- a/test/parallel/test-child-process-exec-buffer.js +++ b/test/parallel/test-child-process-exec-buffer.js @@ -1,3 +1,4 @@ +'use strict'; require('../common'); var assert = require('assert'); var exec = require('child_process').exec; @@ -8,7 +9,7 @@ var success_count = 0; var str = 'hello'; // default encoding -var child = exec("echo " + str, function(err, stdout, stderr) { +var child = exec('echo ' + str, function(err, stdout, stderr) { assert.ok('string', typeof(stdout), 'Expected stdout to be a string'); assert.ok('string', typeof(stderr), 'Expected stderr to be a string'); assert.equal(str + os.EOL, stdout); @@ -17,7 +18,7 @@ var child = exec("echo " + str, function(err, stdout, stderr) { }); // no encoding (Buffers expected) -var child = exec("echo " + str, { +var child = exec('echo ' + str, { encoding: null }, function(err, stdout, stderr) { assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer'); diff --git a/test/parallel/test-child-process-exec-cwd.js b/test/parallel/test-child-process-exec-cwd.js index c91a35de0b8c4b..9e7039990e9dfc 100644 --- a/test/parallel/test-child-process-exec-cwd.js +++ b/test/parallel/test-child-process-exec-cwd.js @@ -1,3 +1,4 @@ +'use strict'; require('../common'); var assert = require('assert'); var exec = require('child_process').exec; diff --git a/test/parallel/test-child-process-exec-env.js b/test/parallel/test-child-process-exec-env.js index 6c8410b9a61793..eb554b459cabd8 100644 --- a/test/parallel/test-child-process-exec-env.js +++ b/test/parallel/test-child-process-exec-env.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; diff --git a/test/parallel/test-child-process-exec-error.js b/test/parallel/test-child-process-exec-error.js index 7605af98549911..b141fc3f2c09cc 100644 --- a/test/parallel/test-child-process-exec-error.js +++ b/test/parallel/test-child-process-exec-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var child_process = require('child_process'); diff --git a/test/parallel/test-child-process-exit-code.js b/test/parallel/test-child-process-exit-code.js index 61f298633f8116..feb2fe217566be 100644 --- a/test/parallel/test-child-process-exit-code.js +++ b/test/parallel/test-child-process-exit-code.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-child-process-fork-and-spawn.js b/test/parallel/test-child-process-fork-and-spawn.js index 68e8af0fc3e19f..d5255bf83ca8e0 100644 --- a/test/parallel/test-child-process-fork-and-spawn.js +++ b/test/parallel/test-child-process-fork-and-spawn.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-child-process-fork-close.js b/test/parallel/test-child-process-fork-close.js index eddfec5d521436..12b64cc4ff82ac 100644 --- a/test/parallel/test-child-process-fork-close.js +++ b/test/parallel/test-child-process-fork-close.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'), common = require('../common'), fork = require('child_process').fork, diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index bd21f3f748155b..8858966fde4975 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -1,3 +1,4 @@ +'use strict'; /* * The purpose of this test is to make sure that when forking a process, * sending a fd representing a UDP socket to the child and sending messages @@ -30,7 +31,7 @@ if (process.argv[2] === 'child') { if (msg === 'server') { server = clusterServer; - server.on('message', function () { + server.on('message', function() { process.send('gotMessage'); }); @@ -50,14 +51,14 @@ if (process.argv[2] === 'child') { var childGotMessage = false; var parentGotMessage = false; - server.on('message', function (msg, rinfo) { + server.on('message', function(msg, rinfo) { parentGotMessage = true; }); - server.on('listening', function () { + server.on('listening', function() { child.send('server', server); - child.once('message', function (msg) { + child.once('message', function(msg) { if (msg === 'gotMessage') { childGotMessage = true; } @@ -66,8 +67,8 @@ if (process.argv[2] === 'child') { sendMessages(); }); - var sendMessages = function () { - var timer = setInterval(function () { + var sendMessages = function() { + var timer = setInterval(function() { client.send(msg, 0, msg.length, common.PORT, '127.0.0.1', function(err) { if (err) throw err; } @@ -85,7 +86,7 @@ if (process.argv[2] === 'child') { }, 1); }; - var shutdown = function () { + var shutdown = function() { child.send('stop'); server.close(); @@ -94,7 +95,7 @@ if (process.argv[2] === 'child') { server.bind(common.PORT, '127.0.0.1'); - process.once('exit', function () { + process.once('exit', function() { assert(parentGotMessage); assert(childGotMessage); }); diff --git a/test/parallel/test-child-process-fork-exec-argv.js b/test/parallel/test-child-process-fork-exec-argv.js index 34292c551112c1..94703a736a110e 100644 --- a/test/parallel/test-child-process-fork-exec-argv.js +++ b/test/parallel/test-child-process-fork-exec-argv.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var child_process = require('child_process'); var spawn = child_process.spawn; @@ -16,11 +17,11 @@ if (process.argv[2] === 'fork') { var child = spawn(process.execPath, execArgv.concat(args)); var out = ''; - child.stdout.on('data', function (chunk) { + child.stdout.on('data', function(chunk) { out += chunk; }); - child.on('exit', function () { + child.on('exit', function() { assert.deepEqual(JSON.parse(out), execArgv); }); } diff --git a/test/parallel/test-child-process-fork-exec-path.js b/test/parallel/test-child-process-fork-exec-path.js index 72bb69316814de..cffb5ca05a6a78 100644 --- a/test/parallel/test-child-process-fork-exec-path.js +++ b/test/parallel/test-child-process-fork-exec-path.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var cp = require('child_process'); var fs = require('fs'); diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index a16fb85041b95f..09ec8e24b9b46c 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var fork = require('child_process').fork; diff --git a/test/parallel/test-child-process-fork-net2.js b/test/parallel/test-child-process-fork-net2.js index 150e9cfc4544e9..95ec26a88d0de2 100644 --- a/test/parallel/test-child-process-fork-net2.js +++ b/test/parallel/test-child-process-fork-net2.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var fork = require('child_process').fork; diff --git a/test/parallel/test-child-process-fork-ref.js b/test/parallel/test-child-process-fork-ref.js index aa38ad7a21c5ad..b4066641bae970 100644 --- a/test/parallel/test-child-process-fork-ref.js +++ b/test/parallel/test-child-process-fork-ref.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fork = require('child_process').fork; @@ -10,7 +11,7 @@ if (process.argv[2] === 'child') { process.send('2'); }, 200); - process.on('disconnect', function () { + process.on('disconnect', function() { process.stdout.write('3'); }); @@ -19,17 +20,17 @@ if (process.argv[2] === 'child') { var ipc = [], stdout = ''; - child.on('message', function (msg) { + child.on('message', function(msg) { ipc.push(msg); if (msg === '2') child.disconnect(); }); - child.stdout.on('data', function (chunk) { + child.stdout.on('data', function(chunk) { stdout += chunk; }); - child.once('exit', function () { + child.once('exit', function() { assert.deepEqual(ipc, ['1', '2']); assert.equal(stdout, '3'); }); diff --git a/test/parallel/test-child-process-fork-ref2.js b/test/parallel/test-child-process-fork-ref2.js index 3ccdfc18871055..8bc7e4c35541b2 100644 --- a/test/parallel/test-child-process-fork-ref2.js +++ b/test/parallel/test-child-process-fork-ref2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fork = require('child_process').fork; @@ -8,17 +9,17 @@ if (process.argv[2] === 'child') { setTimeout(function() { console.log('child -> will this keep it alive?'); - process.on('message', function () { }); + process.on('message', function() { }); }, 400); } else { var child = fork(__filename, ['child']); - child.on('disconnect', function () { + child.on('disconnect', function() { console.log('parent -> disconnect'); }); - child.once('exit', function () { + child.once('exit', function() { console.log('parent -> exit'); }); } diff --git a/test/parallel/test-child-process-fork.js b/test/parallel/test-child-process-fork.js index 2ec9f402dd5d39..c35510e60c76f4 100644 --- a/test/parallel/test-child-process-fork.js +++ b/test/parallel/test-child-process-fork.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var fork = require('child_process').fork; diff --git a/test/parallel/test-child-process-fork3.js b/test/parallel/test-child-process-fork3.js index 8527257bc53684..fe0e68b6a6436e 100644 --- a/test/parallel/test-child-process-fork3.js +++ b/test/parallel/test-child-process-fork3.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var child_process = require('child_process'); diff --git a/test/parallel/test-child-process-internal.js b/test/parallel/test-child-process-internal.js index a1bb52f4b71185..c39dc93293aa8b 100644 --- a/test/parallel/test-child-process-internal.js +++ b/test/parallel/test-child-process-internal.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-ipc.js b/test/parallel/test-child-process-ipc.js index 712b1ee0a5e54c..7d0447569ffe73 100644 --- a/test/parallel/test-child-process-ipc.js +++ b/test/parallel/test-child-process-ipc.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-kill.js b/test/parallel/test-child-process-kill.js index 7e46aada8bbfad..948348add4abb0 100644 --- a/test/parallel/test-child-process-kill.js +++ b/test/parallel/test-child-process-kill.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-recv-handle.js b/test/parallel/test-child-process-recv-handle.js index 7f2f04f831dbf1..b992445f186383 100644 --- a/test/parallel/test-child-process-recv-handle.js +++ b/test/parallel/test-child-process-recv-handle.js @@ -1,3 +1,4 @@ +'use strict'; // Test that a Linux specific quirk in the handle passing protocol is handled // correctly. See https://github.com/joyent/node/issues/5330 for details. diff --git a/test/parallel/test-child-process-send-utf8.js b/test/parallel/test-child-process-send-utf8.js index 825913dc2ae4c4..7ba76e9bd1ddc8 100644 --- a/test/parallel/test-child-process-send-utf8.js +++ b/test/parallel/test-child-process-send-utf8.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fork = require('child_process').fork; diff --git a/test/parallel/test-child-process-set-blocking.js b/test/parallel/test-child-process-set-blocking.js index af831b720b2eb0..3f09388265b89a 100644 --- a/test/parallel/test-child-process-set-blocking.js +++ b/test/parallel/test-child-process-set-blocking.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var ch = require('child_process'); diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js index e1e03d0973011e..3714d3758d0f22 100644 --- a/test/parallel/test-child-process-silent.js +++ b/test/parallel/test-child-process-silent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var childProcess = require('child_process'); diff --git a/test/parallel/test-child-process-spawn-error.js b/test/parallel/test-child-process-spawn-error.js index fe279dc6e586af..1398dac165319c 100644 --- a/test/parallel/test-child-process-spawn-error.js +++ b/test/parallel/test-child-process-spawn-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var fs = require('fs'); var spawn = require('child_process').spawn; @@ -10,7 +11,7 @@ var spawnargs = ['bar']; assert.equal(common.fileExists(enoentPath), false); var enoentChild = spawn(enoentPath, spawnargs); -enoentChild.on('error', function (err) { +enoentChild.on('error', function(err) { assert.equal(err.code, 'ENOENT'); assert.equal(err.errno, 'ENOENT'); assert.equal(err.syscall, 'spawn ' + enoentPath); diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js index b95b208eb0c87e..35c190353bd1b8 100644 --- a/test/parallel/test-child-process-spawn-typeerror.js +++ b/test/parallel/test-child-process-spawn-typeerror.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var child_process = require('child_process'); var spawn = child_process.spawn; diff --git a/test/parallel/test-child-process-spawnsync-env.js b/test/parallel/test-child-process-spawnsync-env.js index 0ebc66a7459cfe..bc7c5aa3dd6c14 100644 --- a/test/parallel/test-child-process-spawnsync-env.js +++ b/test/parallel/test-child-process-spawnsync-env.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cp = require('child_process'); diff --git a/test/parallel/test-child-process-spawnsync-input.js b/test/parallel/test-child-process-spawnsync-input.js index e85e9da1fbade9..4118b74dc35f6c 100644 --- a/test/parallel/test-child-process-spawnsync-input.js +++ b/test/parallel/test-child-process-spawnsync-input.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var os = require('os'); diff --git a/test/parallel/test-child-process-spawnsync-timeout.js b/test/parallel/test-child-process-spawnsync-timeout.js index f5b5987e4d1eaf..34c69a1fc597d2 100644 --- a/test/parallel/test-child-process-spawnsync-timeout.js +++ b/test/parallel/test-child-process-spawnsync-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -15,7 +16,8 @@ switch (process.argv[2]) { break; default: var start = Date.now(); - var ret = spawnSync(process.execPath, [__filename, 'child'], {timeout: TIMER}); + var ret = spawnSync(process.execPath, [__filename, 'child'], + {timeout: TIMER}); assert.strictEqual(ret.error.errno, 'ETIMEDOUT'); console.log(ret); var end = Date.now() - start; diff --git a/test/parallel/test-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index 67b07ed481889c..b6f4d31b5c158c 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -20,7 +21,8 @@ var ret = spawnSync('sleep', ['1']); var stop = process.hrtime(start); assert.strictEqual(ret.status, 0, 'exit status should be zero'); console.log('sleep exited', stop); -assert.strictEqual(stop[0], 1, 'sleep should not take longer or less than 1 second'); +assert.strictEqual(stop[0], 1, + 'sleep should not take longer or less than 1 second'); // Error test when command does not exist var ret_err = spawnSync('command_does_not_exist', ['bar']).error; diff --git a/test/parallel/test-child-process-stdin-ipc.js b/test/parallel/test-child-process-stdin-ipc.js index 2758087deac814..d2347849dd5b9b 100644 --- a/test/parallel/test-child-process-stdin-ipc.js +++ b/test/parallel/test-child-process-stdin-ipc.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-child-process-stdin.js b/test/parallel/test-child-process-stdin.js index f2a5e1836a6e1d..ba3ef0e0c1c689 100644 --- a/test/parallel/test-child-process-stdin.js +++ b/test/parallel/test-child-process-stdin.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -48,7 +49,7 @@ cat.on('exit', function(status) { exitStatus = status; }); -cat.on('close', function () { +cat.on('close', function() { closed = true; if (is_windows) { assert.equal('hello world\r\n', response); diff --git a/test/parallel/test-child-process-stdio-big-write-end.js b/test/parallel/test-child-process-stdio-big-write-end.js index 631cecc33d74b1..5ae85acc54d9dd 100644 --- a/test/parallel/test-child-process-stdio-big-write-end.js +++ b/test/parallel/test-child-process-stdio-big-write-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var BUFSIZE = 1024; diff --git a/test/parallel/test-child-process-stdio-inherit.js b/test/parallel/test-child-process-stdio-inherit.js index 15a504099263c8..8cf08a7bd5fa71 100644 --- a/test/parallel/test-child-process-stdio-inherit.js +++ b/test/parallel/test-child-process-stdio-inherit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-child-process-stdio.js b/test/parallel/test-child-process-stdio.js index 7292007f1a207e..1ff6e4d914f7ec 100644 --- a/test/parallel/test-child-process-stdio.js +++ b/test/parallel/test-child-process-stdio.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-child-process-stdout-flush-exit.js b/test/parallel/test-child-process-stdout-flush-exit.js index eba8927204f71c..0d4e3538ceb3f0 100644 --- a/test/parallel/test-child-process-stdout-flush-exit.js +++ b/test/parallel/test-child-process-stdout-flush-exit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -21,14 +22,14 @@ if (process.argv[2] === 'child') { var gotBye = false; child.stderr.setEncoding('utf8'); - child.stderr.on('data', function (data) { + child.stderr.on('data', function(data) { console.log('parent stderr: ' + data); assert.ok(false); }); // check if we receive both 'hello' at start and 'goodbye' at end child.stdout.setEncoding('utf8'); - child.stdout.on('data', function (data) { + child.stdout.on('data', function(data) { if (data.slice(0, 6) == 'hello\n') { gotHello = true; } else if (data.slice(data.length - 8) == 'goodbye\n') { @@ -38,7 +39,7 @@ if (process.argv[2] === 'child') { } }); - child.on('close', function (data) { + child.on('close', function(data) { assert(gotHello); assert(gotBye); }); diff --git a/test/parallel/test-child-process-stdout-flush.js b/test/parallel/test-child-process-stdout-flush.js index 58d6a8f46a4b9d..8300f4bbc7cbf3 100644 --- a/test/parallel/test-child-process-stdout-flush.js +++ b/test/parallel/test-child-process-stdout-flush.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js index fd9cd410d5ea93..10a77c4a67b8a4 100644 --- a/test/parallel/test-cli-eval.js +++ b/test/parallel/test-cli-eval.js @@ -1,3 +1,4 @@ +'use strict'; if (module.parent) { // signal we've been loaded as a module console.log('Loaded as a module, exiting with status code 42.'); diff --git a/test/parallel/test-cluster-basic.js b/test/parallel/test-cluster-basic.js index 75ed9d3a155349..60bd27b24eee89 100644 --- a/test/parallel/test-cluster-basic.js +++ b/test/parallel/test-cluster-basic.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index 3a75250c53f811..b51367aa4229a3 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js index db1ea8874f4d17..ec6faa83c1151b 100644 --- a/test/parallel/test-cluster-bind-twice.js +++ b/test/parallel/test-cluster-bind-twice.js @@ -1,3 +1,4 @@ +'use strict'; // This test starts two clustered HTTP servers on the same port. It expects the // first cluster to succeed and the second cluster to fail with EADDRINUSE. // diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index dada58017f5130..bccc39637bb79a 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -1,3 +1,4 @@ +'use strict'; var NUM_WORKERS = 4; var PACKETS_PER_WORKER = 10; @@ -8,7 +9,7 @@ var dgram = require('dgram'); if (process.platform === 'win32') { - console.warn("dgram clustering is currently not supported on windows."); + console.warn('dgram clustering is currently not supported on windows.'); process.exit(0); } diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 68de38e7c33c61..db4f986f2db64f 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -1,3 +1,4 @@ +'use strict'; var NUM_WORKERS = 4; var PACKETS_PER_WORKER = 10; @@ -8,7 +9,7 @@ var dgram = require('dgram'); if (process.platform === 'win32') { - console.warn("dgram clustering is currently not supported on windows."); + console.warn('dgram clustering is currently not supported on windows.'); process.exit(0); } @@ -61,5 +62,6 @@ function worker() { for (var i = 0; i < PACKETS_PER_WORKER; i++) socket.send(buf, 0, buf.length, common.PORT, '127.0.0.1'); - console.log('worker %d sent %d packets', cluster.worker.id, PACKETS_PER_WORKER); + console.log('worker %d sent %d packets', cluster.worker.id, + PACKETS_PER_WORKER); } diff --git a/test/parallel/test-cluster-disconnect-before-exit.js b/test/parallel/test-cluster-disconnect-before-exit.js index d249296bab740a..8f63bcd1134310 100644 --- a/test/parallel/test-cluster-disconnect-before-exit.js +++ b/test/parallel/test-cluster-disconnect-before-exit.js @@ -1,3 +1,4 @@ +'use strict'; var cluster = require('cluster'); if (cluster.isMaster) { diff --git a/test/parallel/test-cluster-disconnect-idle-worker.js b/test/parallel/test-cluster-disconnect-idle-worker.js index 28cdd2de4eaf50..e18c05004467b7 100644 --- a/test/parallel/test-cluster-disconnect-idle-worker.js +++ b/test/parallel/test-cluster-disconnect-idle-worker.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-disconnect-unshared-tcp.js b/test/parallel/test-cluster-disconnect-unshared-tcp.js index 6fccc58c095930..a927b5da9fe1b4 100644 --- a/test/parallel/test-cluster-disconnect-unshared-tcp.js +++ b/test/parallel/test-cluster-disconnect-unshared-tcp.js @@ -1,3 +1,4 @@ +'use strict'; process.env.NODE_CLUSTER_SCHED_POLICY = 'none'; var cluster = require('cluster'); @@ -16,7 +17,7 @@ if (cluster.isMaster) { } } else { if (process.env.BOUND === 'y') { - var source = net.createServer() + var source = net.createServer(); source.listen(0); } diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index a40c386918b156..f90152cf68f1a7 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -1,3 +1,4 @@ +'use strict'; if (process.platform === 'win32') { console.log('skipping test on windows, where clustered dgram is ENOTSUP'); process.exit(0); diff --git a/test/parallel/test-cluster-disconnect-with-no-workers.js b/test/parallel/test-cluster-disconnect-with-no-workers.js index e07f5af99ddf9f..1c99461bfa4fc5 100644 --- a/test/parallel/test-cluster-disconnect-with-no-workers.js +++ b/test/parallel/test-cluster-disconnect-with-no-workers.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js index c557256dcb3bfe..0f19d534aafd89 100644 --- a/test/parallel/test-cluster-disconnect.js +++ b/test/parallel/test-cluster-disconnect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index 1be28a38559b0b..ad4de97e389ec5 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -1,5 +1,7 @@ -// test that errors propagated from cluster children are properly received in their master -// creates an EADDRINUSE condition by also forking a child process to listen on a socket +'use strict'; +// test that errors propagated from cluster children are properly +// received in their master creates an EADDRINUSE condition by also +// forking a child process to listen on a socket var common = require('../common'); var assert = require('assert'); @@ -27,7 +29,8 @@ if (cluster.isMaster) { assert.equal(gotError, 1); }); } else { - var cp = fork(common.fixturesDir + '/listen-on-socket-and-exit.js', { stdio: 'inherit' }); + var cp = fork(common.fixturesDir + '/listen-on-socket-and-exit.js', + { stdio: 'inherit' }); // message from the child indicates it's ready and listening cp.on('message', function() { diff --git a/test/parallel/test-cluster-eaddrinuse.js b/test/parallel/test-cluster-eaddrinuse.js index c43259c5631bcf..509dbb664e1d5d 100644 --- a/test/parallel/test-cluster-eaddrinuse.js +++ b/test/parallel/test-cluster-eaddrinuse.js @@ -1,3 +1,4 @@ +'use strict'; // Check that having a worker bind to a port that's already taken doesn't // leave the master process in a confused state. Releasing the port and // trying again should Just Work[TM]. diff --git a/test/parallel/test-cluster-fork-env.js b/test/parallel/test-cluster-fork-env.js index ddcf7d236c9482..7749e42f608c60 100644 --- a/test/parallel/test-cluster-fork-env.js +++ b/test/parallel/test-cluster-fork-env.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js index b9706699615ac1..42ed3bee1eed3c 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -1,3 +1,4 @@ +'use strict'; // It is not possible to send pipe handles over the IPC pipe on Windows. if (process.platform === 'win32') { process.exit(0); diff --git a/test/parallel/test-cluster-master-error.js b/test/parallel/test-cluster-master-error.js index e0e92e7cf9e2a4..e729963d7df6a9 100644 --- a/test/parallel/test-cluster-master-error.js +++ b/test/parallel/test-cluster-master-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-master-kill.js b/test/parallel/test-cluster-master-kill.js index a5c22855607104..89694ffd115bb4 100644 --- a/test/parallel/test-cluster-master-kill.js +++ b/test/parallel/test-cluster-master-kill.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js index 29c9e31159e62a..a72d1f079efaaa 100644 --- a/test/parallel/test-cluster-message.js +++ b/test/parallel/test-cluster-message.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-net-listen.js b/test/parallel/test-cluster-net-listen.js index 1d8e08c877481e..741cacc75897e3 100644 --- a/test/parallel/test-cluster-net-listen.js +++ b/test/parallel/test-cluster-net-listen.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-net-send.js b/test/parallel/test-cluster-net-send.js index 17d77171c50534..6190fb517e4d1a 100644 --- a/test/parallel/test-cluster-net-send.js +++ b/test/parallel/test-cluster-net-send.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fork = require('child_process').fork; diff --git a/test/parallel/test-cluster-rr-domain-listen.js b/test/parallel/test-cluster-rr-domain-listen.js index fc26c93685a045..1328483abb72df 100644 --- a/test/parallel/test-cluster-rr-domain-listen.js +++ b/test/parallel/test-cluster-rr-domain-listen.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var cluster = require('cluster'); var domain = require('domain'); @@ -7,7 +8,7 @@ var domain = require('domain'); if (cluster.isWorker) { var d = domain.create(); - d.run(function () { }); + d.run(function() { }); var http = require('http'); http.Server(function() { }).listen(common.PORT, '127.0.0.1'); diff --git a/test/parallel/test-cluster-send-deadlock.js b/test/parallel/test-cluster-send-deadlock.js index 7fd465db5feb13..90b8c91695359b 100644 --- a/test/parallel/test-cluster-send-deadlock.js +++ b/test/parallel/test-cluster-send-deadlock.js @@ -1,3 +1,4 @@ +'use strict'; // Testing mutual send of handles: from master to worker, and from worker to // master. diff --git a/test/parallel/test-cluster-send-handle-twice.js b/test/parallel/test-cluster-send-handle-twice.js index 2d2c2cc588eaf8..f1552d79265a0c 100644 --- a/test/parallel/test-cluster-send-handle-twice.js +++ b/test/parallel/test-cluster-send-handle-twice.js @@ -1,3 +1,4 @@ +'use strict'; // Testing to send an handle twice to the parent process. var common = require('../common'); diff --git a/test/parallel/test-cluster-setup-master-argv.js b/test/parallel/test-cluster-setup-master-argv.js index a8274be2e924cb..b406c76cbbfe0b 100644 --- a/test/parallel/test-cluster-setup-master-argv.js +++ b/test/parallel/test-cluster-setup-master-argv.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-setup-master-cumulative.js b/test/parallel/test-cluster-setup-master-cumulative.js index cf2d8e90daac36..0376546d286b51 100644 --- a/test/parallel/test-cluster-setup-master-cumulative.js +++ b/test/parallel/test-cluster-setup-master-cumulative.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-setup-master-emit.js b/test/parallel/test-cluster-setup-master-emit.js index bef10d8cb81ba3..8b463ec97bff45 100644 --- a/test/parallel/test-cluster-setup-master-emit.js +++ b/test/parallel/test-cluster-setup-master-emit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-setup-master-multiple.js b/test/parallel/test-cluster-setup-master-multiple.js index da0c03c7320bc9..8ee6d091cd524a 100644 --- a/test/parallel/test-cluster-setup-master-multiple.js +++ b/test/parallel/test-cluster-setup-master-multiple.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-setup-master.js b/test/parallel/test-cluster-setup-master.js index 7cf9631146682b..c32b3ea6d3b18b 100644 --- a/test/parallel/test-cluster-setup-master.js +++ b/test/parallel/test-cluster-setup-master.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-shared-handle-bind-error.js b/test/parallel/test-cluster-shared-handle-bind-error.js index f327de994a1fc6..a93b07ba30e27b 100644 --- a/test/parallel/test-cluster-shared-handle-bind-error.js +++ b/test/parallel/test-cluster-shared-handle-bind-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 3bbe9fbf2f9cda..4fc4b078ad6409 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-uncaught-exception.js b/test/parallel/test-cluster-uncaught-exception.js index 9f98d626c8634e..ec42773ef55856 100644 --- a/test/parallel/test-cluster-uncaught-exception.js +++ b/test/parallel/test-cluster-uncaught-exception.js @@ -1,3 +1,4 @@ +'use strict'; // Installing a custom uncaughtException handler should override the default // one that the cluster module installs. // https://github.com/joyent/node/issues/2556 diff --git a/test/parallel/test-cluster-worker-constructor.js b/test/parallel/test-cluster-worker-constructor.js index 331ab777481e59..e29dc01561903d 100644 --- a/test/parallel/test-cluster-worker-constructor.js +++ b/test/parallel/test-cluster-worker-constructor.js @@ -1,3 +1,4 @@ +'use strict'; // test-cluster-worker-constructor.js // validates correct behavior of the cluster.Worker constructor diff --git a/test/parallel/test-cluster-worker-death.js b/test/parallel/test-cluster-worker-death.js index d19704c58b3868..88a0f887cc2cab 100644 --- a/test/parallel/test-cluster-worker-death.js +++ b/test/parallel/test-cluster-worker-death.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-worker-destroy.js b/test/parallel/test-cluster-worker-destroy.js index 55ae0fc8c0c172..8e5ca63e13c6be 100644 --- a/test/parallel/test-cluster-worker-destroy.js +++ b/test/parallel/test-cluster-worker-destroy.js @@ -1,3 +1,4 @@ +'use strict'; /* * The goal of this test is to cover the Workers' implementation of * Worker.prototype.destroy. Worker.prototype.destroy is called within diff --git a/test/parallel/test-cluster-worker-disconnect.js b/test/parallel/test-cluster-worker-disconnect.js index e7a0960cb1026f..7f4038149cd7d1 100644 --- a/test/parallel/test-cluster-worker-disconnect.js +++ b/test/parallel/test-cluster-worker-disconnect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); @@ -81,7 +82,8 @@ if (cluster.isWorker) { // events assert.ok(w.emitDisconnect, 'Disconnect event did not emit'); - assert.ok(w.emitDisconnectInsideWorker, 'Disconnect event did not emit inside worker'); + assert.ok(w.emitDisconnectInsideWorker, + 'Disconnect event did not emit inside worker'); assert.ok(c.emitDisconnect, 'Disconnect event did not emit'); assert.ok(w.emitExit, 'Exit event did not emit'); assert.ok(c.emitExit, 'Exit event did not emit'); diff --git a/test/parallel/test-cluster-worker-events.js b/test/parallel/test-cluster-worker-events.js index fb3b8797e0deac..eb986556b69183 100644 --- a/test/parallel/test-cluster-worker-events.js +++ b/test/parallel/test-cluster-worker-events.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js index 1342a70d6f0c35..982b099cd1cfe1 100644 --- a/test/parallel/test-cluster-worker-exit.js +++ b/test/parallel/test-cluster-worker-exit.js @@ -1,3 +1,4 @@ +'use strict'; // test-cluster-worker-exit.js // verifies that, when a child process exits (by calling `process.exit(code)`) // - the parent receives the proper events in the proper order, no duplicates @@ -100,31 +101,31 @@ if (cluster.isWorker) { // some helper functions ... - function checkResults(expected_results, results) { - for (var k in expected_results) { - var actual = results[k], - expected = expected_results[k]; +function checkResults(expected_results, results) { + for (var k in expected_results) { + var actual = results[k], + expected = expected_results[k]; - if (typeof expected === 'function') { - expected(r[k]); + if (typeof expected === 'function') { + expected(r[k]); + } else { + var msg = (expected[1] || '') + + (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); + + if (expected && expected.length) { + assert.equal(actual, expected[0], msg); } else { - var msg = (expected[1] || '') + - (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); - - if (expected && expected.length) { - assert.equal(actual, expected[0], msg); - } else { - assert.equal(actual, expected, msg); - } + assert.equal(actual, expected, msg); } } } +} - function alive(pid) { - try { - process.kill(pid, 'SIGCONT'); - return true; - } catch (e) { - return false; - } +function alive(pid) { + try { + process.kill(pid, 'SIGCONT'); + return true; + } catch (e) { + return false; } +} diff --git a/test/parallel/test-cluster-worker-forced-exit.js b/test/parallel/test-cluster-worker-forced-exit.js index 144eb0dd3a3be8..54d2ce8a478303 100644 --- a/test/parallel/test-cluster-worker-forced-exit.js +++ b/test/parallel/test-cluster-worker-forced-exit.js @@ -1,5 +1,6 @@ +'use strict'; var assert = require('assert'); -var cluster = require('cluster') +var cluster = require('cluster'); var net = require('net'); var SENTINEL = 42; diff --git a/test/parallel/test-cluster-worker-init.js b/test/parallel/test-cluster-worker-init.js index 87e0ce040af98f..38886af5279a6d 100644 --- a/test/parallel/test-cluster-worker-init.js +++ b/test/parallel/test-cluster-worker-init.js @@ -1,3 +1,4 @@ +'use strict'; // test-cluster-worker-init.js // verifies that, when a child process is forked, the cluster.worker // object can receive messages as expected diff --git a/test/parallel/test-cluster-worker-isconnected.js b/test/parallel/test-cluster-worker-isconnected.js index ed839d49630491..4477278e31330a 100644 --- a/test/parallel/test-cluster-worker-isconnected.js +++ b/test/parallel/test-cluster-worker-isconnected.js @@ -1,3 +1,4 @@ +'use strict'; var cluster = require('cluster'); var assert = require('assert'); var util = require('util'); @@ -6,32 +7,32 @@ if (cluster.isMaster) { var worker = cluster.fork(); assert.ok(worker.isConnected(), - "isConnected() should return true as soon as the worker has " + - "been created."); + 'isConnected() should return true as soon as the worker has ' + + 'been created.'); worker.on('disconnect', function() { assert.ok(!worker.isConnected(), - "After a disconnect event has been emitted, " + - "isConncted should return false"); + 'After a disconnect event has been emitted, ' + + 'isConncted should return false'); }); worker.on('message', function(msg) { if (msg === 'readyToDisconnect') { worker.disconnect(); } - }) + }); } else { assert.ok(cluster.worker.isConnected(), - "isConnected() should return true from within a worker at all " + - "times."); + 'isConnected() should return true from within a worker at all ' + + 'times.'); cluster.worker.process.on('disconnect', function() { assert.ok(!cluster.worker.isConnected(), - "isConnected() should return false from within a worker " + - "after its underlying process has been disconnected from " + - "the master"); - }) + 'isConnected() should return false from within a worker ' + + 'after its underlying process has been disconnected from ' + + 'the master'); + }); process.send('readyToDisconnect'); } diff --git a/test/parallel/test-cluster-worker-isdead.js b/test/parallel/test-cluster-worker-isdead.js index 11766c597f8297..045a620a9efab7 100644 --- a/test/parallel/test-cluster-worker-isdead.js +++ b/test/parallel/test-cluster-worker-isdead.js @@ -1,3 +1,4 @@ +'use strict'; var cluster = require('cluster'); var assert = require('assert'); var net = require('net'); @@ -5,23 +6,23 @@ var net = require('net'); if (cluster.isMaster) { var worker = cluster.fork(); assert.ok(!worker.isDead(), - "isDead() should return false right after the worker has been " + - "created."); + 'isDead() should return false right after the worker has been ' + + 'created.'); worker.on('exit', function() { - assert.ok(!worker.isConnected(), - "After an event has been emitted, " + - "isDead should return true"); - }) + assert.ok(!worker.isConnected(), + 'After an event has been emitted, ' + + 'isDead should return true'); + }); worker.on('message', function(msg) { - if (msg === 'readyToDie') { - worker.kill(); - } + if (msg === 'readyToDie') { + worker.kill(); + } }); } else if (cluster.isWorker) { assert.ok(!cluster.worker.isDead(), - "isDead() should return false when called from within a worker"); + 'isDead() should return false when called from within a worker'); process.send('readyToDie'); } diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index 01da15fdca6a18..c73cf2dbd5216e 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -1,3 +1,4 @@ +'use strict'; // test-cluster-worker-kill.js // verifies that, when a child process is killed (we use SIGKILL) // - the parent receives the proper events in the proper order, no duplicates @@ -23,14 +24,16 @@ if (cluster.isWorker) { cluster_emitDisconnect: [1, "the cluster did not emit 'disconnect'"], cluster_emitExit: [1, "the cluster did not emit 'exit'"], cluster_exitCode: [null, 'the cluster exited w/ incorrect exitCode'], - cluster_signalCode: [KILL_SIGNAL, 'the cluster exited w/ incorrect signalCode'], + cluster_signalCode: [KILL_SIGNAL, + 'the cluster exited w/ incorrect signalCode'], worker_emitDisconnect: [1, "the worker did not emit 'disconnect'"], worker_emitExit: [1, "the worker did not emit 'exit'"], worker_state: ['disconnected', 'the worker state is incorrect'], worker_suicideMode: [false, 'the worker.suicide flag is incorrect'], worker_died: [true, 'the worker is still running'], worker_exitCode: [null, 'the worker exited w/ incorrect exitCode'], - worker_signalCode: [KILL_SIGNAL, 'the worker exited w/ incorrect signalCode'] + worker_signalCode: [KILL_SIGNAL, + 'the worker exited w/ incorrect signalCode'] }, results = { cluster_emitDisconnect: 0, @@ -98,30 +101,30 @@ if (cluster.isWorker) { // some helper functions ... - function checkResults(expected_results, results) { - for (var k in expected_results) { - var actual = results[k], - expected = expected_results[k]; - - if (typeof expected === 'function') { - expected(r[k]); +function checkResults(expected_results, results) { + for (var k in expected_results) { + var actual = results[k], + expected = expected_results[k]; + + if (typeof expected === 'function') { + expected(r[k]); + } else { + var msg = (expected[1] || '') + + (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); + if (expected && expected.length) { + assert.equal(actual, expected[0], msg); } else { - var msg = (expected[1] || '') + - (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); - if (expected && expected.length) { - assert.equal(actual, expected[0], msg); - } else { - assert.equal(actual, expected, msg); - } + assert.equal(actual, expected, msg); } } } +} - function alive(pid) { - try { - process.kill(pid, 'SIGCONT'); - return true; - } catch (e) { - return false; - } +function alive(pid) { + try { + process.kill(pid, 'SIGCONT'); + return true; + } catch (e) { + return false; } +} diff --git a/test/parallel/test-cluster-worker-no-exit.js b/test/parallel/test-cluster-worker-no-exit.js index 034a4952e88c59..b44831694c6bfa 100644 --- a/test/parallel/test-cluster-worker-no-exit.js +++ b/test/parallel/test-cluster-worker-no-exit.js @@ -1,5 +1,6 @@ +'use strict'; var assert = require('assert'); -var cluster = require('cluster') +var cluster = require('cluster'); var net = require('net'); var common = require('../common'); @@ -21,7 +22,7 @@ var server; if (cluster.isMaster) { server = net.createServer(function(conn) { server.close(); - worker.disconnect() + worker.disconnect(); worker.once('disconnect', function() { setTimeout(function() { conn.destroy(); diff --git a/test/parallel/test-common.js b/test/parallel/test-common.js index d15448bd36afff..7cbaf305d6e4f3 100644 --- a/test/parallel/test-common.js +++ b/test/parallel/test-common.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index a91410b4091d47..a80c6e57e4b151 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Stream = require('stream'); @@ -15,7 +16,7 @@ assert.equal('function', typeof Console); // make sure that the Console constructor throws // when not given a writable stream instance -assert.throws(function () { +assert.throws(function() { new Console(); }, /Console expects a writable stream/); diff --git a/test/parallel/test-console-not-call-toString.js b/test/parallel/test-console-not-call-toString.js index 9612a0f6ec0ddc..7846dbf2778b9c 100644 --- a/test/parallel/test-console-not-call-toString.js +++ b/test/parallel/test-console-not-call-toString.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index 2e5060f38319d5..982c83851f072a 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -7,17 +8,17 @@ assert.ok(process.stderr.writable); assert.equal('number', typeof process.stdout.fd); assert.equal('number', typeof process.stderr.fd); -assert.throws(function () { +assert.throws(function() { console.timeEnd('no such label'); }); -assert.doesNotThrow(function () { +assert.doesNotThrow(function() { console.time('label'); console.timeEnd('label'); }); // an Object with a custom .inspect() function -var custom_inspect = { foo: 'bar', inspect: function () { return 'inspect'; } }; +var custom_inspect = { foo: 'bar', inspect: function() { return 'inspect'; } }; var stdout_write = global.process.stdout.write; var strings = []; diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 0336871a56fa20..75d733ff98b9b1 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -16,27 +17,33 @@ crypto.DEFAULT_ENCODING = 'buffer'; // var TEST_CASES = [ - { algo: 'aes-128-gcm', key: '6970787039613669314d623455536234', + { algo: 'aes-128-gcm', + key: '6970787039613669314d623455536234', iv: '583673497131313748307652', plain: 'Hello World!', ct: '4BE13896F64DFA2C2D0F2C76', tag: '272B422F62EB545EAA15B5FF84092447', tampered: false }, - { algo: 'aes-128-gcm', key: '6970787039613669314d623455536234', + { algo: 'aes-128-gcm', + key: '6970787039613669314d623455536234', iv: '583673497131313748307652', plain: 'Hello World!', ct: '4BE13896F64DFA2C2D0F2C76', aad: '000000FF', tag: 'BA2479F66275665A88CB7B15F43EB005', tampered: false }, - { algo: 'aes-128-gcm', key: '6970787039613669314d623455536234', + { algo: 'aes-128-gcm', + key: '6970787039613669314d623455536234', iv: '583673497131313748307652', plain: 'Hello World!', ct: '4BE13596F64DFA2C2D0FAC76', tag: '272B422F62EB545EAA15B5FF84092447', tampered: true }, - { algo: 'aes-256-gcm', key: '337a54767a7233703637564336316a6d56353472495975313534357834546c59', + { algo: 'aes-256-gcm', + key: '337a54767a7233703637564336316a6d56353472495975313534357834546c59', iv: '36306950306836764a6f4561', plain: 'Hello node.js world!', ct: '58E62CFE7B1D274111A82267EBB93866E72B6C2A', tag: '9BB44F663BADABACAE9720881FB1EC7A', tampered: false }, - { algo: 'aes-256-gcm', key: '337a54767a7233703637564336316a6d56353472495975313534357834546c59', + { algo: 'aes-256-gcm', + key: '337a54767a7233703637564336316a6d56353472495975313534357834546c59', iv: '36306950306836764a6f4561', plain: 'Hello node.js world!', ct: '58E62CFF7B1D274011A82267EBB93866E72B6C2B', tag: '9BB44F663BADABACAE9720881FB1EC7A', tampered: true }, - { algo: 'aes-192-gcm', key: '1ed2233fa2223ef5d7df08546049406c7305220bca40d4c9', + { algo: 'aes-192-gcm', + key: '1ed2233fa2223ef5d7df08546049406c7305220bca40d4c9', iv: '0e1791e9db3bd21a9122c416', plain: 'Hello node.js world!', password: 'very bad password', aad: '63616c76696e', ct: 'DDA53A4059AA17B88756984995F7BBA3C636CC44', diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index dced72309371ab..8623ff477429da 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -1,3 +1,4 @@ +'use strict'; // This is the same as test/simple/test-crypto, but from before the shift // to use buffers by default. diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 9c98fda2bd5120..ab0d4ca9dff0b3 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index e82a08d7031d0c..931cf339bbb612 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -137,13 +138,13 @@ testCipher4(new Buffer('0123456789abcd0123456789'), new Buffer('12345678')); // not assert. See #4886. (function() { var c = crypto.createCipher('aes-256-cbc', 'secret'); - try { c.final('xxx') } catch (e) { /* Ignore. */ } - try { c.final('xxx') } catch (e) { /* Ignore. */ } - try { c.final('xxx') } catch (e) { /* Ignore. */ } + try { c.final('xxx'); } catch (e) { /* Ignore. */ } + try { c.final('xxx'); } catch (e) { /* Ignore. */ } + try { c.final('xxx'); } catch (e) { /* Ignore. */ } var d = crypto.createDecipher('aes-256-cbc', 'secret'); - try { d.final('xxx') } catch (e) { /* Ignore. */ } - try { d.final('xxx') } catch (e) { /* Ignore. */ } - try { d.final('xxx') } catch (e) { /* Ignore. */ } + try { d.final('xxx'); } catch (e) { /* Ignore. */ } + try { d.final('xxx'); } catch (e) { /* Ignore. */ } + try { d.final('xxx'); } catch (e) { /* Ignore. */ } })(); // Regression test for #5482: string to Cipher#update() should not assert. diff --git a/test/parallel/test-crypto-dh-odd-key.js b/test/parallel/test-crypto-dh-odd-key.js index 46b3c3d8c65c23..1c7f4f69bb4b50 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 9eccc2f357215c..4978ab2ebbcb1f 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var constants = require('constants'); @@ -58,7 +59,7 @@ assert.equal(secret1, secret3); // Run this one twice to make sure that the dh3 clears its error properly (function() { var c = crypto.createDecipher('aes-128-ecb', ''); - assert.throws(function() { c.final('utf8') }, /wrong final block length/); + assert.throws(function() { c.final('utf8'); }, /wrong final block length/); })(); assert.throws(function() { @@ -67,7 +68,7 @@ assert.throws(function() { (function() { var c = crypto.createDecipher('aes-128-ecb', ''); - assert.throws(function() { c.final('utf8') }, /wrong final block length/); + assert.throws(function() { c.final('utf8'); }, /wrong final block length/); })(); // Create a shared using a DH group. diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index 910e026d20c0ef..fe5e72982d53af 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); diff --git a/test/parallel/test-crypto-domains.js b/test/parallel/test-crypto-domains.js index eb5c77e12ca1eb..55c67b490dbae0 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -1,8 +1,9 @@ +'use strict'; var common = require('../common'); var domain = require('domain'); var assert = require('assert'); var d = domain.create(); -var expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes'] +var expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']; var errors = 0; if (!common.hasCrypto) { @@ -15,30 +16,30 @@ process.on('exit', function() { assert.equal(errors, 3); }); -d.on('error', function (e) { +d.on('error', function(e) { assert.equal(e.message, expect.shift()); errors += 1; }); -d.run(function () { +d.run(function() { one(); function one() { - crypto.pbkdf2('a', 'b', 1, 8, function () { + crypto.pbkdf2('a', 'b', 1, 8, function() { two(); throw new Error('pbkdf2'); }); } function two() { - crypto.randomBytes(4, function () { + crypto.randomBytes(4, function() { three(); throw new Error('randomBytes'); }); } function three() { - crypto.pseudoRandomBytes(4, function () { + crypto.pseudoRandomBytes(4, function() { throw new Error('pseudoRandomBytes'); }); } diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index f924dfd29b9bc3..f1541ddeb403dc 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index ae450645dda610..4c8d7338dd9770 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -1,3 +1,4 @@ +'use strict'; // This is the same as test/simple/test-crypto, but from before the shift // to use buffers by default. diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index 795abd49a0f597..23feccea3843ae 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -7,7 +8,7 @@ if (!common.hasCrypto) { } var crypto = require('crypto'); -var stream = require('stream') +var stream = require('stream'); var s = new stream.PassThrough(); var h = crypto.createHash('sha1'); var expect = '15987e60950cf22655b9323bc1e281f9c4aff47e'; diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index af323ac4f6496e..5c542406cb7112 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js index 1a90811fe87c9e..e234bd91606906 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -56,7 +57,7 @@ var wikipedia = [ '4292c5ad' } }, -] +]; for (var i = 0, l = wikipedia.length; i < l; i++) { for (var hash in wikipedia[i]['hmac']) { diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js index de5fb7ca8732c1..db75a07c9e1617 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -15,15 +16,15 @@ function aes256(decipherFinal) { '0123456789abcdef0123456789abcdef', 'hex'); function encrypt(val, pad) { - var c = crypto.createCipheriv('aes256', key, iv); - c.setAutoPadding(pad); - return c.update(val, 'utf8', 'binary') + c.final('binary'); + var c = crypto.createCipheriv('aes256', key, iv); + c.setAutoPadding(pad); + return c.update(val, 'utf8', 'binary') + c.final('binary'); } function decrypt(val, pad) { - var c = crypto.createDecipheriv('aes256', key, iv); - c.setAutoPadding(pad); - return c.update(val, 'binary', 'utf8') + c[decipherFinal]('utf8'); + var c = crypto.createDecipheriv('aes256', key, iv); + c.setAutoPadding(pad); + return c.update(val, 'binary', 'utf8') + c[decipherFinal]('utf8'); } // echo 0123456789abcdef0123456789abcdef \ diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 2cf78588f9da62..11b1729fde88cb 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index 440c6162e3b26a..88be15b68cb348 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index de1bfccf90d2fb..cac0c9b86cf2c1 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js index 65986b49c94789..127bbfb26df5dd 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 5cac8948dbd02f..fb811e7f12d0fc 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index 75ea5b13a4c5df..fd970e061b00e1 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var stream = require('stream'); @@ -14,24 +15,24 @@ function Stream2buffer(callback) { stream.Writable.call(this); this._buffers = []; - this.once('finish', function () { + this.once('finish', function() { callback(null, Buffer.concat(this._buffers)); }); } util.inherits(Stream2buffer, stream.Writable); -Stream2buffer.prototype._write = function (data, encodeing, done) { +Stream2buffer.prototype._write = function(data, encodeing, done) { this._buffers.push(data); return done(null); }; // Create an md5 hash of "Hallo world" var hasher1 = crypto.createHash('md5'); - hasher1.pipe(new Stream2buffer(common.mustCall(function end(err, hash) { - assert.equal(err, null); - assert.equal(hash.toString('hex'), '06460dadb35d3d503047ce750ceb2d07'); - }))); - hasher1.end('Hallo world'); +hasher1.pipe(new Stream2buffer(common.mustCall(function end(err, hash) { + assert.equal(err, null); + assert.equal(hash.toString('hex'), '06460dadb35d3d503047ce750ceb2d07'); +}))); +hasher1.end('Hallo world'); // Simpler check for unpipe, setEncoding, pause and resume crypto.createHash('md5').unpipe({}); diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js index 6190ae247dae2c..a4a9ec698197c0 100644 --- a/test/parallel/test-crypto-verify-failure.js +++ b/test/parallel/test-crypto-verify-failure.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -23,11 +24,11 @@ var canSend = true; var server = tls.Server(options, function(socket) { setImmediate(function() { - console.log('sending'); - verify(); - setImmediate(function() { - socket.destroy(); - }); + console.log('sending'); + verify(); + setImmediate(function() { + socket.destroy(); + }); }); }); diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index d8a5099bbd80ea..e3557943c63d82 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -118,7 +119,7 @@ assert.throws(function() { }, /Bad input string/); assert.throws(function() { - var private = [ + var priv = [ '-----BEGIN RSA PRIVATE KEY-----', 'MIGrAgEAAiEA+3z+1QNF2/unumadiwEr+C5vfhezsb3hp4jAnCNRpPcCAwEAAQIgQNriSQK4', 'EFwczDhMZp2dvbcz7OUUyt36z3S4usFPHSECEQD/41K7SujrstBfoCPzwC1xAhEA+5kt4BJy', @@ -127,7 +128,7 @@ assert.throws(function() { '-----END RSA PRIVATE KEY-----', '' ].join('\n'); - crypto.createSign('RSA-SHA256').update('test').sign(private); + crypto.createSign('RSA-SHA256').update('test').sign(priv); }, /RSA_sign:digest too big for rsa key/); // Make sure memory isn't released before being returned diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js index 64538f80b963df..5f47b84be5b2f0 100644 --- a/test/parallel/test-cwd-enoent-repl.js +++ b/test/parallel/test-cwd-enoent-repl.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js index 6e7b02c85d8d12..0d0fde24814e83 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-debug-port-cluster.js b/test/parallel/test-debug-port-cluster.js index 96a6f6e7f405b7..5bec9dc720599e 100644 --- a/test/parallel/test-debug-port-cluster.js +++ b/test/parallel/test-debug-port-cluster.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; @@ -16,7 +17,7 @@ child.stderr.on('data', function(data) { var lines = data.toString().replace(/\r/g, '').trim().split('\n'); var line = lines[0]; - lines.forEach(function(ln) { console.log('> ' + ln) } ); + lines.forEach(function(ln) { console.log('> ' + ln); } ); if (line === 'all workers are running') { assertOutputLines(); @@ -33,8 +34,8 @@ process.on('exit', function onExit() { var assertOutputLines = common.mustCall(function() { var expectedLines = [ 'Debugger listening on port ' + port, - 'Debugger listening on port ' + (port+1), - 'Debugger listening on port ' + (port+2), + 'Debugger listening on port ' + (port + 1), + 'Debugger listening on port ' + (port + 2), ]; // Do not assume any particular order of output messages, @@ -42,7 +43,7 @@ var assertOutputLines = common.mustCall(function() { // start up outputLines.sort(); - assert.equal(outputLines.length, expectedLines.length) + assert.equal(outputLines.length, expectedLines.length); for (var i = 0; i < expectedLines.length; i++) assert.equal(outputLines[i], expectedLines[i]); }); diff --git a/test/parallel/test-debug-port-from-cmdline.js b/test/parallel/test-debug-port-from-cmdline.js index 4ed2e84918c8f0..deb7ae241a55fd 100644 --- a/test/parallel/test-debug-port-from-cmdline.js +++ b/test/parallel/test-debug-port-from-cmdline.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-debug-signal-cluster.js b/test/parallel/test-debug-signal-cluster.js index 772ee6f1e6f454..6572ef50afe845 100644 --- a/test/parallel/test-debug-signal-cluster.js +++ b/test/parallel/test-debug-signal-cluster.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-delayed-require.js b/test/parallel/test-delayed-require.js index 161f3d2ffa79ae..5fa82f236c1dd9 100644 --- a/test/parallel/test-delayed-require.js +++ b/test/parallel/test-delayed-require.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-dgram-address.js b/test/parallel/test-dgram-address.js index 6da1c6cda45c76..f128ce5110317b 100644 --- a/test/parallel/test-dgram-address.js +++ b/test/parallel/test-dgram-address.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-bind-default-address.js b/test/parallel/test-dgram-bind-default-address.js index 28db7d9fa61af1..03e8afb99132aa 100644 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-bind-shared-ports.js b/test/parallel/test-dgram-bind-shared-ports.js index 4cfe4b5f9af7f4..91a48a260fbd90 100644 --- a/test/parallel/test-dgram-bind-shared-ports.js +++ b/test/parallel/test-dgram-bind-shared-ports.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-dgram-bind.js b/test/parallel/test-dgram-bind.js index 72f2f2c2b052bb..6d35534cb5eb56 100644 --- a/test/parallel/test-dgram-bind.js +++ b/test/parallel/test-dgram-bind.js @@ -1,10 +1,11 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); var socket = dgram.createSocket('udp4'); -socket.on('listening', function () { +socket.on('listening', function() { socket.close(); }); diff --git a/test/parallel/test-dgram-bytes-length.js b/test/parallel/test-dgram-bytes-length.js index 9698a0b465e4b8..9f8c39eb04daaf 100644 --- a/test/parallel/test-dgram-bytes-length.js +++ b/test/parallel/test-dgram-bytes-length.js @@ -1,10 +1,12 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); var message = new Buffer('Some bytes'); var client = dgram.createSocket('udp4'); -client.send(message, 0, message.length, 41234, "localhost", function(err, bytes) { +client.send(message, 0, message.length, 41234, 'localhost', + function(err, bytes) { assert.strictEqual(bytes, message.length); client.close(); }); diff --git a/test/parallel/test-dgram-close-is-not-callback.js b/test/parallel/test-dgram-close-is-not-callback.js index 94035af97027bb..6fc4901fa14404 100644 --- a/test/parallel/test-dgram-close-is-not-callback.js +++ b/test/parallel/test-dgram-close-is-not-callback.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-close.js b/test/parallel/test-dgram-close.js index bd4af66323c05b..7e9dd4ef52c402 100644 --- a/test/parallel/test-dgram-close.js +++ b/test/parallel/test-dgram-close.js @@ -1,3 +1,4 @@ +'use strict'; // Ensure that if a dgram socket is closed before the DNS lookup completes, it // won't crash. diff --git a/test/parallel/test-dgram-empty-packet.js b/test/parallel/test-dgram-empty-packet.js index a629df8e1bc564..797012b8839fb7 100644 --- a/test/parallel/test-dgram-empty-packet.js +++ b/test/parallel/test-dgram-empty-packet.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -22,15 +23,15 @@ function callback() { clearTimeout(timer); client.close(); } else if (callbacks > 2) { - throw new Error("the callbacks should be called only two times"); + throw new Error('the callbacks should be called only two times'); } } -client.on('message', function (buffer, bytes) { +client.on('message', function(buffer, bytes) { callback(); }); -client.send(new Buffer(1), 0, 0, common.PORT, "127.0.0.1", function (err, len) { +client.send(new Buffer(1), 0, 0, common.PORT, '127.0.0.1', function(err, len) { callback(); }); diff --git a/test/parallel/test-dgram-error-message-address.js b/test/parallel/test-dgram-error-message-address.js index 95b1e062e3f2a7..eca2ccce4f1b65 100644 --- a/test/parallel/test-dgram-error-message-address.js +++ b/test/parallel/test-dgram-error-message-address.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-exclusive-implicit-bind.js b/test/parallel/test-dgram-exclusive-implicit-bind.js index 057b891eb6d891..077e1812b99144 100644 --- a/test/parallel/test-dgram-exclusive-implicit-bind.js +++ b/test/parallel/test-dgram-exclusive-implicit-bind.js @@ -1,3 +1,4 @@ +'use strict'; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/test/parallel/test-dgram-implicit-bind.js b/test/parallel/test-dgram-implicit-bind.js index adf6f52b4974a0..8b78bd66c6f313 100644 --- a/test/parallel/test-dgram-implicit-bind.js +++ b/test/parallel/test-dgram-implicit-bind.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-listen-after-bind.js b/test/parallel/test-dgram-listen-after-bind.js index c5f09b84677872..2aac7ae9cf7588 100644 --- a/test/parallel/test-dgram-listen-after-bind.js +++ b/test/parallel/test-dgram-listen-after-bind.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); @@ -7,16 +8,16 @@ var socket = dgram.createSocket('udp4'); socket.bind(); var fired = false; -var timer = setTimeout(function () { +var timer = setTimeout(function() { socket.close(); }, 100); -socket.on('listening', function () { +socket.on('listening', function() { clearTimeout(timer); fired = true; socket.close(); }); -socket.on('close', function () { +socket.on('close', function() { assert(fired, 'listening should fire after bind'); }); diff --git a/test/parallel/test-dgram-msgsize.js b/test/parallel/test-dgram-msgsize.js index 474ab82f44a47f..6330e2a82bdcc5 100644 --- a/test/parallel/test-dgram-msgsize.js +++ b/test/parallel/test-dgram-msgsize.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-multicast-setTTL.js b/test/parallel/test-dgram-multicast-setTTL.js index d849945fab7837..f48fc7118ec3c1 100644 --- a/test/parallel/test-dgram-multicast-setTTL.js +++ b/test/parallel/test-dgram-multicast-setTTL.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), dgram = require('dgram'), @@ -5,7 +6,7 @@ var common = require('../common'), socket = dgram.createSocket('udp4'); socket.bind(common.PORT); -socket.on('listening', function () { +socket.on('listening', function() { socket.setMulticastTTL(16); //Try to set an invalid TTL (valid ttl is > 0 and < 256) diff --git a/test/parallel/test-dgram-oob-buffer.js b/test/parallel/test-dgram-oob-buffer.js index bbbdc4dafeee19..b64c7236afd4bc 100644 --- a/test/parallel/test-dgram-oob-buffer.js +++ b/test/parallel/test-dgram-oob-buffer.js @@ -1,3 +1,4 @@ +'use strict'; // Some operating systems report errors when an UDP message is sent to an // unreachable host. This error can be reported by sendto() and even by // recvfrom(). Node should not propagate this error to the user. diff --git a/test/parallel/test-dgram-pingpong.js b/test/parallel/test-dgram-pingpong.js index b7d7a0067e89e7..29ab92757bd817 100644 --- a/test/parallel/test-dgram-pingpong.js +++ b/test/parallel/test-dgram-pingpong.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Buffer = require('buffer').Buffer; diff --git a/test/parallel/test-dgram-ref.js b/test/parallel/test-dgram-ref.js index 8d100eb0783f55..d689a45e36dfa2 100644 --- a/test/parallel/test-dgram-ref.js +++ b/test/parallel/test-dgram-ref.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-regress-4496.js b/test/parallel/test-dgram-regress-4496.js index a200716c0fb8d8..fcb8d026bc547e 100644 --- a/test/parallel/test-dgram-regress-4496.js +++ b/test/parallel/test-dgram-regress-4496.js @@ -1,3 +1,4 @@ +'use strict'; // Remove this test once we support sending strings. var common = require('../common'); @@ -6,6 +7,6 @@ var dgram = require('dgram'); // Should throw but not crash. var socket = dgram.createSocket('udp4'); -assert.throws(function() { socket.send(true, 0, 1, 1, 'host') }, TypeError); -assert.throws(function() { socket.sendto(5, 0, 1, 1, 'host') }, TypeError); +assert.throws(function() { socket.send(true, 0, 1, 1, 'host'); }, TypeError); +assert.throws(function() { socket.sendto(5, 0, 1, 1, 'host'); }, TypeError); socket.close(); diff --git a/test/parallel/test-dgram-send-bad-arguments.js b/test/parallel/test-dgram-send-bad-arguments.js index ab18784ccc6905..ccd10e00555384 100644 --- a/test/parallel/test-dgram-send-bad-arguments.js +++ b/test/parallel/test-dgram-send-bad-arguments.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dgram = require('dgram'); diff --git a/test/parallel/test-dgram-send-callback-buffer-length.js b/test/parallel/test-dgram-send-callback-buffer-length.js index 5596a7242f3a6a..a34c5e2eb6b8db 100644 --- a/test/parallel/test-dgram-send-callback-buffer-length.js +++ b/test/parallel/test-dgram-send-callback-buffer-length.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -15,11 +16,11 @@ offset = 20; len = buf.length - offset; -client.send(buf, offset, len, common.PORT, "127.0.0.1", function (err, bytes) { - assert.notEqual(bytes, buf.length); - assert.equal(bytes, buf.length - offset); - clearTimeout(timer); - client.close(); +client.send(buf, offset, len, common.PORT, '127.0.0.1', function(err, bytes) { + assert.notEqual(bytes, buf.length); + assert.equal(bytes, buf.length - offset); + clearTimeout(timer); + client.close(); }); timer = setTimeout(function() { diff --git a/test/parallel/test-dgram-send-empty-buffer.js b/test/parallel/test-dgram-send-empty-buffer.js index e2ca937d6afbb3..ab66e0545e611d 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -16,13 +17,13 @@ client = dgram.createSocket('udp4'); client.bind(common.PORT); -client.on('message', function (buffer, bytes) { +client.on('message', function(buffer, bytes) { clearTimeout(timer); client.close(); }); buf = new Buffer(0); -client.send(buf, 0, 0, common.PORT, "127.0.0.1", function (err, len) { }); +client.send(buf, 0, 0, common.PORT, '127.0.0.1', function(err, len) { }); timer = setTimeout(function() { throw new Error('Timeout'); diff --git a/test/parallel/test-dgram-udp4.js b/test/parallel/test-dgram-udp4.js index cde49c1b1bc063..f81dec398f72d1 100644 --- a/test/parallel/test-dgram-udp4.js +++ b/test/parallel/test-dgram-udp4.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-dgram-unref.js b/test/parallel/test-dgram-unref.js index 94f7ba739c740c..2add3d28c49760 100644 --- a/test/parallel/test-dgram-unref.js +++ b/test/parallel/test-dgram-unref.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-dh-padding.js b/test/parallel/test-dh-padding.js index 3e30fd34e7713d..872653763239c4 100644 --- a/test/parallel/test-dh-padding.js +++ b/test/parallel/test-dh-padding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-dns-cares-domains.js b/test/parallel/test-dns-cares-domains.js index 5c6d07cfe5322a..cb651c5f5afb86 100644 --- a/test/parallel/test-dns-cares-domains.js +++ b/test/parallel/test-dns-cares-domains.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dns = require('dns'); @@ -13,13 +14,13 @@ var methods = [ 'resolveSrv', 'resolveNaptr', 'resolveSoa' -] +]; methods.forEach(function(method) { var d = domain.create(); d.run(function() { dns[method]('google.com', function() { - assert.strictEqual(process.domain, d, method + ' retains domain') + assert.strictEqual(process.domain, d, method + ' retains domain'); }); }); }); diff --git a/test/parallel/test-dns-lookup-cb-error.js b/test/parallel/test-dns-lookup-cb-error.js index 2aa9ffe7d6301f..330dfb5d57092a 100644 --- a/test/parallel/test-dns-lookup-cb-error.js +++ b/test/parallel/test-dns-lookup-cb-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cares = process.binding('cares_wrap'); diff --git a/test/parallel/test-dns-regress-6244.js b/test/parallel/test-dns-regress-6244.js index 8bed54f1b297f5..7ed7a892069870 100644 --- a/test/parallel/test-dns-regress-6244.js +++ b/test/parallel/test-dns-regress-6244.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var dns = require('dns'); diff --git a/test/parallel/test-dns-regress-7070.js b/test/parallel/test-dns-regress-7070.js index 79f0d7d9e0ca00..1fbd7f07a9d520 100644 --- a/test/parallel/test-dns-regress-7070.js +++ b/test/parallel/test-dns-regress-7070.js @@ -1,7 +1,8 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var dns = require('dns'); // Should not raise assertion error. Issue #7070 -assert.throws(function () { dns.resolveNs([]); }); // bad name -assert.throws(function () { dns.resolveNs(''); }); // bad callback +assert.throws(function() { dns.resolveNs([]); }); // bad name +assert.throws(function() { dns.resolveNs(''); }); // bad callback diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index 1de9bbfdf77977..abc7edbf598097 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -12,16 +13,16 @@ var goog = [ '8.8.8.8', '8.8.4.4', ]; -assert.doesNotThrow(function () { dns.setServers(goog) }); +assert.doesNotThrow(function() { dns.setServers(goog); }); assert.deepEqual(dns.getServers(), goog); -assert.throws(function () { dns.setServers(['foobar']) }); +assert.throws(function() { dns.setServers(['foobar']); }); assert.deepEqual(dns.getServers(), goog); var goog6 = [ '2001:4860:4860::8888', '2001:4860:4860::8844', ]; -assert.doesNotThrow(function () { dns.setServers(goog6) }); +assert.doesNotThrow(function() { dns.setServers(goog6); }); assert.deepEqual(dns.getServers(), goog6); goog6.push('4.4.4.4'); @@ -39,7 +40,7 @@ var portsExpected = [ dns.setServers(ports); assert.deepEqual(dns.getServers(), portsExpected); -assert.doesNotThrow(function () { dns.setServers([]); }); +assert.doesNotThrow(function() { dns.setServers([]); }); assert.deepEqual(dns.getServers(), []); assert.throws(function() { diff --git a/test/parallel/test-domain-abort-on-uncaught.js b/test/parallel/test-domain-abort-on-uncaught.js index e11bbcc6bc755f..f4884aa8f33421 100644 --- a/test/parallel/test-domain-abort-on-uncaught.js +++ b/test/parallel/test-domain-abort-on-uncaught.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --abort_on_uncaught_exception var common = require('../common'); @@ -18,7 +19,7 @@ process.on('exit', function() { assert.equal(errors, tests.length); }); -tests.forEach(function(test) { test(); }) +tests.forEach(function(test) { test(); }); function nextTick() { var d = domain.create(); @@ -84,10 +85,10 @@ function netServer() { conn.pipe(conn); }); server.listen(common.PORT, '0.0.0.0', function() { - var conn = net.connect(common.PORT, '0.0.0.0') + var conn = net.connect(common.PORT, '0.0.0.0'); conn.once('data', function() { throw new Error('ok'); - }) + }); conn.end('ok'); server.close(); }); diff --git a/test/parallel/test-domain-crypto.js b/test/parallel/test-domain-crypto.js index dc183b7bda1760..96047474956e73 100644 --- a/test/parallel/test-domain-crypto.js +++ b/test/parallel/test-domain-crypto.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ try { var crypto = require('crypto'); } catch (e) { diff --git a/test/parallel/test-domain-enter-exit.js b/test/parallel/test-domain-enter-exit.js index 32ec0ca2472c8c..5cf0d9c54a3122 100644 --- a/test/parallel/test-domain-enter-exit.js +++ b/test/parallel/test-domain-enter-exit.js @@ -1,3 +1,4 @@ +'use strict'; // Make sure the domain stack is a stack var assert = require('assert'); @@ -5,7 +6,7 @@ var domain = require('domain'); function names(array) { return array.map(function(d) { - return d.name + return d.name; }).join(', '); } diff --git a/test/parallel/test-domain-exit-dispose-again.js b/test/parallel/test-domain-exit-dispose-again.js index c651181092737b..d7046481d112ea 100644 --- a/test/parallel/test-domain-exit-dispose-again.js +++ b/test/parallel/test-domain-exit-dispose-again.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); @@ -6,7 +7,7 @@ var disposalFailed = false; // no matter what happens, we should increment a 10 times. var a = 0; log(); -function log(){ +function log() { console.log(a++, process.domain); if (a < 10) setTimeout(log, 20); } @@ -16,7 +17,7 @@ var secondTimerRan = false; // in 50ms we'll throw an error. setTimeout(err, 50); setTimeout(secondTimer, 50); -function err(){ +function err() { var d = domain.create(); d.on('error', handle); d.run(err2); diff --git a/test/parallel/test-domain-exit-dispose.js b/test/parallel/test-domain-exit-dispose.js index a01cee5c73cb0c..90e7210ce21aea 100644 --- a/test/parallel/test-domain-exit-dispose.js +++ b/test/parallel/test-domain-exit-dispose.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); @@ -6,14 +7,14 @@ var disposalFailed = false; // no matter what happens, we should increment a 10 times. var a = 0; log(); -function log(){ +function log() { console.log(a++, process.domain); if (a < 10) setTimeout(log, 20); } // in 50ms we'll throw an error. setTimeout(err, 50); -function err(){ +function err() { var d = domain.create(); d.on('error', handle); d.run(err2); diff --git a/test/parallel/test-domain-from-timer.js b/test/parallel/test-domain-from-timer.js index 91dff3875cd7a2..93661b419b0bbf 100644 --- a/test/parallel/test-domain-from-timer.js +++ b/test/parallel/test-domain-from-timer.js @@ -1,3 +1,4 @@ +'use strict'; // Simple tests of most basic domain functionality. var common = require('../common'); @@ -10,7 +11,7 @@ setTimeout(function() { var d = domain.create(); d.run(function() { process.nextTick(function() { - console.trace('in nexttick', process.domain === d) + console.trace('in nexttick', process.domain === d); assert.equal(process.domain, d); }); }); diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index 77e10911716fb0..7cabf205e8f51c 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -1,3 +1,4 @@ +'use strict'; var domain = require('domain'); var http = require('http'); var assert = require('assert'); diff --git a/test/parallel/test-domain-implicit-fs.js b/test/parallel/test-domain-implicit-fs.js index 4a00b9a17ad5db..fd21dcafe0858f 100644 --- a/test/parallel/test-domain-implicit-fs.js +++ b/test/parallel/test-domain-implicit-fs.js @@ -1,3 +1,4 @@ +'use strict'; // Simple tests of most basic domain functionality. var common = require('../common'); diff --git a/test/parallel/test-domain-multi.js b/test/parallel/test-domain-multi.js index 270ecde4962241..e5f9f6748b178e 100644 --- a/test/parallel/test-domain-multi.js +++ b/test/parallel/test-domain-multi.js @@ -1,3 +1,4 @@ +'use strict'; // Tests of multiple domains happening at once. var common = require('../common'); @@ -20,7 +21,7 @@ a.on('error', function(er) { var http = require('http'); -var server = http.createServer(function (req, res) { +var server = http.createServer(function(req, res) { // child domain of a. var b = domain.create(); a.add(b); @@ -31,9 +32,9 @@ var server = http.createServer(function (req, res) { b.add(req); b.add(res); - b.on('error', function (er) { + b.on('error', function(er) { caughtB = true; - console.error('Error encountered', er) + console.error('Error encountered', er); if (res) { res.writeHead(500); res.end('An error occurred'); @@ -52,7 +53,7 @@ var server = http.createServer(function (req, res) { }).listen(common.PORT); var c = domain.create(); -var req = http.get({ host: 'localhost', port: common.PORT }) +var req = http.get({ host: 'localhost', port: common.PORT }); // add the request to the C domain c.add(req); @@ -71,7 +72,7 @@ c.on('error', function(er) { process.on('exit', function() { assert.equal(caughtA, false); - assert.equal(caughtB, true) - assert.equal(caughtC, true) + assert.equal(caughtB, true); + assert.equal(caughtC, true); console.log('ok - Errors went where they were supposed to go'); }); diff --git a/test/parallel/test-domain-nested-throw.js b/test/parallel/test-domain-nested-throw.js index 87039bb3f939ce..0fba3001b543fb 100644 --- a/test/parallel/test-domain-nested-throw.js +++ b/test/parallel/test-domain-nested-throw.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -50,7 +51,7 @@ function throw2() { function inner(throw1, throw2) { var domain1 = domain.createDomain(); - domain1.on('error', function (err) { + domain1.on('error', function(err) { if (gotDomain1Error) { console.error('got domain 1 twice'); process.exit(1); @@ -60,7 +61,7 @@ function inner(throw1, throw2) { throw2(); }); - domain1.run(function () { + domain1.run(function() { throw1(); }); } @@ -68,7 +69,7 @@ function inner(throw1, throw2) { function outer() { var domain2 = domain.createDomain(); - domain2.on('error', function (err) { + domain2.on('error', function(err) { if (gotDomain2Error) { console.error('got domain 2 twice'); process.exit(1); @@ -76,7 +77,7 @@ function outer() { gotDomain2Error = true; }); - domain2.run(function () { + domain2.run(function() { inner(throw1, throw2); }); } diff --git a/test/parallel/test-domain-nested.js b/test/parallel/test-domain-nested.js index 9334c287baedc1..d0ef072339b8f9 100644 --- a/test/parallel/test-domain-nested.js +++ b/test/parallel/test-domain-nested.js @@ -1,3 +1,4 @@ +'use strict'; // Make sure that the nested domains don't cause the domain stack to grow var assert = require('assert'); @@ -10,11 +11,11 @@ process.on('exit', function(c) { domain.create().run(function() { domain.create().run(function() { domain.create().run(function() { - domain.create().on("error", function(e) { + domain.create().on('error', function(e) { // Don't need to do anything here }).run(function() { - throw new Error("died") - }) - }) - }) -}) + throw new Error('died'); + }); + }); + }); +}); diff --git a/test/parallel/test-domain-safe-exit.js b/test/parallel/test-domain-safe-exit.js index 029687411a09b9..6661c577b30c87 100644 --- a/test/parallel/test-domain-safe-exit.js +++ b/test/parallel/test-domain-safe-exit.js @@ -1,3 +1,4 @@ +'use strict'; // Make sure the domain stack doesn't get clobbered by un-matched .exit() var assert = require('assert'); diff --git a/test/parallel/test-domain-stack.js b/test/parallel/test-domain-stack.js index be611a872117ff..f9b5648a6619a7 100644 --- a/test/parallel/test-domain-stack.js +++ b/test/parallel/test-domain-stack.js @@ -1,3 +1,4 @@ +'use strict'; // Make sure that the domain stack doesn't get out of hand. var common = require('../common'); diff --git a/test/parallel/test-domain-timers.js b/test/parallel/test-domain-timers.js index 5a34bc7449a951..7530c9edba40b1 100644 --- a/test/parallel/test-domain-timers.js +++ b/test/parallel/test-domain-timers.js @@ -1,3 +1,4 @@ +'use strict'; var domain = require('domain'); var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index a3f7b76848a581..9cca05178ef10f 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -1,3 +1,4 @@ +'use strict'; // Simple tests of most basic domain functionality. var common = require('../common'); @@ -15,7 +16,7 @@ d.on('error', function(er) { console.error('caught', er && (er.message || er)); var er_message = er.message; - var er_path = er.path + var er_path = er.path; // On windows, error messages can contain full path names. If this is the // case, remove the directory part. @@ -58,7 +59,8 @@ d.on('error', function(er) { assert.equal(typeof er.errno, 'number'); break; - case "ENOENT: no such file or directory, open 'stream for nonexistent file'": + case + "ENOENT: no such file or directory, open 'stream for nonexistent file'": assert.equal(typeof er.errno, 'number'); assert.equal(er.code, 'ENOENT'); assert.equal(er_path, 'stream for nonexistent file'); @@ -129,7 +131,7 @@ expectCaught++; // set up while in the scope of the d domain. d.run(function() { process.nextTick(function() { - var i = setInterval(function () { + var i = setInterval(function() { clearInterval(i); setTimeout(function() { fs.stat('this file does not exist', function(er, stat) { @@ -178,7 +180,7 @@ expectCaught++; // intercepted should never pass first argument to callback function fn2(data) { - assert.equal(data, 'data', 'should not be null err argument') + assert.equal(data, 'data', 'should not be null err argument'); } var bound = d.intercept(fn2); @@ -220,7 +222,7 @@ expectCaught++; var implicit; d.run(function() { - implicit = new events.EventEmitter; + implicit = new events.EventEmitter(); }); setTimeout(function() { @@ -230,24 +232,24 @@ setTimeout(function() { expectCaught++; -var result = d.run(function () { +var result = d.run(function() { return 'return value'; }); assert.equal(result, 'return value'); // check if the executed function take in count the applied parameters -result = d.run(function (a, b) { +result = d.run(function(a, b) { return a + ' ' + b; }, 'return', 'value'); assert.equal(result, 'return value'); -var fst = fs.createReadStream('stream for nonexistent file') -d.add(fst) +var fst = fs.createReadStream('stream for nonexistent file'); +d.add(fst); expectCaught++; -[42, null, , false, function(){}, 'string'].forEach(function(something) { +[42, null, , false, function() {}, 'string'].forEach(function(something) { var d = new domain.Domain(); d.run(function() { process.nextTick(function() { diff --git a/test/parallel/test-error-reporting.js b/test/parallel/test-error-reporting.js index 9caabe0d6160e2..0b5c7652871138 100644 --- a/test/parallel/test-error-reporting.js +++ b/test/parallel/test-error-reporting.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; diff --git a/test/parallel/test-eval-require.js b/test/parallel/test-eval-require.js index eeaa624b396ab7..f966b5a98c80ba 100644 --- a/test/parallel/test-eval-require.js +++ b/test/parallel/test-eval-require.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-eval.js b/test/parallel/test-eval.js index e504ceca12678c..d3a83fbd5a7060 100644 --- a/test/parallel/test-eval.js +++ b/test/parallel/test-eval.js @@ -1,3 +1,4 @@ +'use strict'; require('../common'); var util = require('util'); var assert = require('assert'); diff --git a/test/parallel/test-event-emitter-add-listeners.js b/test/parallel/test-event-emitter-add-listeners.js index 7cc302e0b81695..cc30fd24add340 100644 --- a/test/parallel/test-event-emitter-add-listeners.js +++ b/test/parallel/test-event-emitter-add-listeners.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); @@ -53,7 +54,7 @@ process.on('exit', function() { var listen1 = function listen1() {}; var listen2 = function listen2() {}; -var e1 = new events.EventEmitter; +var e1 = new events.EventEmitter(); e1.once('newListener', function() { assert.deepEqual(e1.listeners('hello'), []); e1.once('newListener', function() { diff --git a/test/parallel/test-event-emitter-check-listener-leaks.js b/test/parallel/test-event-emitter-check-listener-leaks.js index 25e53d2c6a188f..90f686b5422c43 100644 --- a/test/parallel/test-event-emitter-check-listener-leaks.js +++ b/test/parallel/test-event-emitter-check-listener-leaks.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); diff --git a/test/parallel/test-event-emitter-errors.js b/test/parallel/test-event-emitter-errors.js index 5ee2c87052bf0e..49203961ac8d9a 100644 --- a/test/parallel/test-event-emitter-errors.js +++ b/test/parallel/test-event-emitter-errors.js @@ -1,3 +1,4 @@ +'use strict'; var EventEmitter = require('events'); var assert = require('assert'); diff --git a/test/parallel/test-event-emitter-get-max-listeners.js b/test/parallel/test-event-emitter-get-max-listeners.js index f221fa86fbc975..ba584c9dde2b18 100644 --- a/test/parallel/test-event-emitter-get-max-listeners.js +++ b/test/parallel/test-event-emitter-get-max-listeners.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var EventEmitter = require('events'); diff --git a/test/parallel/test-event-emitter-listeners-side-effects.js b/test/parallel/test-event-emitter-listeners-side-effects.js index 46eedf812d2b0e..de541c535ef0ed 100644 --- a/test/parallel/test-event-emitter-listeners-side-effects.js +++ b/test/parallel/test-event-emitter-listeners-side-effects.js @@ -1,3 +1,4 @@ +'use strict'; // USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); @@ -7,7 +8,7 @@ var events = require('events'); var EventEmitter = require('events').EventEmitter; var assert = require('assert'); -var e = new EventEmitter; +var e = new EventEmitter(); var fl; // foo listeners fl = e.listeners('foo'); diff --git a/test/parallel/test-event-emitter-listeners.js b/test/parallel/test-event-emitter-listeners.js index 6baad62968f549..be6b83856249b4 100644 --- a/test/parallel/test-event-emitter-listeners.js +++ b/test/parallel/test-event-emitter-listeners.js @@ -1,3 +1,4 @@ +'use strict'; // USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); diff --git a/test/parallel/test-event-emitter-max-listeners.js b/test/parallel/test-event-emitter-max-listeners.js index cea5fbf022ea2c..5e754698d0a018 100644 --- a/test/parallel/test-event-emitter-max-listeners.js +++ b/test/parallel/test-event-emitter-max-listeners.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); @@ -26,7 +27,7 @@ assert.throws(function() { }); assert.throws(function() { - e.setMaxListeners("and even this"); + e.setMaxListeners('and even this'); }); e.emit('maxListeners'); diff --git a/test/parallel/test-event-emitter-method-names.js b/test/parallel/test-event-emitter-method-names.js index 27061df4e4a66d..a260aa779855aa 100644 --- a/test/parallel/test-event-emitter-method-names.js +++ b/test/parallel/test-event-emitter-method-names.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); diff --git a/test/parallel/test-event-emitter-modify-in-emit.js b/test/parallel/test-event-emitter-modify-in-emit.js index 3b05a88a3e00a6..85845cc4443b32 100644 --- a/test/parallel/test-event-emitter-modify-in-emit.js +++ b/test/parallel/test-event-emitter-modify-in-emit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); diff --git a/test/parallel/test-event-emitter-no-error-provided-to-error-event.js b/test/parallel/test-event-emitter-no-error-provided-to-error-event.js index 5c50c32d489b24..e85361475f894e 100644 --- a/test/parallel/test-event-emitter-no-error-provided-to-error-event.js +++ b/test/parallel/test-event-emitter-no-error-provided-to-error-event.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); @@ -9,13 +10,13 @@ var e = new events.EventEmitter(); var d = domain.create(); d.add(e); -d.on('error', function (er) { +d.on('error', function(er) { assert(er instanceof Error, 'error created'); errorCatched = true; }); e.emit('error'); -process.on('exit', function () { +process.on('exit', function() { assert(errorCatched, 'error got caught'); }); diff --git a/test/parallel/test-event-emitter-num-args.js b/test/parallel/test-event-emitter-num-args.js index 20c003f3303a35..522fb2e2175d81 100644 --- a/test/parallel/test-event-emitter-num-args.js +++ b/test/parallel/test-event-emitter-num-args.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); diff --git a/test/parallel/test-event-emitter-once.js b/test/parallel/test-event-emitter-once.js index c5cd007ea265da..1085e7942a59bf 100644 --- a/test/parallel/test-event-emitter-once.js +++ b/test/parallel/test-event-emitter-once.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); @@ -29,12 +30,12 @@ process.on('exit', function() { var times_recurse_emitted = 0; e.once('e', function() { - e.emit('e'); - times_recurse_emitted++; + e.emit('e'); + times_recurse_emitted++; }); e.once('e', function() { - times_recurse_emitted++; + times_recurse_emitted++; }); e.emit('e'); diff --git a/test/parallel/test-event-emitter-remove-all-listeners.js b/test/parallel/test-event-emitter-remove-all-listeners.js index 8c6d68ec5fa2ee..54dedfa1362d29 100644 --- a/test/parallel/test-event-emitter-remove-all-listeners.js +++ b/test/parallel/test-event-emitter-remove-all-listeners.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); @@ -9,7 +10,7 @@ function expect(expected) { assert.deepEqual(actual.sort(), expected.sort()); }); function listener(name) { - actual.push(name) + actual.push(name); } return common.mustCall(listener, expected.length); } @@ -63,9 +64,9 @@ var expectLength = 2; e4.on('removeListener', function(name, listener) { assert.equal(expectLength--, this.listeners('baz').length); }); -e4.on('baz', function(){}); -e4.on('baz', function(){}); -e4.on('baz', function(){}); -assert.equal(e4.listeners('baz').length, expectLength+1); +e4.on('baz', function() {}); +e4.on('baz', function() {}); +e4.on('baz', function() {}); +assert.equal(e4.listeners('baz').length, expectLength + 1); e4.removeAllListeners('baz'); assert.equal(e4.listeners('baz').length, 0); diff --git a/test/parallel/test-event-emitter-remove-listeners.js b/test/parallel/test-event-emitter-remove-listeners.js index 5d8acafc063d09..409ccbebe25b86 100644 --- a/test/parallel/test-event-emitter-remove-listeners.js +++ b/test/parallel/test-event-emitter-remove-listeners.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); diff --git a/test/parallel/test-event-emitter-set-max-listeners-side-effects.js b/test/parallel/test-event-emitter-set-max-listeners-side-effects.js index d4842c395ee062..f09f130ab489ed 100644 --- a/test/parallel/test-event-emitter-set-max-listeners-side-effects.js +++ b/test/parallel/test-event-emitter-set-max-listeners-side-effects.js @@ -1,8 +1,9 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var events = require('events'); -var e = new events.EventEmitter; +var e = new events.EventEmitter(); assert.deepEqual(e._events, {}); e.setMaxListeners(5); diff --git a/test/parallel/test-event-emitter-subclass.js b/test/parallel/test-event-emitter-subclass.js index d4be78481238ba..327738271184b0 100644 --- a/test/parallel/test-event-emitter-subclass.js +++ b/test/parallel/test-event-emitter-subclass.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var EventEmitter = require('events').EventEmitter; @@ -43,6 +44,6 @@ MyEE2.prototype = new EventEmitter(); var ee1 = new MyEE2(); var ee2 = new MyEE2(); -ee1.on('x', function () {}); +ee1.on('x', function() {}); assert.equal(EventEmitter.listenerCount(ee2, 'x'), 0); diff --git a/test/parallel/test-exception-handler.js b/test/parallel/test-exception-handler.js index 4a781a0a9cd074..9cc8106ea6f80a 100644 --- a/test/parallel/test-exception-handler.js +++ b/test/parallel/test-exception-handler.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-exception-handler2.js b/test/parallel/test-exception-handler2.js index 77f3eb1d5cfd77..58e84ad21ba4ee 100644 --- a/test/parallel/test-exception-handler2.js +++ b/test/parallel/test-exception-handler2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-exec-max-buffer.js b/test/parallel/test-exec-max-buffer.js index a5a24eabeae7cb..5cae35b69f95d5 100644 --- a/test/parallel/test-exec-max-buffer.js +++ b/test/parallel/test-exec-max-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var exec = require('child_process').exec; var assert = require('assert'); diff --git a/test/parallel/test-file-read-noexist.js b/test/parallel/test-file-read-noexist.js index ad8dd5dc664921..47c8d256e3ba18 100644 --- a/test/parallel/test-file-read-noexist.js +++ b/test/parallel/test-file-read-noexist.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-file-write-stream.js b/test/parallel/test-file-write-stream.js index 9f0d66a84f722e..7882d2370d99c9 100644 --- a/test/parallel/test-file-write-stream.js +++ b/test/parallel/test-file-write-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js index 049d7d25e1c029..2563b1a300f526 100644 --- a/test/parallel/test-file-write-stream2.js +++ b/test/parallel/test-file-write-stream2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js index 2acb7053042c87..7223bd43f5230b 100644 --- a/test/parallel/test-file-write-stream3.js +++ b/test/parallel/test-file-write-stream3.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js index 1c9773867ca706..6ad28612e9bb1b 100644 --- a/test/parallel/test-fs-access.js +++ b/test/parallel/test-fs-access.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -20,8 +21,8 @@ var createFileWithPerms = function(file, mode) { fs.chmodSync(file, mode); }; -createFileWithPerms(readOnlyFile, 0444); -createFileWithPerms(readWriteFile, 0666); +createFileWithPerms(readOnlyFile, 0o444); +createFileWithPerms(readWriteFile, 0o666); /* * On non-Windows supported platforms, fs.access(readOnlyFile, W_OK, ...) @@ -112,7 +113,7 @@ assert.doesNotThrow(function() { assert.throws(function() { fs.accessSync(doesNotExist); -}, function (err) { +}, function(err) { return err.code === 'ENOENT' && err.path === doesNotExist; }); diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index 72cfdf75e23b27..5a38014399dd5f 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var join = require('path').join; @@ -55,13 +56,13 @@ var filename4 = join(common.tmpDir, 'append-sync4.txt'); fs.writeFileSync(filename4, currentFileData, { mode: m }); common.error('appending to ' + filename4); -var m = 0600; +var m = 0o600; fs.appendFileSync(filename4, num, { mode: m }); // windows permissions aren't unix if (process.platform !== 'win32') { var st = fs.statSync(filename4); - assert.equal(st.mode & 0700, m); + assert.equal(st.mode & 0o700, m); } var fileData4 = fs.readFileSync(filename4); diff --git a/test/parallel/test-fs-append-file.js b/test/parallel/test-fs-append-file.js index ba2d34e5a1f0a6..4cd75ccacc60d8 100644 --- a/test/parallel/test-fs-append-file.js +++ b/test/parallel/test-fs-append-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -80,7 +81,7 @@ fs.writeFileSync(filename4, currentFileData); common.error('appending to ' + filename4); -var m = 0600; +var m = 0o600; fs.appendFile(filename4, n, { mode: m }, function(e) { if (e) throw e; @@ -90,7 +91,7 @@ fs.appendFile(filename4, n, { mode: m }, function(e) { // windows permissions aren't unix if (process.platform !== 'win32') { var st = fs.statSync(filename4); - assert.equal(st.mode & 0700, m); + assert.equal(st.mode & 0o700, m); } fs.readFile(filename4, function(e, buffer) { diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js index 55056125da980d..a9d694adeccc01 100644 --- a/test/parallel/test-fs-chmod.js +++ b/test/parallel/test-fs-chmod.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -44,11 +45,11 @@ function closeSync() { // On Windows chmod is only able to manipulate read-only bit if (is_windows) { - mode_async = 0400; // read-only - mode_sync = 0600; // read-write + mode_async = 0o400; // read-only + mode_sync = 0o600; // read-write } else { - mode_async = 0777; - mode_sync = 0644; + mode_async = 0o777; + mode_sync = 0o644; } var file1 = path.join(common.fixturesDir, 'a.js'), @@ -61,16 +62,16 @@ fs.chmod(file1, mode_async.toString(8), function(err) { console.log(fs.statSync(file1).mode); if (is_windows) { - assert.ok((fs.statSync(file1).mode & 0777) & mode_async); + assert.ok((fs.statSync(file1).mode & 0o777) & mode_async); } else { - assert.equal(mode_async, fs.statSync(file1).mode & 0777); + assert.equal(mode_async, fs.statSync(file1).mode & 0o777); } fs.chmodSync(file1, mode_sync); if (is_windows) { - assert.ok((fs.statSync(file1).mode & 0777) & mode_sync); + assert.ok((fs.statSync(file1).mode & 0o777) & mode_sync); } else { - assert.equal(mode_sync, fs.statSync(file1).mode & 0777); + assert.equal(mode_sync, fs.statSync(file1).mode & 0o777); } success_count++; } @@ -89,16 +90,16 @@ fs.open(file2, 'a', function(err, fd) { console.log(fs.fstatSync(fd).mode); if (is_windows) { - assert.ok((fs.fstatSync(fd).mode & 0777) & mode_async); + assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async); } else { - assert.equal(mode_async, fs.fstatSync(fd).mode & 0777); + assert.equal(mode_async, fs.fstatSync(fd).mode & 0o777); } fs.fchmodSync(fd, mode_sync); if (is_windows) { - assert.ok((fs.fstatSync(fd).mode & 0777) & mode_sync); + assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_sync); } else { - assert.equal(mode_sync, fs.fstatSync(fd).mode & 0777); + assert.equal(mode_sync, fs.fstatSync(fd).mode & 0o777); } success_count++; fs.close(fd); @@ -120,10 +121,10 @@ if (fs.lchmod) { got_error = true; } else { console.log(fs.lstatSync(link).mode); - assert.equal(mode_async, fs.lstatSync(link).mode & 0777); + assert.equal(mode_async, fs.lstatSync(link).mode & 0o777); fs.lchmodSync(link, mode_sync); - assert.equal(mode_sync, fs.lstatSync(link).mode & 0777); + assert.equal(mode_sync, fs.lstatSync(link).mode & 0o777); success_count++; } }); diff --git a/test/parallel/test-fs-empty-readStream.js b/test/parallel/test-fs-empty-readStream.js index 0c470076da7df1..0863e0cdba4ddb 100644 --- a/test/parallel/test-fs-empty-readStream.js +++ b/test/parallel/test-fs-empty-readStream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -5,43 +6,43 @@ var fs = require('fs'); var emptyFile = path.join(common.fixturesDir, 'empty.txt'); -fs.open(emptyFile, 'r', function (error, fd) { +fs.open(emptyFile, 'r', function(error, fd) { assert.ifError(error); var read = fs.createReadStream(emptyFile, { 'fd': fd }); - read.once('data', function () { + read.once('data', function() { throw new Error('data event should not emit'); }); var readEmit = false; - read.once('end', function () { + read.once('end', function() { readEmit = true; console.error('end event 1'); }); - setTimeout(function () { + setTimeout(function() { assert.equal(readEmit, true); }, common.platformTimeout(50)); }); -fs.open(emptyFile, 'r', function (error, fd) { +fs.open(emptyFile, 'r', function(error, fd) { assert.ifError(error); var read = fs.createReadStream(emptyFile, { 'fd': fd }); read.pause(); - read.once('data', function () { + read.once('data', function() { throw new Error('data event should not emit'); }); var readEmit = false; - read.once('end', function () { + read.once('end', function() { readEmit = true; console.error('end event 2'); }); - setTimeout(function () { + setTimeout(function() { assert.equal(readEmit, false); }, common.platformTimeout(50)); }); diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index e174e1c023ff21..ca0684c1d71363 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -55,7 +56,7 @@ fs.rmdir(fn, function(err) { assert.ok(0 <= err.message.indexOf(fn)); }); -fs.mkdir(existingFile, 0666, function(err) { +fs.mkdir(existingFile, 0o666, function(err) { assert.ok(0 <= err.message.indexOf(existingFile)); }); @@ -63,11 +64,11 @@ fs.rmdir(existingFile, function(err) { assert.ok(0 <= err.message.indexOf(existingFile)); }); -fs.chmod(fn, 0666, function(err) { +fs.chmod(fn, 0o666, function(err) { assert.ok(0 <= err.message.indexOf(fn)); }); -fs.open(fn, 'r', 0666, function(err) { +fs.open(fn, 'r', 0o666, function(err) { assert.ok(0 <= err.message.indexOf(fn)); }); @@ -90,7 +91,7 @@ try { try { ++expected; - fs.mkdirSync(existingFile, 0666); + fs.mkdirSync(existingFile, 0o666); } catch (err) { errors.push('mkdir'); assert.ok(0 <= err.message.indexOf(existingFile)); @@ -98,7 +99,7 @@ try { try { ++expected; - fs.chmodSync(fn, 0666); + fs.chmodSync(fn, 0o666); } catch (err) { errors.push('chmod'); assert.ok(0 <= err.message.indexOf(fn)); diff --git a/test/parallel/test-fs-exists.js b/test/parallel/test-fs-exists.js index 4eb14e1e3bc73f..fcbd729a5ed850 100644 --- a/test/parallel/test-fs-exists.js +++ b/test/parallel/test-fs-exists.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-fsync.js b/test/parallel/test-fs-fsync.js index 50c010a49a5b1b..661a73baefad77 100644 --- a/test/parallel/test-fs-fsync.js +++ b/test/parallel/test-fs-fsync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -9,7 +10,7 @@ var file = path.join(common.fixturesDir, 'a.js'); common.error('open ' + file); -fs.open(file, 'a', 0777, function(err, fd) { +fs.open(file, 'a', 0o777, function(err, fd) { common.error('fd ' + fd); if (err) throw err; diff --git a/test/parallel/test-fs-long-path.js b/test/parallel/test-fs-long-path.js index ae8a5669f8193e..158ba04f49df08 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-fs-make-callback.js b/test/parallel/test-fs-make-callback.js index 91990015b8220c..a15a16404df003 100644 --- a/test/parallel/test-fs-make-callback.js +++ b/test/parallel/test-fs-make-callback.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index b8a688adc4c736..b5451d20576aac 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-null-bytes.js b/test/parallel/test-fs-null-bytes.js index 4d1dcb3972a7ba..77228521e6fc9d 100644 --- a/test/parallel/test-fs-null-bytes.js +++ b/test/parallel/test-fs-null-bytes.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js index bf4619d19d4f33..c7d53117d587fc 100644 --- a/test/parallel/test-fs-open-flags.js +++ b/test/parallel/test-fs-open-flags.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-fs-open.js b/test/parallel/test-fs-open.js index ea099d2e14c89f..59b605841b4440 100644 --- a/test/parallel/test-fs-open.js +++ b/test/parallel/test-fs-open.js @@ -1,3 +1,4 @@ +'use strict'; var constants = require('constants'); var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-fs-read-buffer.js b/test/parallel/test-fs-read-buffer.js index 0dc7a851da3c73..57a28d477c6575 100644 --- a/test/parallel/test-fs-read-buffer.js +++ b/test/parallel/test-fs-read-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'), diff --git a/test/parallel/test-fs-read-file-sync-hostname.js b/test/parallel/test-fs-read-file-sync-hostname.js index a2c8ac5da7ce61..c5c5264c0dde3b 100644 --- a/test/parallel/test-fs-read-file-sync-hostname.js +++ b/test/parallel/test-fs-read-file-sync-hostname.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-read-file-sync.js b/test/parallel/test-fs-read-file-sync.js index cf6ab72dbf5b77..d34bf7748cea89 100644 --- a/test/parallel/test-fs-read-file-sync.js +++ b/test/parallel/test-fs-read-file-sync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-read-stream-err.js b/test/parallel/test-fs-read-stream-err.js index a3d1457e610f7b..1eb6aa57906b05 100644 --- a/test/parallel/test-fs-read-stream-err.js +++ b/test/parallel/test-fs-read-stream-err.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-read-stream-fd-leak.js b/test/parallel/test-fs-read-stream-fd-leak.js index abd954506b19d4..ddbccda1b8bea3 100644 --- a/test/parallel/test-fs-read-stream-fd-leak.js +++ b/test/parallel/test-fs-read-stream-fd-leak.js @@ -1,3 +1,4 @@ +'use strict'; // Copyright io.js contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -34,12 +35,12 @@ var emptyTxt = path.join(common.fixturesDir, 'empty.txt'); fs.open = function() { openCount++; return _fsopen.apply(null, arguments); -} +}; fs.close = function() { openCount--; return _fsclose.apply(null, arguments); -} +}; function testLeak(endFn, callback) { console.log('testing for leaks from fs.createReadStream().%s()...', endFn); @@ -53,7 +54,8 @@ function testLeak(endFn, callback) { if (++i === loopCount) { clearTimeout(this); setTimeout(function() { - assert.equal(0, openCount, 'no leaked file descriptors using ' + endFn + '() (got ' + openCount + ')'); + assert.equal(0, openCount, 'no leaked file descriptors using ' + + endFn + '() (got ' + openCount + ')'); openCount = 0; callback && setTimeout(callback, 100); }, 100); diff --git a/test/parallel/test-fs-read-stream-fd.js b/test/parallel/test-fs-read-stream-fd.js index f57499ca397660..450c56eb8a96b8 100644 --- a/test/parallel/test-fs-read-stream-fd.js +++ b/test/parallel/test-fs-read-stream-fd.js @@ -1,3 +1,4 @@ +'use strict'; var fs = require('fs'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-read-stream-inherit.js b/test/parallel/test-fs-read-stream-inherit.js index c8da148e0486cd..3b53578397f96e 100644 --- a/test/parallel/test-fs-read-stream-inherit.js +++ b/test/parallel/test-fs-read-stream-inherit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -80,7 +81,8 @@ process.on('exit', function() { console.error('ok'); }); -var file4 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, start: 1, end: 2})); +var file4 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, + start: 1, end: 2})); assert.equal(file4.start, 1); assert.equal(file4.end, 2); var contentRead = ''; @@ -91,7 +93,8 @@ file4.on('end', function(data) { assert.equal(contentRead, 'yz'); }); -var file5 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, start: 1})); +var file5 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, + start: 1})); assert.equal(file5.start, 1); file5.data = ''; file5.on('data', function(data) { @@ -102,7 +105,8 @@ file5.on('end', function() { }); // https://github.com/joyent/node/issues/2320 -var file6 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1.23, start: 1})); +var file6 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1.23, + start: 1})); assert.equal(file6.start, 1); file6.data = ''; file6.on('data', function(data) { @@ -116,7 +120,8 @@ assert.throws(function() { fs.createReadStream(rangeFile, Object.create({start: 10, end: 2})); }, /start must be <= end/); -var stream = fs.createReadStream(rangeFile, Object.create({ start: 0, end: 0 })); +var stream = fs.createReadStream(rangeFile, Object.create({ start: 0, + end: 0 })); assert.equal(stream.start, 0); assert.equal(stream.end, 0); stream.data = ''; @@ -145,7 +150,7 @@ file7.on('end', function() { }); }); -function file7Next(){ +function file7Next() { // This will tell us if the fd is usable again or not. file7 = fs.createReadStream(null, Object.create({fd: file7.fd, start: 0 })); file7.data = ''; @@ -158,7 +163,8 @@ function file7Next(){ } // Just to make sure autoClose won't close the stream because of error. -var file8 = fs.createReadStream(null, Object.create({fd: 13337, autoClose: false })); +var file8 = fs.createReadStream(null, Object.create({fd: 13337, + autoClose: false })); file8.on('data', function() {}); file8.on('error', common.mustCall(function() {})); diff --git a/test/parallel/test-fs-read-stream-resume.js b/test/parallel/test-fs-read-stream-resume.js index c3c61c88cb1f64..9a2e2ee76f78bc 100644 --- a/test/parallel/test-fs-read-stream-resume.js +++ b/test/parallel/test-fs-read-stream-resume.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js index 85032d49640cdd..490ae0866d9aa0 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -138,7 +139,7 @@ file7.on('end', function() { }); }); -function file7Next(){ +function file7Next() { // This will tell us if the fd is usable again or not. file7 = fs.createReadStream(null, {fd: file7.fd, start: 0 }); file7.data = ''; diff --git a/test/parallel/test-fs-read.js b/test/parallel/test-fs-read.js index 3182733d115251..8b0b6fe0a3844d 100644 --- a/test/parallel/test-fs-read.js +++ b/test/parallel/test-fs-read.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'), diff --git a/test/parallel/test-fs-readfile-empty.js b/test/parallel/test-fs-readfile-empty.js index bf7da45fca93cc..2669ce1ad6b121 100644 --- a/test/parallel/test-fs-readfile-empty.js +++ b/test/parallel/test-fs-readfile-empty.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index bfe79ab80edb63..6d86ba1a7ec0f1 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index 3502cdd5f48778..b25073061002a1 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index da0cd2952fdb05..b55bfb6a22ccd2 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-fs-readfile-unlink.js b/test/parallel/test-fs-readfile-unlink.js index bdcf23380e4775..15491b71c433ed 100644 --- a/test/parallel/test-fs-readfile-unlink.js +++ b/test/parallel/test-fs-readfile-unlink.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'), common = require('../common'), fs = require('fs'), diff --git a/test/parallel/test-fs-readfile-zero-byte-liar.js b/test/parallel/test-fs-readfile-zero-byte-liar.js index 532459305c5d91..2c9c6e3db9a584 100644 --- a/test/parallel/test-fs-readfile-zero-byte-liar.js +++ b/test/parallel/test-fs-readfile-zero-byte-liar.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -26,12 +27,12 @@ var d = fs.readFileSync(__filename, 'utf8'); assert.equal(d, dataExpected); var called = false; -fs.readFile(__filename, 'utf8', function (er, d) { +fs.readFile(__filename, 'utf8', function(er, d) { assert.equal(d, dataExpected); called = true; }); process.on('exit', function() { assert(called); - console.log("ok"); + console.log('ok'); }); diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index e62d541a68053c..78dbc31bea9911 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index f8299d8d05662b..f0f6d4499c49e0 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -38,7 +39,7 @@ function tmp(p) { var fixturesAbsDir = common.fixturesDir; var tmpAbsDir = common.tmpDir; -console.error("absolutes\n%s\n%s", fixturesAbsDir, tmpAbsDir); +console.error('absolutes\n%s\n%s', fixturesAbsDir, tmpAbsDir); function asynctest(testBlock, args, callback, assertBlock) { async_expected++; @@ -235,7 +236,7 @@ function test_cyclic_link_overprotection(callback) { var link = folder + '/cycles'; var testPath = cycles; for (var i = 0; i < 10; i++) testPath += '/folder/cycles'; - try {fs.unlinkSync(link)} catch (ex) {} + try {fs.unlinkSync(link);} catch (ex) {} fs.symlinkSync(cycles, link, 'dir'); unlink.push(link); assert.equal(fs.realpathSync(testPath), path.resolve(expected)); @@ -311,7 +312,7 @@ function test_deep_symlink_mix(callback) { var entry = tmp('node-test-realpath-f1'); try { fs.unlinkSync(tmp('node-test-realpath-d2/foo')); } catch (e) {} try { fs.rmdirSync(tmp('node-test-realpath-d2')); } catch (e) {} - fs.mkdirSync(tmp('node-test-realpath-d2'), 0700); + fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700); try { [ [entry, '../' + common.tmpDirName + '/node-test-realpath-d1/foo'], @@ -369,12 +370,14 @@ function test_escape_cwd(cb) { console.log('test_escape_cwd'); asynctest(fs.realpath, ['..'], cb, function(er, uponeActual) { assert.equal(upone, uponeActual, - 'realpath("..") expected: ' + path.resolve(upone) + ' actual:' + uponeActual); + 'realpath("..") expected: ' + path.resolve(upone) + + ' actual:' + uponeActual); }); } var uponeActual = fs.realpathSync('..'); assert.equal(upone, uponeActual, - 'realpathSync("..") expected: ' + path.resolve(upone) + ' actual:' + uponeActual); + 'realpathSync("..") expected: ' + path.resolve(upone) + + ' actual:' + uponeActual); // going up with .. multiple times @@ -394,15 +397,15 @@ function test_up_multiple(cb) { ['a/b', 'a' ].forEach(function(folder) { - try {fs.rmdirSync(tmp(folder))} catch (ex) {} + try {fs.rmdirSync(tmp(folder));} catch (ex) {} }); } function setup() { cleanup(); } setup(); - fs.mkdirSync(tmp('a'), 0755); - fs.mkdirSync(tmp('a/b'), 0755); + fs.mkdirSync(tmp('a'), 0o755); + fs.mkdirSync(tmp('a/b'), 0o755); fs.symlinkSync('..', tmp('a/d'), 'dir'); unlink.push(tmp('a/d')); fs.symlinkSync('..', tmp('a/b/e'), 'dir'); @@ -416,10 +419,10 @@ function test_up_multiple(cb) { assert.equal(fs.realpathSync(abedabeda), abedabeda_real); assert.equal(fs.realpathSync(abedabed), abedabed_real); - fs.realpath(abedabeda, function (er, real) { + fs.realpath(abedabeda, function(er, real) { if (er) throw er; assert.equal(abedabeda_real, real); - fs.realpath(abedabed, function (er, real) { + fs.realpath(abedabed, function(er, real) { if (er) throw er; assert.equal(abedabed_real, real); cb(); @@ -451,14 +454,14 @@ function test_abs_with_kids(cb) { ['/a/b/c/x.txt', '/a/link' ].forEach(function(file) { - try {fs.unlinkSync(root + file)} catch (ex) {} + try {fs.unlinkSync(root + file);} catch (ex) {} }); ['/a/b/c', '/a/b', '/a', '' ].forEach(function(folder) { - try {fs.rmdirSync(root + folder)} catch (ex) {} + try {fs.rmdirSync(root + folder);} catch (ex) {} }); } function setup() { @@ -469,7 +472,7 @@ function test_abs_with_kids(cb) { '/a/b/c' ].forEach(function(folder) { console.log('mkdir ' + root + folder); - fs.mkdirSync(root + folder, 0700); + fs.mkdirSync(root + folder, 0o700); }); fs.writeFileSync(root + '/a/b/c/x.txt', 'foo'); fs.symlinkSync(root + '/a/b', root + '/a/link', type); @@ -575,7 +578,7 @@ function runTest() { var s; try { s = fs.statSync(t); } catch (ex) {} if (s) return; - fs.mkdirSync(t, 0700); + fs.mkdirSync(t, 0o700); }); fs.writeFileSync(tmp('cycles/root.js'), "console.error('roooot!');"); console.error('start tests'); diff --git a/test/parallel/test-fs-sir-writes-alot.js b/test/parallel/test-fs-sir-writes-alot.js index 9df95a77bdfedd..537e94b0acaa3d 100644 --- a/test/parallel/test-fs-sir-writes-alot.js +++ b/test/parallel/test-fs-sir-writes-alot.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var fs = require('fs'); var assert = require('assert'); diff --git a/test/parallel/test-fs-stat.js b/test/parallel/test-fs-stat.js index 88a965974d05ce..123d6608b4bb4f 100644 --- a/test/parallel/test-fs-stat.js +++ b/test/parallel/test-fs-stat.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-stream-double-close.js b/test/parallel/test-fs-stream-double-close.js index 5d772da4aac887..47d129c042b4ad 100644 --- a/test/parallel/test-fs-stream-double-close.js +++ b/test/parallel/test-fs-stream-double-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-symlink-dir-junction-relative.js b/test/parallel/test-fs-symlink-dir-junction-relative.js index 5e4ce38b916393..6bf9e3f5b2d14b 100644 --- a/test/parallel/test-fs-symlink-dir-junction-relative.js +++ b/test/parallel/test-fs-symlink-dir-junction-relative.js @@ -1,3 +1,4 @@ +'use strict'; // Test creating and resolving relative junction or symbolic link var common = require('../common'); diff --git a/test/parallel/test-fs-symlink-dir-junction.js b/test/parallel/test-fs-symlink-dir-junction.js index 27d3e5103d9124..84d6c066213f28 100644 --- a/test/parallel/test-fs-symlink-dir-junction.js +++ b/test/parallel/test-fs-symlink-dir-junction.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-symlink.js b/test/parallel/test-fs-symlink.js index 533f22672da001..e7faef930e4817 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-sync-fd-leak.js b/test/parallel/test-fs-sync-fd-leak.js index ab851b1a16f333..5f2b63125a1d0f 100644 --- a/test/parallel/test-fs-sync-fd-leak.js +++ b/test/parallel/test-fs-sync-fd-leak.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-truncate-GH-6233.js b/test/parallel/test-fs-truncate-GH-6233.js index 72dfa136916f87..866315434a0120 100644 --- a/test/parallel/test-fs-truncate-GH-6233.js +++ b/test/parallel/test-fs-truncate-GH-6233.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-truncate-fd.js b/test/parallel/test-fs-truncate-fd.js index 6e9628db867371..ed3aedaee8c805 100644 --- a/test/parallel/test-fs-truncate-fd.js +++ b/test/parallel/test-fs-truncate-fd.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-truncate.js b/test/parallel/test-fs-truncate.js index 7f1dcd0661e3f9..df353f630eb370 100644 --- a/test/parallel/test-fs-truncate.js +++ b/test/parallel/test-fs-truncate.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index e877b3dfdc56d5..863d66d89e424b 100644 --- a/test/parallel/test-fs-utimes.js +++ b/test/parallel/test-fs-utimes.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); diff --git a/test/parallel/test-fs-write-buffer.js b/test/parallel/test-fs-write-buffer.js index 7dfcc6cd355215..edf33552cb3253 100644 --- a/test/parallel/test-fs-write-buffer.js +++ b/test/parallel/test-fs-write-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'), @@ -9,7 +10,7 @@ var path = require('path'), writeCalled = 0; -fs.open(filename, 'w', 0644, function(err, fd) { +fs.open(filename, 'w', 0o644, function(err, fd) { openCalled++; if (err) throw err; diff --git a/test/parallel/test-fs-write-file-buffer.js b/test/parallel/test-fs-write-file-buffer.js index bdddba9524977e..c1c263d409d173 100644 --- a/test/parallel/test-fs-write-file-buffer.js +++ b/test/parallel/test-fs-write-file-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var join = require('path').join; var util = require('util'); diff --git a/test/parallel/test-fs-write-file-sync.js b/test/parallel/test-fs-write-file-sync.js index 343d179f2a6864..579ccd907c4206 100644 --- a/test/parallel/test-fs-write-file-sync.js +++ b/test/parallel/test-fs-write-file-sync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -15,14 +16,14 @@ fs._closeSync = fs.closeSync; fs.closeSync = closeSync; // Reset the umask for testing -var mask = process.umask(0000); +var mask = process.umask(0o000); // On Windows chmod is only able to manipulate read-only bit. Test if creating // the file in read-only mode works. if (isWindows) { - mode = 0444; + mode = 0o444; } else { - mode = 0755; + mode = 0o755; } // Test writeFileSync @@ -34,7 +35,7 @@ fs.writeFileSync(file1, '123', {mode: mode}); content = fs.readFileSync(file1, {encoding: 'utf8'}); assert.equal('123', content); -assert.equal(mode, fs.statSync(file1).mode & 0777); +assert.equal(mode, fs.statSync(file1).mode & 0o777); removeFile(file1); @@ -58,7 +59,7 @@ assert.equal(0, openCount); function removeFile(file) { try { if (isWindows) - fs.chmodSync(file, 0666); + fs.chmodSync(file, 0o666); fs.unlinkSync(file); } catch (err) { if (err && err.code !== 'ENOENT') diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js index 4f43197fd6fb9f..b0c52f7a0ef5c7 100644 --- a/test/parallel/test-fs-write-file.js +++ b/test/parallel/test-fs-write-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -55,14 +56,14 @@ fs.writeFile(filename2, buf, function(e) { var filename3 = join(common.tmpDir, 'test3.txt'); common.error('writing to ' + filename3); -var m = 0600; +var m = 0o600; fs.writeFile(filename3, n, { mode: m }, function(e) { if (e) throw e; // windows permissions aren't unix if (process.platform !== 'win32') { var st = fs.statSync(filename3); - assert.equal(st.mode & 0700, m); + assert.equal(st.mode & 0o700, m); } ncallbacks++; diff --git a/test/parallel/test-fs-write-no-fd.js b/test/parallel/test-fs-write-no-fd.js index 143928e7836ea7..5b38ce6ba814c4 100644 --- a/test/parallel/test-fs-write-no-fd.js +++ b/test/parallel/test-fs-write-no-fd.js @@ -1,3 +1,4 @@ +'use strict'; const common = require('../common'); const fs = require('fs'); const assert = require('assert'); diff --git a/test/parallel/test-fs-write-stream-change-open.js b/test/parallel/test-fs-write-stream-change-open.js index ca02e3959cbbd0..43b57f5c72519e 100644 --- a/test/parallel/test-fs-write-stream-change-open.js +++ b/test/parallel/test-fs-write-stream-change-open.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -21,7 +22,7 @@ fs.close = function(fd) { assert.ok(fd, 'fs.close must not be called with an undefined fd.'); fs.close = _fs_close; fs.open = _fs_open; -} +}; stream.write('foo'); stream.end(); diff --git a/test/parallel/test-fs-write-stream-end.js b/test/parallel/test-fs-write-stream-end.js index 886df63660d15c..1a4c0a89d693a7 100644 --- a/test/parallel/test-fs-write-stream-end.js +++ b/test/parallel/test-fs-write-stream-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-write-stream-err.js b/test/parallel/test-fs-write-stream-err.js index 61d6df5d5fb57e..f3a608b62dc577 100644 --- a/test/parallel/test-fs-write-stream-err.js +++ b/test/parallel/test-fs-write-stream-err.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-fs-write-stream.js b/test/parallel/test-fs-write-stream.js index ef7822af48a365..bf78b1ee521469 100644 --- a/test/parallel/test-fs-write-stream.js +++ b/test/parallel/test-fs-write-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -13,7 +14,7 @@ var file = path.join(common.tmpDir, 'write.txt'); fs.close = function(fd) { assert.ok(fd, 'fs.close must not be called without an undefined fd.'); fs.close = _fs_close; - } + }; stream.destroy(); })(); diff --git a/test/parallel/test-fs-write-string-coerce.js b/test/parallel/test-fs-write-string-coerce.js index 1320acca2c1b4c..32f73172b76e5f 100644 --- a/test/parallel/test-fs-write-string-coerce.js +++ b/test/parallel/test-fs-write-string-coerce.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -8,7 +9,7 @@ var data = true; var expected = data + ''; var found; -fs.open(fn, 'w', 0644, function(err, fd) { +fs.open(fn, 'w', 0o644, function(err, fd) { if (err) throw err; console.log('open done'); fs.write(fd, data, 0, 'utf8', function(err, written) { diff --git a/test/parallel/test-fs-write-sync.js b/test/parallel/test-fs-write-sync.js index 59e2f90f92d6dc..2cdce58d874978 100644 --- a/test/parallel/test-fs-write-sync.js +++ b/test/parallel/test-fs-write-sync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index 49b4ec53169137..a3d4cf83f8c85e 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -9,7 +10,7 @@ var expected = 'ümlaut.'; var constants = require('constants'); var found, found2; -fs.open(fn, 'w', 0644, function(err, fd) { +fs.open(fn, 'w', 0o644, function(err, fd) { if (err) throw err; console.log('open done'); fs.write(fd, '', 0, 'utf8', function(err, written) { @@ -28,7 +29,7 @@ fs.open(fn, 'w', 0644, function(err, fd) { }); -fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0644, +fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644, function(err, fd) { if (err) throw err; console.log('open done'); diff --git a/test/parallel/test-global.js b/test/parallel/test-global.js index a1ddc72f6290eb..82d8ee054c5860 100644 --- a/test/parallel/test-global.js +++ b/test/parallel/test-global.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-handle-wrap-close-abort.js b/test/parallel/test-handle-wrap-close-abort.js index c1179f72a13946..8e2388fa84d809 100644 --- a/test/parallel/test-handle-wrap-close-abort.js +++ b/test/parallel/test-handle-wrap-close-abort.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); process.on('uncaughtException', function() { }); diff --git a/test/parallel/test-http-1.0-keep-alive.js b/test/parallel/test-http-1.0-keep-alive.js index b67b48969c81e2..eac0fe51e2206a 100644 --- a/test/parallel/test-http-1.0-keep-alive.js +++ b/test/parallel/test-http-1.0-keep-alive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -96,7 +97,7 @@ function check(tests) { var ctx = test.responses[current]; console.error('< SERVER SENDING RESPONSE', ctx); res.writeHead(200, ctx.headers); - ctx.chunks.slice(0, -1).forEach(function(chunk) { res.write(chunk) }); + ctx.chunks.slice(0, -1).forEach(function(chunk) { res.write(chunk); }); res.end(ctx.chunks[ctx.chunks.length - 1]); } diff --git a/test/parallel/test-http-1.0.js b/test/parallel/test-http-1.0.js index f1408d2f53412a..bf55c616d91996 100644 --- a/test/parallel/test-http-1.0.js +++ b/test/parallel/test-http-1.0.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-304.js b/test/parallel/test-http-304.js index a2cc95e57db60d..e206f5bb70a3e1 100644 --- a/test/parallel/test-http-304.js +++ b/test/parallel/test-http-304.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-abort-before-end.js b/test/parallel/test-http-abort-before-end.js index 351ec86c2b8b95..c0cee3886f4406 100644 --- a/test/parallel/test-http-abort-before-end.js +++ b/test/parallel/test-http-abort-before-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'); var assert = require('assert'); diff --git a/test/parallel/test-http-abort-client.js b/test/parallel/test-http-abort-client.js index 40cf64c2cb0559..e24ded11d1a7ec 100644 --- a/test/parallel/test-http-abort-client.js +++ b/test/parallel/test-http-abort-client.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'); var assert = require('assert'); @@ -38,7 +39,7 @@ server.listen(common.PORT, function() { res.socket.on('close', function() { console.log('socket closed, but not res'); - }) + }); // it would be nice if this worked: res.on('close', function() { diff --git a/test/parallel/test-http-abort-queued.js b/test/parallel/test-http-abort-queued.js index 1ef24acd509c1a..f2b0120366c374 100644 --- a/test/parallel/test-http-abort-queued.js +++ b/test/parallel/test-http-abort-queued.js @@ -1,10 +1,11 @@ +'use strict'; var assert = require('assert'), common = require('../common'), http = require('http'); var complete; -var server = http.createServer(function (req, res) { +var server = http.createServer(function(req, res) { // We should not see the queued /thatotherone request within the server // as it should be aborted before it is sent. assert.equal(req.url, '/'); @@ -12,13 +13,13 @@ var server = http.createServer(function (req, res) { res.writeHead(200); res.write('foo'); - complete = complete || function () { + complete = complete || function() { res.end(); }; }); -server.listen(common.PORT, function () { +server.listen(common.PORT, function() { console.log('listen', server.address().port); var agent = new http.Agent({maxSockets: 1}); diff --git a/test/parallel/test-http-after-connect.js b/test/parallel/test-http-after-connect.js index bff9170a217b81..19011fcbcb4fc4 100644 --- a/test/parallel/test-http-after-connect.js +++ b/test/parallel/test-http-after-connect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-agent-destroyed-socket.js b/test/parallel/test-http-agent-destroyed-socket.js index a2fe54d1dc6848..954acc998c035d 100644 --- a/test/parallel/test-http-agent-destroyed-socket.js +++ b/test/parallel/test-http-agent-destroyed-socket.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-agent-false.js b/test/parallel/test-http-agent-false.js index 95c375ac37c7d3..ad8de89f2038e9 100644 --- a/test/parallel/test-http-agent-false.js +++ b/test/parallel/test-http-agent-false.js @@ -1,10 +1,11 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); -// sending `agent: false` when `port: null` is also passed in (i.e. the result of -// a `url.parse()` call with the default port used, 80 or 443), should not result -// in an assertion error... +// sending `agent: false` when `port: null` is also passed in (i.e. the result +// of a `url.parse()` call with the default port used, 80 or 443), should not +// result in an assertion error... var opts = { host: '127.0.0.1', port: null, @@ -19,8 +20,8 @@ process.on('exit', function() { }); // we just want an "error" (no local HTTP server on port 80) or "response" -// to happen (user happens ot have HTTP server running on port 80). As long as the -// process doesn't crash from a C++ assertion then we're good. +// to happen (user happens ot have HTTP server running on port 80). +// As long as the process doesn't crash from a C++ assertion then we're good. var req = http.request(opts); req.on('response', function(res) { good = true; diff --git a/test/parallel/test-http-agent-keepalive.js b/test/parallel/test-http-agent-keepalive.js index 7dfd6f789ed921..f82af380bce1a9 100644 --- a/test/parallel/test-http-agent-keepalive.js +++ b/test/parallel/test-http-agent-keepalive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -11,14 +12,14 @@ var agent = new Agent({ maxFreeSockets: 5 }); -var server = http.createServer(function (req, res) { +var server = http.createServer(function(req, res) { if (req.url === '/error') { res.destroy(); return; } else if (req.url === '/remote_close') { // cache the socket, close it after 100ms var socket = res.connection; - setTimeout(function () { + setTimeout(function() { socket.end(); }, 100); } @@ -44,13 +45,13 @@ function checkDataAndSockets(body) { function second() { // request second, use the same socket - get('/second', function (res) { + get('/second', function(res) { assert.equal(res.statusCode, 200); res.on('data', checkDataAndSockets); - res.on('end', function () { + res.on('end', function() { assert.equal(agent.sockets[name].length, 1); assert.equal(agent.freeSockets[name], undefined); - process.nextTick(function () { + process.nextTick(function() { assert.equal(agent.sockets[name], undefined); assert.equal(agent.freeSockets[name].length, 1); remoteClose(); @@ -61,17 +62,17 @@ function second() { function remoteClose() { // mock remote server close the socket - get('/remote_close', function (res) { + get('/remote_close', function(res) { assert.deepEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); - res.on('end', function () { + res.on('end', function() { assert.equal(agent.sockets[name].length, 1); assert.equal(agent.freeSockets[name], undefined); - process.nextTick(function () { + process.nextTick(function() { assert.equal(agent.sockets[name], undefined); assert.equal(agent.freeSockets[name].length, 1); // waitting remote server close the socket - setTimeout(function () { + setTimeout(function() { assert.equal(agent.sockets[name], undefined); assert.equal(agent.freeSockets[name], undefined, 'freeSockets is not empty'); @@ -84,16 +85,16 @@ function remoteClose() { function remoteError() { // remove server will destroy ths socket - var req = get('/error', function (res) { + var req = get('/error', function(res) { throw new Error('should not call this function'); }); - req.on('error', function (err) { + req.on('error', function(err) { assert.ok(err); assert.equal(err.message, 'socket hang up'); assert.equal(agent.sockets[name].length, 1); assert.equal(agent.freeSockets[name], undefined); // Wait socket 'close' event emit - setTimeout(function () { + setTimeout(function() { assert.equal(agent.sockets[name], undefined); assert.equal(agent.freeSockets[name], undefined); done(); @@ -108,13 +109,13 @@ function done() { server.listen(common.PORT, function() { // request first, and keep alive - get('/first', function (res) { + get('/first', function(res) { assert.equal(res.statusCode, 200); res.on('data', checkDataAndSockets); - res.on('end', function () { + res.on('end', function() { assert.equal(agent.sockets[name].length, 1); assert.equal(agent.freeSockets[name], undefined); - process.nextTick(function () { + process.nextTick(function() { assert.equal(agent.sockets[name], undefined); assert.equal(agent.freeSockets[name].length, 1); second(); diff --git a/test/parallel/test-http-agent-maxsockets.js b/test/parallel/test-http-agent-maxsockets.js index 0f349eac549abf..e11aa2addad746 100644 --- a/test/parallel/test-http-agent-maxsockets.js +++ b/test/parallel/test-http-agent-maxsockets.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-agent-no-protocol.js b/test/parallel/test-http-agent-no-protocol.js index 1f910c33e53932..d5b7e5e19440f9 100644 --- a/test/parallel/test-http-agent-no-protocol.js +++ b/test/parallel/test-http-agent-no-protocol.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -21,7 +22,7 @@ var server = http.createServer(function(req, res) { opts.agent = new http.Agent(); opts.agent.protocol = null; - http.get(opts, function (res) { + http.get(opts, function(res) { response++; res.resume(); server.close(); diff --git a/test/parallel/test-http-agent-null.js b/test/parallel/test-http-agent-null.js index 397a5e0f4bbd72..e118738f664083 100644 --- a/test/parallel/test-http-agent-null.js +++ b/test/parallel/test-http-agent-null.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index a485bc996ae2d8..09ba9c34e2936d 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-allow-req-after-204-res.js b/test/parallel/test-http-allow-req-after-204-res.js index e671bec029e159..ba98138bdca568 100644 --- a/test/parallel/test-http-allow-req-after-204-res.js +++ b/test/parallel/test-http-allow-req-after-204-res.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'); var assert = require('assert'); diff --git a/test/parallel/test-http-automatic-headers.js b/test/parallel/test-http-automatic-headers.js index 76e5a61318c75d..8c454517020460 100644 --- a/test/parallel/test-http-automatic-headers.js +++ b/test/parallel/test-http-automatic-headers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-bind-twice.js b/test/parallel/test-http-bind-twice.js index 187f35ab879e4f..4dde7c6d252c6a 100644 --- a/test/parallel/test-http-bind-twice.js +++ b/test/parallel/test-http-bind-twice.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-blank-header.js b/test/parallel/test-http-blank-header.js index 1fb1e0af96bec7..00a94d0b839f42 100644 --- a/test/parallel/test-http-blank-header.js +++ b/test/parallel/test-http-blank-header.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-buffer-sanity.js b/test/parallel/test-http-buffer-sanity.js index f55d36c770f277..4b120311d7dac9 100644 --- a/test/parallel/test-http-buffer-sanity.js +++ b/test/parallel/test-http-buffer-sanity.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-byteswritten.js b/test/parallel/test-http-byteswritten.js index 00ba09143ec9c8..974f446dd436b4 100644 --- a/test/parallel/test-http-byteswritten.js +++ b/test/parallel/test-http-byteswritten.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-http-chunked-304.js b/test/parallel/test-http-chunked-304.js index 86e0b0d11d1dfd..0f979420488d60 100644 --- a/test/parallel/test-http-chunked-304.js +++ b/test/parallel/test-http-chunked-304.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-chunked.js b/test/parallel/test-http-chunked.js index b666e051cc07b1..74b6943ab41f41 100644 --- a/test/parallel/test-http-chunked.js +++ b/test/parallel/test-http-chunked.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -24,7 +25,7 @@ server.listen(common.PORT, function() { port: common.PORT }, function(x) { x.setEncoding('utf8'); - x.on('data', function(c) {data += c}); + x.on('data', function(c) {data += c;}); x.on('error', function(e) { throw e; }); @@ -36,7 +37,7 @@ server.listen(common.PORT, function() { server.close(); }); }); - get.on('error', function(e) {throw e}); + get.on('error', function(e) {throw e;}); get.end(); }); diff --git a/test/parallel/test-http-client-abort-event.js b/test/parallel/test-http-client-abort-event.js index 1549d06101a647..b428038028ad8e 100644 --- a/test/parallel/test-http-client-abort-event.js +++ b/test/parallel/test-http-client-abort-event.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var http = require('http'); var common = require('../common'); @@ -25,4 +26,4 @@ server.listen(common.PORT, function() { process.on('exit', function() { assert.equal(count, 1); -}) +}); diff --git a/test/parallel/test-http-client-abort.js b/test/parallel/test-http-client-abort.js index 1359df5a6c4b3d..c3353bb72201b6 100644 --- a/test/parallel/test-http-client-abort.js +++ b/test/parallel/test-http-client-abort.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-abort2.js b/test/parallel/test-http-client-abort2.js index c7c19acccf3ea5..3f7ae98fa25820 100644 --- a/test/parallel/test-http-client-abort2.js +++ b/test/parallel/test-http-client-abort2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js index e97a14720f4a0f..afe98902e5b6fc 100644 --- a/test/parallel/test-http-client-agent.js +++ b/test/parallel/test-http-client-agent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-default-headers-exist.js b/test/parallel/test-http-client-default-headers-exist.js index 02175384970de1..94106285beca97 100644 --- a/test/parallel/test-http-client-default-headers-exist.js +++ b/test/parallel/test-http-client-default-headers-exist.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-encoding.js b/test/parallel/test-http-client-encoding.js index a93b33620fe934..dd696f4dff608a 100644 --- a/test/parallel/test-http-client-encoding.js +++ b/test/parallel/test-http-client-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-client-get-url.js b/test/parallel/test-http-client-get-url.js index 03fa3331e95160..1dd23143e46c68 100644 --- a/test/parallel/test-http-client-get-url.js +++ b/test/parallel/test-http-client-get-url.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-parse-error.js b/test/parallel/test-http-client-parse-error.js index 38f2628741dd93..43f85853b3bbeb 100644 --- a/test/parallel/test-http-client-parse-error.js +++ b/test/parallel/test-http-client-parse-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-client-pipe-end.js b/test/parallel/test-http-client-pipe-end.js index 6f05d3093123b5..d794aae446c4fa 100644 --- a/test/parallel/test-http-client-pipe-end.js +++ b/test/parallel/test-http-client-pipe-end.js @@ -1,3 +1,4 @@ +'use strict'; // see https://github.com/joyent/node/issues/3257 var common = require('../common'); @@ -23,7 +24,7 @@ server.listen(common.PIPE, function() { req.write('.'); - sched(function() { req.end() }, 5); + sched(function() { req.end(); }, 5); }); // schedule a callback after `ticks` event loop ticks diff --git a/test/parallel/test-http-client-race-2.js b/test/parallel/test-http-client-race-2.js index fabb2c50a86984..0a98e06c7bf062 100644 --- a/test/parallel/test-http-client-race-2.js +++ b/test/parallel/test-http-client-race-2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -79,7 +80,7 @@ server.on('listening', function() { req3.end(); req3.on('response', function(res3) { res3.setEncoding('utf8'); - res3.on('data', function(chunk) { body3 += chunk }); + res3.on('data', function(chunk) { body3 += chunk; }); res3.on('end', function() { server.close(); }); }); }); diff --git a/test/parallel/test-http-client-race.js b/test/parallel/test-http-client-race.js index c284fbae773e68..11dcb7ae4ca89e 100644 --- a/test/parallel/test-http-client-race.js +++ b/test/parallel/test-http-client-race.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-read-in-error.js b/test/parallel/test-http-client-read-in-error.js index 6568d7e28d0223..8d74aecb51b91c 100644 --- a/test/parallel/test-http-client-read-in-error.js +++ b/test/parallel/test-http-client-read-in-error.js @@ -1,3 +1,4 @@ +'use strict'; var net = require('net'); var http = require('http'); var util = require('util'); diff --git a/test/parallel/test-http-client-readable.js b/test/parallel/test-http-client-readable.js index e690ba7ba5afc8..ba9fdd658c3864 100644 --- a/test/parallel/test-http-client-readable.js +++ b/test/parallel/test-http-client-readable.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-response-domain.js b/test/parallel/test-http-client-response-domain.js index 1c38a1a254eaf4..1637882a3c251d 100644 --- a/test/parallel/test-http-client-response-domain.js +++ b/test/parallel/test-http-client-response-domain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), http = require('http'), diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index a928b12090e704..809742f5628df5 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -23,35 +24,35 @@ var server = http.createServer(function(req, res) { res.write(reqid.toString()); res.end(); } - request_number+=1; + request_number += 1; }); server.listen(options.port, options.host, function() { var req; - for (requests_sent = 0; requests_sent < 30; requests_sent+=1) { + for (requests_sent = 0; requests_sent < 30; requests_sent += 1) { options.path = '/' + requests_sent; req = http.request(options); req.id = requests_sent; req.on('response', function(res) { res.on('data', function(data) { - console.log('res#'+this.req.id+' data:'+data); + console.log('res#' + this.req.id + ' data:' + data); }); res.on('end', function(data) { - console.log('res#'+this.req.id+' end'); + console.log('res#' + this.req.id + ' end'); requests_done += 1; }); }); req.on('close', function() { - console.log('req#'+this.id+' close'); + console.log('req#' + this.id + ' close'); }); req.on('error', function() { - console.log('req#'+this.id+' error'); + console.log('req#' + this.id + ' error'); this.destroy(); }); - req.setTimeout(50, function () { + req.setTimeout(50, function() { var req = this; - console.log('req#'+this.id + ' timeout'); + console.log('req#' + this.id + ' timeout'); req.abort(); requests_done += 1; }); @@ -71,5 +72,6 @@ server.listen(options.port, options.host, function() { process.on('exit', function() { console.error('done=%j sent=%j', requests_done, requests_sent); - assert.ok(requests_done == requests_sent, 'timeout on http request called too much'); + assert.ok(requests_done == requests_sent, + 'timeout on http request called too much'); }); diff --git a/test/parallel/test-http-client-timeout-event.js b/test/parallel/test-http-client-timeout-event.js index c975d69d399745..c9d65941923408 100644 --- a/test/parallel/test-http-client-timeout-event.js +++ b/test/parallel/test-http-client-timeout-event.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -26,14 +27,14 @@ server.listen(options.port, options.host, function() { var timeout_events = 0; req.setTimeout(1); - req.on('timeout', function () { + req.on('timeout', function() { timeout_events += 1; }); - setTimeout(function () { + setTimeout(function() { req.destroy(); assert.equal(timeout_events, 1); }, 100); - setTimeout(function () { + setTimeout(function() { req.end(); }, 50); }); diff --git a/test/parallel/test-http-client-timeout-with-data.js b/test/parallel/test-http-client-timeout-with-data.js index accf8c1341b86c..0aefe62ef45055 100644 --- a/test/parallel/test-http-client-timeout-with-data.js +++ b/test/parallel/test-http-client-timeout-with-data.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -20,7 +21,7 @@ var options = { var server = http.createServer(function(req, res) { res.writeHead(200, {'Content-Length':'2'}); res.write('*'); - setTimeout(function() { res.end('*') }, 100); + setTimeout(function() { res.end('*'); }, 100); }); server.listen(options.port, options.host, function() { diff --git a/test/parallel/test-http-client-timeout.js b/test/parallel/test-http-client-timeout.js index a9b093eb0c7938..1b09254d39bedc 100644 --- a/test/parallel/test-http-client-timeout.js +++ b/test/parallel/test-http-client-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-unescaped-path.js b/test/parallel/test-http-client-unescaped-path.js index 51e1fc7828be86..1536916ae9b49c 100644 --- a/test/parallel/test-http-client-unescaped-path.js +++ b/test/parallel/test-http-client-unescaped-path.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-upload-buf.js b/test/parallel/test-http-client-upload-buf.js index 5e544ccf518123..760f9c9562a678 100644 --- a/test/parallel/test-http-client-upload-buf.js +++ b/test/parallel/test-http-client-upload-buf.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-client-upload.js b/test/parallel/test-http-client-upload.js index 44fd5eabf23ab4..48ebfcc74de5ac 100644 --- a/test/parallel/test-http-client-upload.js +++ b/test/parallel/test-http-client-upload.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-conn-reset.js b/test/parallel/test-http-conn-reset.js index d340aa744c494a..2f047a2de4009a 100644 --- a/test/parallel/test-http-conn-reset.js +++ b/test/parallel/test-http-conn-reset.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-connect.js b/test/parallel/test-http-connect.js index 5ba24df5c18a9a..92fed5a72556db 100644 --- a/test/parallel/test-http-connect.js +++ b/test/parallel/test-http-connect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-content-length.js b/test/parallel/test-http-content-length.js index 07180f26ad84ed..6c9576cdabf563 100644 --- a/test/parallel/test-http-content-length.js +++ b/test/parallel/test-http-content-length.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-contentLength0.js b/test/parallel/test-http-contentLength0.js index 9b565c5470a246..9004649d1d2057 100644 --- a/test/parallel/test-http-contentLength0.js +++ b/test/parallel/test-http-contentLength0.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'); diff --git a/test/parallel/test-http-createConnection.js b/test/parallel/test-http-createConnection.js index 1da2d18f414bf8..48a7d7dbe68ea3 100644 --- a/test/parallel/test-http-createConnection.js +++ b/test/parallel/test-http-createConnection.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -14,7 +15,7 @@ var server = http.createServer(function(req, res) { res.end(); response++; }).listen(common.PORT, '127.0.0.1', function() { - http.get({ createConnection: createConnection }, function (res) { + http.get({ createConnection: createConnection }, function(res) { res.resume(); server.close(); }); diff --git a/test/parallel/test-http-curl-chunk-problem.js b/test/parallel/test-http-curl-chunk-problem.js index fcb186153dc933..55fce4ad5e60e4 100644 --- a/test/parallel/test-http-curl-chunk-problem.js +++ b/test/parallel/test-http-curl-chunk-problem.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); if (!common.opensslCli) { diff --git a/test/parallel/test-http-date-header.js b/test/parallel/test-http-date-header.js index 293a9b99291255..4c73800a8e908c 100644 --- a/test/parallel/test-http-date-header.js +++ b/test/parallel/test-http-date-header.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-default-encoding.js b/test/parallel/test-http-default-encoding.js index 6a2ac36ebd4b90..a40c8841eceab9 100644 --- a/test/parallel/test-http-default-encoding.js +++ b/test/parallel/test-http-default-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js index 5f702073121128..457424ecfa9397 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'), PORT = common.PORT, diff --git a/test/parallel/test-http-destroyed-socket-write2.js b/test/parallel/test-http-destroyed-socket-write2.js index e7a47ca9cfe95f..5bbb3bbc946f7d 100644 --- a/test/parallel/test-http-destroyed-socket-write2.js +++ b/test/parallel/test-http-destroyed-socket-write2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index 15547cd39450d1..55195e45b715ff 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-end-throw-socket-handling.js b/test/parallel/test-http-end-throw-socket-handling.js index 92a5ae6a38d0fb..204c0f73335480 100644 --- a/test/parallel/test-http-end-throw-socket-handling.js +++ b/test/parallel/test-http-end-throw-socket-handling.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -19,8 +20,8 @@ server.listen(common.PORT, function() { for (var i = 0; i < 10; i++) { var options = { port: common.PORT }; - var req = http.request(options, function (res) { - res.resume() + var req = http.request(options, function(res) { + res.resume(); res.on('end', function() { throw new Error('gleep glorp'); }); diff --git a/test/parallel/test-http-eof-on-connect.js b/test/parallel/test-http-eof-on-connect.js index a08ac9c7b0e6c9..e676643bab4911 100644 --- a/test/parallel/test-http-eof-on-connect.js +++ b/test/parallel/test-http-eof-on-connect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-exceptions.js b/test/parallel/test-http-exceptions.js index 6e0b5b9a6b8166..dc2d5583ddbaf9 100644 --- a/test/parallel/test-http-exceptions.js +++ b/test/parallel/test-http-exceptions.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-exit-delay.js b/test/parallel/test-http-exit-delay.js index 191b96d28b1e74..b06b33b5948eaf 100644 --- a/test/parallel/test-http-exit-delay.js +++ b/test/parallel/test-http-exit-delay.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var http = require('http'); diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js index ed6de310955383..aef4a98d84c9e2 100644 --- a/test/parallel/test-http-expect-continue.js +++ b/test/parallel/test-http-expect-continue.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-extra-response.js b/test/parallel/test-http-extra-response.js index ac2d9b6157c967..bfd9b59462c685 100644 --- a/test/parallel/test-http-extra-response.js +++ b/test/parallel/test-http-extra-response.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-flush-headers.js b/test/parallel/test-http-flush-headers.js index ede0fa52021233..da1bd24c54a884 100644 --- a/test/parallel/test-http-flush-headers.js +++ b/test/parallel/test-http-flush-headers.js @@ -4,7 +4,7 @@ const assert = require('assert'); const http = require('http'); const server = http.createServer(); -server.on('request', function(req, res){ +server.on('request', function(req, res) { assert(req.headers['foo'], 'bar'); res.end('ok'); server.close(); diff --git a/test/parallel/test-http-flush.js b/test/parallel/test-http-flush.js index 8d5a593cd9d21d..cac1caf752bee6 100644 --- a/test/parallel/test-http-flush.js +++ b/test/parallel/test-http-flush.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js index 4f3ce63dd85bed..da1b6d7f223496 100644 --- a/test/parallel/test-http-full-response.js +++ b/test/parallel/test-http-full-response.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); // This test requires the program 'ab' diff --git a/test/parallel/test-http-get-pipeline-problem.js b/test/parallel/test-http-get-pipeline-problem.js index 4d36cd3f7ea6f2..9c51bd11912257 100644 --- a/test/parallel/test-http-get-pipeline-problem.js +++ b/test/parallel/test-http-get-pipeline-problem.js @@ -1,3 +1,4 @@ +'use strict'; // We are demonstrating a problem with http.get when queueing up many // transfers. The server simply introduces some delay and sends a file. // Note this is demonstrated with connection: close. diff --git a/test/parallel/test-http-head-request.js b/test/parallel/test-http-head-request.js index 2310a6f83162f3..5a6f90507cf303 100644 --- a/test/parallel/test-http-head-request.js +++ b/test/parallel/test-http-head-request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-head-response-has-no-body-end.js b/test/parallel/test-http-head-response-has-no-body-end.js index 4f0fb5341ef10e..e0fdb131ed3378 100644 --- a/test/parallel/test-http-head-response-has-no-body-end.js +++ b/test/parallel/test-http-head-response-has-no-body-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-head-response-has-no-body.js b/test/parallel/test-http-head-response-has-no-body.js index 73fcf0b31f368d..ef1fc530db19c9 100644 --- a/test/parallel/test-http-head-response-has-no-body.js +++ b/test/parallel/test-http-head-response-has-no-body.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-header-read.js b/test/parallel/test-http-header-read.js index 0cba3d37415617..6266f8b11ffd2c 100644 --- a/test/parallel/test-http-header-read.js +++ b/test/parallel/test-http-header-read.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-header-response-splitting.js b/test/parallel/test-http-header-response-splitting.js index 148de1d245b040..b499ae33d157cc 100644 --- a/test/parallel/test-http-header-response-splitting.js +++ b/test/parallel/test-http-header-response-splitting.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), http = require('http'); diff --git a/test/parallel/test-http-hex-write.js b/test/parallel/test-http-hex-write.js index acce151b20af79..371bbe7a43cb75 100644 --- a/test/parallel/test-http-hex-write.js +++ b/test/parallel/test-http-hex-write.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-host-headers.js b/test/parallel/test-http-host-headers.js index 10e50306609d67..b5c083dfdf6d15 100644 --- a/test/parallel/test-http-host-headers.js +++ b/test/parallel/test-http-host-headers.js @@ -1,3 +1,4 @@ +'use strict'; var http = require('http'), common = require('../common'), assert = require('assert'), diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 26b704e6d5b5ba..21cd3e69dfd746 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -42,7 +43,7 @@ function generator(seeds) { return 'GET /' + r + ' HTTP/1.1\r\n' + 'Host: localhost:' + common.PORT + '\r\n' + '\r\n' + - '\r\n' + '\r\n'; }).join(''); } diff --git a/test/parallel/test-http-keep-alive-close-on-header.js b/test/parallel/test-http-keep-alive-close-on-header.js index 200f017a802d57..9ed6077b943aa8 100644 --- a/test/parallel/test-http-keep-alive-close-on-header.js +++ b/test/parallel/test-http-keep-alive-close-on-header.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-keep-alive.js b/test/parallel/test-http-keep-alive.js index 58c7061059a90c..f89f7698c46ebd 100644 --- a/test/parallel/test-http-keep-alive.js +++ b/test/parallel/test-http-keep-alive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-keepalive-client.js b/test/parallel/test-http-keepalive-client.js index 6bc459e3b96fd0..c573ac82d6f884 100644 --- a/test/parallel/test-http-keepalive-client.js +++ b/test/parallel/test-http-keepalive-client.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -66,6 +67,6 @@ function makeRequest(n) { } process.on('exit', function() { - assert.equal(actualRequests, expectRequests) + assert.equal(actualRequests, expectRequests); console.log('ok'); }); diff --git a/test/parallel/test-http-keepalive-maxsockets.js b/test/parallel/test-http-keepalive-maxsockets.js index e0e27f5e240cfe..a5382b6e328485 100644 --- a/test/parallel/test-http-keepalive-maxsockets.js +++ b/test/parallel/test-http-keepalive-maxsockets.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-keepalive-request.js b/test/parallel/test-http-keepalive-request.js index 51e9d66b1f739c..8736c9cd4f88ce 100644 --- a/test/parallel/test-http-keepalive-request.js +++ b/test/parallel/test-http-keepalive-request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -66,6 +67,6 @@ function makeRequest(n) { } process.on('exit', function() { - assert.equal(actualRequests, expectRequests) + assert.equal(actualRequests, expectRequests); console.log('ok'); }); diff --git a/test/parallel/test-http-legacy.js b/test/parallel/test-http-legacy.js index 7a3ae3572519f6..039037114d37d4 100644 --- a/test/parallel/test-http-legacy.js +++ b/test/parallel/test-http-legacy.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-localaddress-bind-error.js b/test/parallel/test-http-localaddress-bind-error.js index 9ee8c1d74f950e..80c7cab7c8e1ad 100644 --- a/test/parallel/test-http-localaddress-bind-error.js +++ b/test/parallel/test-http-localaddress-bind-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -6,7 +7,7 @@ var invalidLocalAddress = '1.2.3.4'; var gotError = false; var server = http.createServer(function(req, res) { - console.log("Connect from: " + req.connection.remoteAddress); + console.log('Connect from: ' + req.connection.remoteAddress); req.on('end', function() { res.writeHead(200, { 'Content-Type': 'text/plain' }); @@ -15,7 +16,7 @@ var server = http.createServer(function(req, res) { req.resume(); }); -server.listen(common.PORT, "127.0.0.1", function() { +server.listen(common.PORT, '127.0.0.1', function() { var req = http.request({ host: 'localhost', port: common.PORT, diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index 3cd821315253c9..9cc6a80d0b4974 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'), assert = require('assert'); @@ -7,8 +8,8 @@ if (!common.hasMultiLocalhost()) { process.exit(); } -var server = http.createServer(function (req, res) { - console.log("Connect from: " + req.connection.remoteAddress); +var server = http.createServer(function(req, res) { + console.log('Connect from: ' + req.connection.remoteAddress); assert.equal('127.0.0.2', req.connection.remoteAddress); req.on('end', function() { @@ -18,7 +19,7 @@ var server = http.createServer(function (req, res) { req.resume(); }); -server.listen(common.PORT, "127.0.0.1", function() { +server.listen(common.PORT, '127.0.0.1', function() { var options = { host: 'localhost', port: common.PORT, path: '/', diff --git a/test/parallel/test-http-malformed-request.js b/test/parallel/test-http-malformed-request.js index 26a0f340794cfc..5f65113afd4fc0 100644 --- a/test/parallel/test-http-malformed-request.js +++ b/test/parallel/test-http-malformed-request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-many-ended-pipelines.js b/test/parallel/test-http-many-ended-pipelines.js index 6824627151e741..4e0bc7e8ff736f 100644 --- a/test/parallel/test-http-many-ended-pipelines.js +++ b/test/parallel/test-http-many-ended-pipelines.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -28,7 +29,7 @@ server.listen(common.PORT); var client = net.connect({ port: common.PORT, allowHalfOpen: true }); for (var i = 0; i < numRequests; i++) { client.write('GET / HTTP/1.1\r\n' + - 'Host: some.host.name\r\n'+ + 'Host: some.host.name\r\n' + '\r\n\r\n'); } client.end(); diff --git a/test/parallel/test-http-max-headers-count.js b/test/parallel/test-http-max-headers-count.js index ed9b34297b5f39..18b160d0b6d8ed 100644 --- a/test/parallel/test-http-max-headers-count.js +++ b/test/parallel/test-http-max-headers-count.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-methods.js b/test/parallel/test-http-methods.js index 620db49434cdc2..348fd2e519ef64 100644 --- a/test/parallel/test-http-methods.js +++ b/test/parallel/test-http-methods.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-multi-line-headers.js b/test/parallel/test-http-multi-line-headers.js index 44d696a5a0c1d6..0c36b7cbf3cac9 100644 --- a/test/parallel/test-http-multi-line-headers.js +++ b/test/parallel/test-http-multi-line-headers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-mutable-headers.js b/test/parallel/test-http-mutable-headers.js index 296b1622a03394..2a60117328c580 100644 --- a/test/parallel/test-http-mutable-headers.js +++ b/test/parallel/test-http-mutable-headers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -21,10 +22,10 @@ var cookies = [ var s = http.createServer(function(req, res) { switch (test) { case 'headers': - assert.throws(function() { res.setHeader() }); - assert.throws(function() { res.setHeader('someHeader') }); - assert.throws(function() { res.getHeader() }); - assert.throws(function() { res.removeHeader() }); + assert.throws(function() { res.setHeader(); }); + assert.throws(function() { res.setHeader('someHeader'); }); + assert.throws(function() { res.getHeader(); }); + assert.throws(function() { res.removeHeader(); }); res.setHeader('x-test-header', 'testing'); res.setHeader('X-TEST-HEADER2', 'testing'); diff --git a/test/parallel/test-http-no-content-length.js b/test/parallel/test-http-no-content-length.js index 527ffb7d37b4e4..5752e5e924cd1b 100644 --- a/test/parallel/test-http-no-content-length.js +++ b/test/parallel/test-http-no-content-length.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js index e25f8ab743ff1e..2140759139c8ed 100644 --- a/test/parallel/test-http-outgoing-finish.js +++ b/test/parallel/test-http-outgoing-finish.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-parser-bad-ref.js b/test/parallel/test-http-parser-bad-ref.js index 0e2a77bb3a3938..d409dc62d008d9 100644 --- a/test/parallel/test-http-parser-bad-ref.js +++ b/test/parallel/test-http-parser-bad-ref.js @@ -1,3 +1,4 @@ +'use strict'; // Run this program with valgrind or efence with --expose_gc to expose the // problem. diff --git a/test/parallel/test-http-parser-free.js b/test/parallel/test-http-parser-free.js index 52df3836d790c0..af94d0c89c8f52 100644 --- a/test/parallel/test-http-parser-free.js +++ b/test/parallel/test-http-parser-free.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js index d8c181bf60f7ce..bb004f864cf468 100644 --- a/test/parallel/test-http-parser.js +++ b/test/parallel/test-http-parser.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-pause-resume-one-end.js b/test/parallel/test-http-pause-resume-one-end.js index cc3e41f3e92c77..2a10aeb3beb9e6 100644 --- a/test/parallel/test-http-pause-resume-one-end.js +++ b/test/parallel/test-http-pause-resume-one-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-pause.js b/test/parallel/test-http-pause.js index cf318d024f0656..70a04657b81011 100644 --- a/test/parallel/test-http-pause.js +++ b/test/parallel/test-http-pause.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-pipe-fs.js b/test/parallel/test-http-pipe-fs.js index 76882d65650bfd..bfee9ce23f1365 100644 --- a/test/parallel/test-http-pipe-fs.js +++ b/test/parallel/test-http-pipe-fs.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-proxy.js b/test/parallel/test-http-proxy.js index 8d27728a92ff34..fc8a753f2485ce 100644 --- a/test/parallel/test-http-proxy.js +++ b/test/parallel/test-http-proxy.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-raw-headers.js b/test/parallel/test-http-raw-headers.js index b4c1401872ae8a..7ecaaa93cfb04e 100644 --- a/test/parallel/test-http-raw-headers.js +++ b/test/parallel/test-http-raw-headers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-remove-header-stays-removed.js b/test/parallel/test-http-remove-header-stays-removed.js index e963989385b336..904b8210103ebf 100644 --- a/test/parallel/test-http-remove-header-stays-removed.js +++ b/test/parallel/test-http-remove-header-stays-removed.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-request-end-twice.js b/test/parallel/test-http-request-end-twice.js index 5518a8140cf463..871880e51463d8 100644 --- a/test/parallel/test-http-request-end-twice.js +++ b/test/parallel/test-http-request-end-twice.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-request-end.js b/test/parallel/test-http-request-end.js index d06c96d8777f5d..43d023028a4fd0 100644 --- a/test/parallel/test-http-request-end.js +++ b/test/parallel/test-http-request-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-request-methods.js b/test/parallel/test-http-request-methods.js index d0b474d712e34d..b29a6663ff6b26 100644 --- a/test/parallel/test-http-request-methods.js +++ b/test/parallel/test-http-request-methods.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-res-write-after-end.js b/test/parallel/test-http-res-write-after-end.js index 295d38aacb0e79..c8b3bf26e0804b 100644 --- a/test/parallel/test-http-res-write-after-end.js +++ b/test/parallel/test-http-res-write-after-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js index a4dcfcac0f1e41..0befd951f0cf16 100644 --- a/test/parallel/test-http-res-write-end-dont-take-array.js +++ b/test/parallel/test-http-res-write-end-dont-take-array.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-response-close.js b/test/parallel/test-http-response-close.js index 1b3433d79ebe60..82fd782717371c 100644 --- a/test/parallel/test-http-response-close.js +++ b/test/parallel/test-http-response-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-response-no-headers.js b/test/parallel/test-http-response-no-headers.js index 5d18b6182cd785..888eb9ac4b87e2 100644 --- a/test/parallel/test-http-response-no-headers.js +++ b/test/parallel/test-http-response-no-headers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-response-readable.js b/test/parallel/test-http-response-readable.js index 0774b8ed9c963f..1f50137d7166fd 100644 --- a/test/parallel/test-http-response-readable.js +++ b/test/parallel/test-http-response-readable.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-response-status-message.js b/test/parallel/test-http-response-status-message.js index abbae8818bfecd..a1e1f15697e468 100644 --- a/test/parallel/test-http-response-status-message.js +++ b/test/parallel/test-http-response-status-message.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -6,15 +7,24 @@ var net = require('net'); var testsComplete = 0; var testCases = [ - { path: "/200", statusMessage: "OK", response: 'HTTP/1.1 200 OK\r\n\r\n' }, - { path: "/500", statusMessage: "Internal Server Error", response: 'HTTP/1.1 500 Internal Server Error\r\n\r\n' }, - { path: "/302", statusMessage: "Moved Temporarily", response: 'HTTP/1.1 302 Moved Temporarily\r\n\r\n' }, - { path: "/missing", statusMessage: "", response: 'HTTP/1.1 200 \r\n\r\n' }, - { path: "/missing-no-space", statusMessage: "", response: 'HTTP/1.1 200\r\n\r\n' } + { path: '/200', statusMessage: 'OK', + response: 'HTTP/1.1 200 OK\r\n\r\n' }, + { path: '/500', statusMessage: 'Internal Server Error', + response: 'HTTP/1.1 500 Internal Server Error\r\n\r\n' }, + { path: '/302', statusMessage: 'Moved Temporarily', + response: 'HTTP/1.1 302 Moved Temporarily\r\n\r\n' }, + { path: '/missing', statusMessage: '', + response: 'HTTP/1.1 200 \r\n\r\n' }, + { path: '/missing-no-space', statusMessage: '', + response: 'HTTP/1.1 200\r\n\r\n' } ]; testCases.findByPath = function(path) { - var matching = this.filter(function(testCase) { return testCase.path === path; }); - if (matching.length === 0) { throw "failed to find test case with path " + path; } + var matching = this.filter(function(testCase) { + return testCase.path === path; + }); + if (matching.length === 0) { + throw 'failed to find test case with path ' + path; + } return matching[0]; }; diff --git a/test/parallel/test-http-server-multiheaders.js b/test/parallel/test-http-server-multiheaders.js index ac5849d075ec40..440e10533787fd 100644 --- a/test/parallel/test-http-server-multiheaders.js +++ b/test/parallel/test-http-server-multiheaders.js @@ -1,3 +1,4 @@ +'use strict'; // Verify that the HTTP server implementation handles multiple instances // of the same header as per RFC2616: joining the handful of fields by ', ' // that support it, and dropping duplicates for other fields. diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js index 5a3b80c5cd8823..438e8ba759e8ba 100644 --- a/test/parallel/test-http-server-multiheaders2.js +++ b/test/parallel/test-http-server-multiheaders2.js @@ -1,3 +1,4 @@ +'use strict'; // Verify that the HTTP server implementation handles multiple instances // of the same header as per RFC2616: joining the handful of fields by ', ' // that support it, and dropping duplicates for other fields. @@ -49,10 +50,12 @@ var multipleForbidden = [ var srv = http.createServer(function(req, res) { multipleForbidden.forEach(function(header) { - assert.equal(req.headers[header.toLowerCase()], 'foo', 'header parsed incorrectly: ' + header); + assert.equal(req.headers[header.toLowerCase()], + 'foo', 'header parsed incorrectly: ' + header); }); multipleAllowed.forEach(function(header) { - assert.equal(req.headers[header.toLowerCase()], 'foo, bar', 'header parsed incorrectly: ' + header); + assert.equal(req.headers[header.toLowerCase()], + 'foo, bar', 'header parsed incorrectly: ' + header); }); assert.equal(req.headers['content-length'], 0); @@ -65,7 +68,7 @@ var srv = http.createServer(function(req, res) { function makeHeader(value) { return function(header) { return [header, value]; - } + }; } var headers = [] diff --git a/test/parallel/test-http-server-stale-close.js b/test/parallel/test-http-server-stale-close.js index aa834b1fae3ef3..a866d39c2cc735 100644 --- a/test/parallel/test-http-server-stale-close.js +++ b/test/parallel/test-http-server-stale-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index b96b57998a2cb6..9ba13ddf96b6ec 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-set-cookies.js b/test/parallel/test-http-set-cookies.js index 1c03db01dba29e..9a43f82a39c12e 100644 --- a/test/parallel/test-http-set-cookies.js +++ b/test/parallel/test-http-set-cookies.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-set-timeout-server.js b/test/parallel/test-http-set-timeout-server.js index caefc03832d5cb..67db16d2a26111 100644 --- a/test/parallel/test-http-set-timeout-server.js +++ b/test/parallel/test-http-set-timeout-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -16,8 +17,9 @@ function run() { if (fn) { console.log('# %s', fn.name); fn(run); - } else + } else { console.log('ok'); + } } test(function serverTimeout(cb) { diff --git a/test/parallel/test-http-set-timeout.js b/test/parallel/test-http-set-timeout.js index 5bb34ad4ff95e9..b3ca90a67bbe90 100644 --- a/test/parallel/test-http-set-timeout.js +++ b/test/parallel/test-http-set-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index 98001afb66448f..6f5c02f5605969 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js index 3c2d2530833305..870223a37b6d44 100644 --- a/test/parallel/test-http-should-keep-alive.js +++ b/test/parallel/test-http-should-keep-alive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js index e862ed6076b447..19c36b0b2fd27f 100644 --- a/test/parallel/test-http-status-code.js +++ b/test/parallel/test-http-status-code.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-status-message.js b/test/parallel/test-http-status-message.js index 8d79d1a5affe4c..e579b8e995e120 100644 --- a/test/parallel/test-http-status-message.js +++ b/test/parallel/test-http-status-message.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-timeout-overflow.js b/test/parallel/test-http-timeout-overflow.js index b4d64e459bfc12..0df485edc93f9c 100644 --- a/test/parallel/test-http-timeout-overflow.js +++ b/test/parallel/test-http-timeout-overflow.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -14,7 +15,7 @@ var server = http.createServer(function(req, res) { }); server.listen(port, function() { - function callback(){} + function callback() {} var req = http.request({ port: port, @@ -26,7 +27,7 @@ server.listen(port, function() { res.on('end', function() { clientRequests++; server.close(); - }) + }); res.resume(); }); diff --git a/test/parallel/test-http-timeout.js b/test/parallel/test-http-timeout.js index 80393837f3201d..aab903420f0acc 100644 --- a/test/parallel/test-http-timeout.js +++ b/test/parallel/test-http-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -6,8 +7,8 @@ var http = require('http'); var port = common.PORT; var server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('OK'); + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('OK'); }); var agent = new http.Agent({maxSockets: 1}); @@ -18,13 +19,13 @@ server.listen(port, function() { createRequest().end(); } - function callback(){} + function callback() {} var count = 0; function createRequest() { - var req = http.request({port: port, path: '/', agent: agent}, function(res) { - + var req = http.request({port: port, path: '/', agent: agent}, + function(res) { req.clearTimeout(callback); res.on('end', function() { @@ -33,7 +34,7 @@ server.listen(port, function() { if (count == 11) { server.close(); } - }) + }); res.resume(); }); diff --git a/test/parallel/test-http-unix-socket.js b/test/parallel/test-http-unix-socket.js index 1c13dafd3b038b..9ec8c8a1572844 100644 --- a/test/parallel/test-http-unix-socket.js +++ b/test/parallel/test-http-unix-socket.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-http-upgrade-agent.js b/test/parallel/test-http-upgrade-agent.js index b1655b7d0b41ae..84cfee90d528de 100644 --- a/test/parallel/test-http-upgrade-agent.js +++ b/test/parallel/test-http-upgrade-agent.js @@ -1,3 +1,4 @@ +'use strict'; // Verify that the 'upgrade' header causes an 'upgrade' event to be emitted to // the HTTP client. This test uses a raw TCP server to better control server // behavior. diff --git a/test/parallel/test-http-upgrade-client.js b/test/parallel/test-http-upgrade-client.js index 14e0b9ca6a117d..b8ba033f2e01cb 100644 --- a/test/parallel/test-http-upgrade-client.js +++ b/test/parallel/test-http-upgrade-client.js @@ -1,3 +1,4 @@ +'use strict'; // Verify that the 'upgrade' header causes an 'upgrade' event to be emitted to // the HTTP client. This test uses a raw TCP server to better control server // behavior. diff --git a/test/parallel/test-http-upgrade-client2.js b/test/parallel/test-http-upgrade-client2.js index d2b0f9c215b376..424d7c811c1a5a 100644 --- a/test/parallel/test-http-upgrade-client2.js +++ b/test/parallel/test-http-upgrade-client2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-upgrade-server.js b/test/parallel/test-http-upgrade-server.js index 84a8de9fed1b9a..9b34fe42eb05b9 100644 --- a/test/parallel/test-http-upgrade-server.js +++ b/test/parallel/test-http-upgrade-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-upgrade-server2.js b/test/parallel/test-http-upgrade-server2.js index 7af34c52719c4d..9a22df52c210be 100644 --- a/test/parallel/test-http-upgrade-server2.js +++ b/test/parallel/test-http-upgrade-server2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-url.parse-auth-with-header-in-request.js b/test/parallel/test-http-url.parse-auth-with-header-in-request.js index 9df0f5f6cda912..bb5de74ff9dcad 100644 --- a/test/parallel/test-http-url.parse-auth-with-header-in-request.js +++ b/test/parallel/test-http-url.parse-auth-with-header-in-request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-url.parse-auth.js b/test/parallel/test-http-url.parse-auth.js index 7038efb552b031..d06c79a9e707a4 100644 --- a/test/parallel/test-http-url.parse-auth.js +++ b/test/parallel/test-http-url.parse-auth.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-url.parse-basic.js b/test/parallel/test-http-url.parse-basic.js index 234082ad188b2a..efc375e97cbb62 100644 --- a/test/parallel/test-http-url.parse-basic.js +++ b/test/parallel/test-http-url.parse-basic.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index 44287bc6b974dd..7fb749b069d140 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-url.parse-only-support-http-https-protocol.js b/test/parallel/test-http-url.parse-only-support-http-https-protocol.js index c8ae4ffeae97b2..5e49193181032c 100644 --- a/test/parallel/test-http-url.parse-only-support-http-https-protocol.js +++ b/test/parallel/test-http-url.parse-only-support-http-https-protocol.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -8,7 +9,8 @@ assert.throws(function() { http.request(url.parse('file:///whatever')); }, function(err) { if (err instanceof Error) { - assert.strictEqual(err.message, 'Protocol "file:" not supported. Expected "http:".'); + assert.strictEqual(err.message, 'Protocol "file:" not supported.' + + ' Expected "http:".'); return true; } }); @@ -17,7 +19,8 @@ assert.throws(function() { http.request(url.parse('mailto:asdf@asdf.com')); }, function(err) { if (err instanceof Error) { - assert.strictEqual(err.message, 'Protocol "mailto:" not supported. Expected "http:".'); + assert.strictEqual(err.message, 'Protocol "mailto:" not supported.' + + ' Expected "http:".'); return true; } }); @@ -26,7 +29,8 @@ assert.throws(function() { http.request(url.parse('ftp://www.example.com')); }, function(err) { if (err instanceof Error) { - assert.strictEqual(err.message, 'Protocol "ftp:" not supported. Expected "http:".'); + assert.strictEqual(err.message, 'Protocol "ftp:" not supported.' + + ' Expected "http:".'); return true; } }); @@ -35,7 +39,8 @@ assert.throws(function() { http.request(url.parse('javascript:alert(\'hello\');')); }, function(err) { if (err instanceof Error) { - assert.strictEqual(err.message, 'Protocol "javascript:" not supported. Expected "http:".'); + assert.strictEqual(err.message, 'Protocol "javascript:" not supported.' + + ' Expected "http:".'); return true; } }); @@ -44,7 +49,8 @@ assert.throws(function() { http.request(url.parse('xmpp:isaacschlueter@jabber.org')); }, function(err) { if (err instanceof Error) { - assert.strictEqual(err.message, 'Protocol "xmpp:" not supported. Expected "http:".'); + assert.strictEqual(err.message, 'Protocol "xmpp:" not supported.' + + ' Expected "http:".'); return true; } }); @@ -53,7 +59,8 @@ assert.throws(function() { http.request(url.parse('f://some.host/path')); }, function(err) { if (err instanceof Error) { - assert.strictEqual(err.message, 'Protocol "f:" not supported. Expected "http:".'); + assert.strictEqual(err.message, 'Protocol "f:" not supported.' + + ' Expected "http:".'); return true; } }); diff --git a/test/parallel/test-http-url.parse-path.js b/test/parallel/test-http-url.parse-path.js index 2ff78755c1ed39..087f535fa99c83 100644 --- a/test/parallel/test-http-url.parse-path.js +++ b/test/parallel/test-http-url.parse-path.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-url.parse-post.js b/test/parallel/test-http-url.parse-post.js index ae6a85da0ec395..b6a0fdeb255235 100644 --- a/test/parallel/test-http-url.parse-post.js +++ b/test/parallel/test-http-url.parse-post.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-url.parse-search.js b/test/parallel/test-http-url.parse-search.js index 16b65d2f94a3ea..04e5a72e8f913e 100644 --- a/test/parallel/test-http-url.parse-search.js +++ b/test/parallel/test-http-url.parse-search.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-wget.js b/test/parallel/test-http-wget.js index b79cf84078e157..78144ac6fbf7cb 100644 --- a/test/parallel/test-http-wget.js +++ b/test/parallel/test-http-wget.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-http-write-callbacks.js b/test/parallel/test-http-write-callbacks.js index a666e7ffe130a3..404396723e4416 100644 --- a/test/parallel/test-http-write-callbacks.js +++ b/test/parallel/test-http-write-callbacks.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-write-empty-string.js b/test/parallel/test-http-write-empty-string.js index e0ddbe3c22add4..50a9f5d509f381 100644 --- a/test/parallel/test-http-write-empty-string.js +++ b/test/parallel/test-http-write-empty-string.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index acd2a6058dd526..79a8502c4f01b0 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-http-zero-length-write.js b/test/parallel/test-http-zero-length-write.js index 583b081a522873..1ba29ca1c4a9fb 100644 --- a/test/parallel/test-http-zero-length-write.js +++ b/test/parallel/test-http-zero-length-write.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -22,7 +23,7 @@ function getSrc() { var chunks = [ '', 'asdf', '', 'foo', '', 'bar', '' ]; var interval = setInterval(function() { if (paused) - return + return; var chunk = chunks.shift(); if (chunk !== undefined) { diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index c1c55d2d525a34..daa746cdbe5b7a 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/parallel/test-https-agent-servername.js b/test/parallel/test-https-agent-servername.js index 1647b0ee9a6ae8..5af9af9818008c 100644 --- a/test/parallel/test-https-agent-servername.js +++ b/test/parallel/test-https-agent-servername.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-agent.js b/test/parallel/test-https-agent.js index 15604f74e5fc75..a26882844e3e59 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-byteswritten.js b/test/parallel/test-https-byteswritten.js index 5c657b26076499..3e50b6f84dc265 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-https-client-checkServerIdentity.js b/test/parallel/test-https-client-checkServerIdentity.js index c7bffc90002291..8f4aad7f5eff1e 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -17,12 +18,12 @@ var options = { var reqCount = 0; -var server = https.createServer(options, function (req, res) { +var server = https.createServer(options, function(req, res) { ++reqCount; res.writeHead(200); res.end(); req.resume(); -}).listen(common.PORT, function () { +}).listen(common.PORT, function() { authorized(); }); @@ -31,10 +32,10 @@ function authorized() { port: common.PORT, rejectUnauthorized: true, ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))] - }, function (res) { + }, function(res) { assert(false); }); - req.on('error', function (err) { + req.on('error', function(err) { override(); }); req.end(); @@ -45,21 +46,21 @@ function override() { port: common.PORT, rejectUnauthorized: true, ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))], - checkServerIdentity: function (host, cert) { + checkServerIdentity: function(host, cert) { return false; } }; options.agent = new https.Agent(options); - var req = https.request(options, function (res) { + var req = https.request(options, function(res) { assert(req.socket.authorized); server.close(); }); - req.on('error', function (err) { + req.on('error', function(err) { throw err; }); req.end(); } -process.on('exit', function () { +process.on('exit', function() { assert.equal(reqCount, 1); }); diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index 01cea20242e710..66c11cd2db34db 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -1,3 +1,4 @@ +'use strict'; // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index d3fcae7befebb4..55c335289d4131 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index 974db0f59775cf..024c5fa17f6038 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -1,3 +1,4 @@ +'use strict'; // Create an ssl server. First connection, validate that not resume. // Cache session and close connection. Use session on second connection. // ASSERT resumption. @@ -21,7 +22,7 @@ var options = { var connections = 0; // create server -var server = https.createServer(options, function(res, res) { +var server = https.createServer(options, function(req, res) { res.end('Goodbye'); connections++; }); diff --git a/test/parallel/test-https-connecting-to-http.js b/test/parallel/test-https-connecting-to-http.js index eb0ea40dc9c35a..64adb7760321bf 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -1,3 +1,4 @@ +'use strict'; // This tests the situation where you try to connect a https client // to an http server. You should get an error and exit. var common = require('../common'); diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js index f2ea3fb4e44be2..0ce55b0849b585 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index 14e087874e2285..78a2f3828cb9dd 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -1,3 +1,4 @@ +'use strict'; // I hate HTTP. One way of terminating an HTTP response is to not send // a content-length header, not send a transfer-encoding: chunked header, // and simply terminate the TCP connection. That is identity diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index 9d8d34dd791a75..f9b382ad830d35 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.opensslCli) { diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js index b8bcb407f1bebb..6a828d4aabbe07 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js index 153233f1a691fb..21e630dee43404 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -17,7 +18,7 @@ var invalidLocalAddress = '1.2.3.4'; var gotError = false; var server = https.createServer(options, function(req, res) { - console.log("Connect from: " + req.connection.remoteAddress); + console.log('Connect from: ' + req.connection.remoteAddress); req.on('end', function() { res.writeHead(200, { 'Content-Type': 'text/plain' }); @@ -26,7 +27,7 @@ var server = https.createServer(options, function(req, res) { req.resume(); }); -server.listen(common.PORT, "127.0.0.1", function() { +server.listen(common.PORT, '127.0.0.1', function() { var req = https.request({ host: 'localhost', port: common.PORT, diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index b3b1d2cb942e07..0f3241c70b46ec 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), fs = require('fs'), assert = require('assert'); @@ -18,8 +19,8 @@ var options = { cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') }; -var server = https.createServer(options, function (req, res) { - console.log("Connect from: " + req.connection.remoteAddress); +var server = https.createServer(options, function(req, res) { + console.log('Connect from: ' + req.connection.remoteAddress); assert.equal('127.0.0.2', req.connection.remoteAddress); req.on('end', function() { @@ -29,7 +30,7 @@ var server = https.createServer(options, function (req, res) { req.resume(); }); -server.listen(common.PORT, "127.0.0.1", function() { +server.listen(common.PORT, '127.0.0.1', function() { var options = { host: 'localhost', port: common.PORT, diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js index 30dbea6ad0975e..f3968588333b44 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -31,8 +32,8 @@ server.listen(options.port, options.host, function() { var data = ''; https.get(options, function(res) { - res.on('data', function(data_) { data += data_ }); - res.on('end', function() { server.close() }); + res.on('data', function(data_) { data += data_; }); + res.on('end', function() { server.close(); }); }); process.on('exit', function() { diff --git a/test/parallel/test-https-req-split.js b/test/parallel/test-https-req-split.js index 210363e430b9f1..4fd48eb16151fa 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -1,3 +1,4 @@ +'use strict'; // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; diff --git a/test/parallel/test-https-set-timeout-server.js b/test/parallel/test-https-set-timeout-server.js index a78725eefa83f9..c10878110c3e53 100644 --- a/test/parallel/test-https-set-timeout-server.js +++ b/test/parallel/test-https-set-timeout-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -28,8 +29,9 @@ function run() { if (fn) { console.log('# %s', fn.name); fn(run); - } else + } else { console.log('ok'); + } } test(function serverTimeout(cb) { diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index 840838b83e4787..c2b93fdef855a0 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js index eef94765a52bf1..52e46bd20b7807 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -43,7 +44,8 @@ server_http.listen(common.PORT, function() { req.end(); }); -// Then try https server (requires functions to be mirroed in tls.js's CryptoStream) +// Then try https server (requires functions to be +// mirroed in tls.js's CryptoStream) var server_https = https.createServer(options, function(req, res) { console.log('got HTTPS request'); @@ -51,7 +53,7 @@ var server_https = https.createServer(options, function(req, res) { res.end(body); }); -server_https.listen(common.PORT+1, function() { +server_https.listen(common.PORT + 1, function() { var req = https.request({ port: common.PORT + 1, rejectUnauthorized: false diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index b2620fa88b236c..7ab5c3ee8200be 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -1,3 +1,4 @@ +'use strict'; // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; @@ -100,7 +101,7 @@ function listening() { if (listenWait === 0) { allListening(); } - } + }; } function makeReq(path, port, error, host, ca) { @@ -127,7 +128,7 @@ function makeReq(path, port, error, host, ca) { } if (host) { - options.headers = { host: host } + options.headers = { host: host }; } var req = https.get(options); expectResponseCount++; @@ -136,7 +137,7 @@ function makeReq(path, port, error, host, ca) { : port === port3 ? server3 : null; - if (!server) throw new Error('invalid port: '+port); + if (!server) throw new Error('invalid port: ' + port); server.expectCount++; req.on('response', function(res) { @@ -150,7 +151,7 @@ function makeReq(path, port, error, host, ca) { server3.close(); } res.resume(); - }) + }); } function allListening() { diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js index 0a074da0743646..5da7c83326802a 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js index a24779ac7658b1..2707c30d181bf5 100644 --- a/test/parallel/test-https-timeout-server.js +++ b/test/parallel/test-https-timeout-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js index c03cb013d599b7..f6f1375180991c 100644 --- a/test/parallel/test-https-timeout.js +++ b/test/parallel/test-https-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index 6a58bfe7715321..aba1be809abddd 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-internal-modules-expose.js b/test/parallel/test-internal-modules-expose.js index 4ea79dbbf73512..4ece1d0c7b6f29 100644 --- a/test/parallel/test-internal-modules-expose.js +++ b/test/parallel/test-internal-modules-expose.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --expose_internals var common = require('../common'); diff --git a/test/parallel/test-internal-modules.js b/test/parallel/test-internal-modules.js index ebba2500d568b2..011b6f7132e9bf 100644 --- a/test/parallel/test-internal-modules.js +++ b/test/parallel/test-internal-modules.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index 390155fc26e817..8701d90f7c0acc 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -1,10 +1,11 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); // does node think that i18n was enabled? var enablei18n = process.config.variables.v8_enable_i18n_support; if (enablei18n === undefined) { - enablei18n = false; + enablei18n = false; } // is the Intl object present? diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 4b60a18161103c..c3ba42f315daba 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -43,7 +44,7 @@ function test() { server: 'localhost', port: PORT, path: '/', - }).on('response', function (res) { + }).on('response', function(res) { var s = ''; res.on('data', function(c) { s += c.toString(); @@ -58,7 +59,7 @@ function test() { assert.equal(res.statusCode, 200); console.log('ok'); }); - }) + }); } } diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index 329eee5f818d48..7e8f7fbaf8a018 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -39,7 +40,7 @@ function test() { server: 'localhost', port: PORT, path: '/', - }).on('response', function (res) { + }).on('response', function(res) { var s = ''; res.on('data', function(c) { s += c.toString(); @@ -55,7 +56,7 @@ function test() { assert.equal(s, 'hello from child\n'); assert.equal(res.statusCode, 200); }); - }) + }); } } diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index a014fa1ee4a5a3..fceedfd25251dc 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -39,7 +40,7 @@ function test() { server: 'localhost', port: PORT, path: '/', - }).on('response', function (res) { + }).on('response', function(res) { var s = ''; res.on('data', function(c) { s += c.toString(); @@ -55,7 +56,7 @@ function test() { assert.equal(s, 'hello from child\n'); assert.equal(res.statusCode, 200); }); - }) + }); } } diff --git a/test/parallel/test-listen-fd-ebadf.js b/test/parallel/test-listen-fd-ebadf.js index 628ece68a32023..db905dfa35e966 100644 --- a/test/parallel/test-listen-fd-ebadf.js +++ b/test/parallel/test-listen-fd-ebadf.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index 39f15014a12851..b922c25ee10683 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -39,7 +40,7 @@ function test() { server: 'localhost', port: PORT, path: '/', - }).on('response', function (res) { + }).on('response', function(res) { var s = ''; res.on('data', function(c) { s += c.toString(); @@ -55,7 +56,7 @@ function test() { assert.equal(s, 'hello from child\n'); assert.equal(res.statusCode, 200); }); - }) + }); } } diff --git a/test/parallel/test-memory-usage.js b/test/parallel/test-memory-usage.js index 4c1b67c83a324f..09dc4f820a8d74 100644 --- a/test/parallel/test-memory-usage.js +++ b/test/parallel/test-memory-usage.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-microtask-queue-integration-domain.js b/test/parallel/test-microtask-queue-integration-domain.js index 7e8b9a125038b4..7a4ad77cd321e3 100644 --- a/test/parallel/test-microtask-queue-integration-domain.js +++ b/test/parallel/test-microtask-queue-integration-domain.js @@ -1,12 +1,13 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); var implementations = [ - function (fn) { + function(fn) { Promise.resolve().then(fn); }, - function (fn) { + function(fn) { var obj = {}; Object.observe(obj, fn); @@ -18,20 +19,20 @@ var implementations = [ var expected = 0; var done = 0; -process.on('exit', function () { +process.on('exit', function() { assert.equal(done, expected); }); -function test (scheduleMicrotask) { +function test(scheduleMicrotask) { var nextTickCalled = false; expected++; - scheduleMicrotask(function () { - process.nextTick(function () { + scheduleMicrotask(function() { + process.nextTick(function() { nextTickCalled = true; }); - setTimeout(function () { + setTimeout(function() { assert(nextTickCalled); done++; }, 0); @@ -42,8 +43,8 @@ function test (scheduleMicrotask) { implementations.forEach(test); // tick callback case -setTimeout(function () { - implementations.forEach(function (impl) { +setTimeout(function() { + implementations.forEach(function(impl) { process.nextTick(test.bind(null, impl)); }); }, 0); diff --git a/test/parallel/test-microtask-queue-integration.js b/test/parallel/test-microtask-queue-integration.js index 3f68d736759f9e..37de5ee33b1477 100644 --- a/test/parallel/test-microtask-queue-integration.js +++ b/test/parallel/test-microtask-queue-integration.js @@ -1,11 +1,12 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var implementations = [ - function (fn) { + function(fn) { Promise.resolve().then(fn); }, - function (fn) { + function(fn) { var obj = {}; Object.observe(obj, fn); @@ -17,20 +18,20 @@ var implementations = [ var expected = 0; var done = 0; -process.on('exit', function () { +process.on('exit', function() { assert.equal(done, expected); }); -function test (scheduleMicrotask) { +function test(scheduleMicrotask) { var nextTickCalled = false; expected++; - scheduleMicrotask(function () { - process.nextTick(function () { + scheduleMicrotask(function() { + process.nextTick(function() { nextTickCalled = true; }); - setTimeout(function () { + setTimeout(function() { assert(nextTickCalled); done++; }, 0); @@ -41,8 +42,8 @@ function test (scheduleMicrotask) { implementations.forEach(test); // tick callback case -setTimeout(function () { - implementations.forEach(function (impl) { +setTimeout(function() { + implementations.forEach(function(impl) { process.nextTick(test.bind(null, impl)); }); }, 0); diff --git a/test/parallel/test-microtask-queue-run-domain.js b/test/parallel/test-microtask-queue-run-domain.js index 8627e90eff3518..77534920ff1451 100644 --- a/test/parallel/test-microtask-queue-run-domain.js +++ b/test/parallel/test-microtask-queue-run-domain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); diff --git a/test/parallel/test-microtask-queue-run-immediate-domain.js b/test/parallel/test-microtask-queue-run-immediate-domain.js index aa58b7fcb14710..2dea0a76cc1bf4 100644 --- a/test/parallel/test-microtask-queue-run-immediate-domain.js +++ b/test/parallel/test-microtask-queue-run-immediate-domain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); diff --git a/test/parallel/test-microtask-queue-run-immediate.js b/test/parallel/test-microtask-queue-run-immediate.js index fbce91e5179406..cfd9cd3659ef00 100644 --- a/test/parallel/test-microtask-queue-run-immediate.js +++ b/test/parallel/test-microtask-queue-run-immediate.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-microtask-queue-run.js b/test/parallel/test-microtask-queue-run.js index 73ba76efc49e0c..ca758546c2bcfd 100644 --- a/test/parallel/test-microtask-queue-run.js +++ b/test/parallel/test-microtask-queue-run.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-module-globalpaths-nodepath.js b/test/parallel/test-module-globalpaths-nodepath.js index 6cfa17933ce869..d81f5994f23332 100644 --- a/test/parallel/test-module-globalpaths-nodepath.js +++ b/test/parallel/test-module-globalpaths-nodepath.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 23eac7da6fbeeb..f33605d44ee949 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-module-nodemodulepaths.js b/test/parallel/test-module-nodemodulepaths.js index e5e07dd40e3423..b1f04d41d0e092 100644 --- a/test/parallel/test-module-nodemodulepaths.js +++ b/test/parallel/test-module-nodemodulepaths.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -9,10 +10,10 @@ var file, delimiter, paths; if (isWindows) { file = 'C:\\Users\\Rocko Artischocko\\node_stuff\\foo'; - delimiter = '\\' + delimiter = '\\'; } else { file = '/usr/test/lib/node_modules/npm/foo'; - delimiter = '/' + delimiter = '/'; } paths = module._nodeModulePaths(file); diff --git a/test/parallel/test-net-after-close.js b/test/parallel/test-net-after-close.js index 99b213e0870238..223417111600a1 100644 --- a/test/parallel/test-net-after-close.js +++ b/test/parallel/test-net-after-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-better-error-messages-listen-path.js b/test/parallel/test-net-better-error-messages-listen-path.js index fcc3062a814f68..8a7e0220b36dfa 100644 --- a/test/parallel/test-net-better-error-messages-listen-path.js +++ b/test/parallel/test-net-better-error-messages-listen-path.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -5,5 +6,5 @@ var fp = '/blah/fadfa'; var server = net.createServer(assert.fail); server.listen(fp, assert.fail); server.on('error', common.mustCall(function(e) { - assert.equal(e.address, fp) + assert.equal(e.address, fp); })); diff --git a/test/parallel/test-net-better-error-messages-listen.js b/test/parallel/test-net-better-error-messages-listen.js index 9c7766bd4f4e3d..7e5fad925aeb92 100644 --- a/test/parallel/test-net-better-error-messages-listen.js +++ b/test/parallel/test-net-better-error-messages-listen.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js index dea4a10459edab..06cfecbd7c6af1 100644 --- a/test/parallel/test-net-better-error-messages-path.js +++ b/test/parallel/test-net-better-error-messages-path.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js index 3817dbb92ff1e2..9335f6b07a6625 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/parallel/test-net-better-error-messages-port.js b/test/parallel/test-net-better-error-messages-port.js index a8c16a70385bb3..0f90089c0509fe 100644 --- a/test/parallel/test-net-better-error-messages-port.js +++ b/test/parallel/test-net-better-error-messages-port.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/parallel/test-net-binary.js b/test/parallel/test-net-binary.js index ae1a82ae8976bd..cf29cfe63bad71 100644 --- a/test/parallel/test-net-binary.js +++ b/test/parallel/test-net-binary.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-bind-twice.js b/test/parallel/test-net-bind-twice.js index ca75fb16fed9e9..ca4f554d30ca16 100644 --- a/test/parallel/test-net-bind-twice.js +++ b/test/parallel/test-net-bind-twice.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-buffersize.js b/test/parallel/test-net-buffersize.js index e8618beb7ac627..fcf0331c4ed500 100644 --- a/test/parallel/test-net-buffersize.js +++ b/test/parallel/test-net-buffersize.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-bytes-stats.js b/test/parallel/test-net-bytes-stats.js index 562e9b422c69c8..4e0a2e4001a452 100644 --- a/test/parallel/test-net-bytes-stats.js +++ b/test/parallel/test-net-bytes-stats.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-can-reset-timeout.js b/test/parallel/test-net-can-reset-timeout.js index 3febac8a3034f6..9fd7da4bb498ff 100644 --- a/test/parallel/test-net-can-reset-timeout.js +++ b/test/parallel/test-net-can-reset-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var net = require('net'); var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-connect-buffer.js b/test/parallel/test-net-connect-buffer.js index 74697932b0988b..304401f56ef50d 100644 --- a/test/parallel/test-net-connect-buffer.js +++ b/test/parallel/test-net-connect-buffer.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-connect-handle-econnrefused.js b/test/parallel/test-net-connect-handle-econnrefused.js index 77849b9b577261..0a8ce081680f76 100644 --- a/test/parallel/test-net-connect-handle-econnrefused.js +++ b/test/parallel/test-net-connect-handle-econnrefused.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index 1fc908be1fba21..086cf910422372 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 35af5124a46cd6..0ac1367ede1cce 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-connect-options.js b/test/parallel/test-net-connect-options.js index fba35eab1c7b68..ac8bbcefc03e4c 100644 --- a/test/parallel/test-net-connect-options.js +++ b/test/parallel/test-net-connect-options.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-connect-paused-connection.js b/test/parallel/test-net-connect-paused-connection.js index 06e51f843fefad..60af9e44fb31f6 100644 --- a/test/parallel/test-net-connect-paused-connection.js +++ b/test/parallel/test-net-connect-paused-connection.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-net-create-connection.js b/test/parallel/test-net-create-connection.js index 9f468763c008b6..c245ddc2ae7860 100644 --- a/test/parallel/test-net-create-connection.js +++ b/test/parallel/test-net-create-connection.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -22,7 +23,7 @@ server.listen(tcpPort, 'localhost', function() { function fail(opts, errtype, msg) { assert.throws(function() { var client = net.createConnection(opts, cb); - }, function (err) { + }, function(err) { return err instanceof errtype && msg === err.message; }); } diff --git a/test/parallel/test-net-dns-custom-lookup.js b/test/parallel/test-net-dns-custom-lookup.js index 05ca09cc66ff42..008e831c61fc9c 100644 --- a/test/parallel/test-net-dns-custom-lookup.js +++ b/test/parallel/test-net-dns-custom-lookup.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-dns-error.js b/test/parallel/test-net-dns-error.js index 18f6fe259b75ec..17f251cec3b6af 100644 --- a/test/parallel/test-net-dns-error.js +++ b/test/parallel/test-net-dns-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-dns-lookup-skip.js b/test/parallel/test-net-dns-lookup-skip.js index 7a129b979510b7..1083ed9fc0ad8f 100644 --- a/test/parallel/test-net-dns-lookup-skip.js +++ b/test/parallel/test-net-dns-lookup-skip.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-dns-lookup.js b/test/parallel/test-net-dns-lookup.js index 92ba794d74520c..2bcff9143c092d 100644 --- a/test/parallel/test-net-dns-lookup.js +++ b/test/parallel/test-net-dns-lookup.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-during-close.js b/test/parallel/test-net-during-close.js index b2f139cfa0a1f8..a2fd424e0e83c0 100644 --- a/test/parallel/test-net-during-close.js +++ b/test/parallel/test-net-during-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-eaddrinuse.js b/test/parallel/test-net-eaddrinuse.js index 209e4909c49728..c1797b7369d5ed 100644 --- a/test/parallel/test-net-eaddrinuse.js +++ b/test/parallel/test-net-eaddrinuse.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-end-without-connect.js b/test/parallel/test-net-end-without-connect.js index 6ccf2b028082d2..2911591f9f486d 100644 --- a/test/parallel/test-net-end-without-connect.js +++ b/test/parallel/test-net-end-without-connect.js @@ -1,5 +1,6 @@ +'use strict'; var common = require('../common'); var net = require('net'); -var sock = new net.Socket; +var sock = new net.Socket(); sock.end(); // Should not throw. diff --git a/test/parallel/test-net-error-twice.js b/test/parallel/test-net-error-twice.js index 1620bb8ee55fa1..af92ca93206f18 100644 --- a/test/parallel/test-net-error-twice.js +++ b/test/parallel/test-net-error-twice.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -10,18 +11,18 @@ var errs = []; var srv = net.createServer(function onConnection(conn) { conn.write(buf); - conn.on('error', function (err) { + conn.on('error', function(err) { errs.push(err); if (errs.length > 1 && errs[0] === errs[1]) - assert(false, "We should not be emitting the same error twice"); + assert(false, 'We should not be emitting the same error twice'); }); conn.on('close', function() { srv.unref(); }); -}).listen(common.PORT, function () { +}).listen(common.PORT, function() { var client = net.connect({ port: common.PORT }); - client.on('connect', function () { + client.on('connect', function() { client.destroy(); }); }); diff --git a/test/parallel/test-net-isip.js b/test/parallel/test-net-isip.js index 1947810b82deb8..96177122b7ba21 100644 --- a/test/parallel/test-net-isip.js +++ b/test/parallel/test-net-isip.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -29,7 +30,7 @@ assert.equal(net.isIP('::'), 6); assert.equal(net.isIP('0000:0000:0000:0000:0000:0000:12345:0000'), 0); assert.equal(net.isIP('0'), 0); assert.equal(net.isIP(), 0); -assert.equal(net.isIP(""), 0); +assert.equal(net.isIP(''), 0); assert.equal(net.isIPv4('127.0.0.1'), true); assert.equal(net.isIPv4('example.com'), false); diff --git a/test/parallel/test-net-keepalive.js b/test/parallel/test-net-keepalive.js index f5299c9eb34c0e..3c339f7abaa350 100644 --- a/test/parallel/test-net-keepalive.js +++ b/test/parallel/test-net-keepalive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-large-string.js b/test/parallel/test-net-large-string.js index 318f25a1c9a1e2..387f3f4f8c1dd3 100644 --- a/test/parallel/test-net-large-string.js +++ b/test/parallel/test-net-large-string.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-listen-close-server-callback-is-not-function.js b/test/parallel/test-net-listen-close-server-callback-is-not-function.js index f4eff779406e0f..7450cb16fc7943 100644 --- a/test/parallel/test-net-listen-close-server-callback-is-not-function.js +++ b/test/parallel/test-net-listen-close-server-callback-is-not-function.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var net = require('net'); diff --git a/test/parallel/test-net-listen-close-server.js b/test/parallel/test-net-listen-close-server.js index e3a73e6ae5cb60..9c4dbcfe2e15e2 100644 --- a/test/parallel/test-net-listen-close-server.js +++ b/test/parallel/test-net-listen-close-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-listen-error.js b/test/parallel/test-net-listen-error.js index 0ed2421fdfbca9..b0d8aac8f816e3 100644 --- a/test/parallel/test-net-listen-error.js +++ b/test/parallel/test-net-listen-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-listen-fd0.js b/test/parallel/test-net-listen-fd0.js index 7cfd49dbdd3d27..bf437268c92945 100644 --- a/test/parallel/test-net-listen-fd0.js +++ b/test/parallel/test-net-listen-fd0.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -14,6 +15,6 @@ net.createServer(assert.fail).listen({fd:0}).on('error', function(e) { case 'EINVAL': case 'ENOTSOCK': gotError = e; - break + break; } }); diff --git a/test/parallel/test-net-listen-port-option.js b/test/parallel/test-net-listen-port-option.js index 1b9938f7c7f155..d1eddb6707c274 100644 --- a/test/parallel/test-net-listen-port-option.js +++ b/test/parallel/test-net-listen-port-option.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-listen-shared-ports.js b/test/parallel/test-net-listen-shared-ports.js index 3139dc7ac29365..2062dd0ce136bb 100644 --- a/test/parallel/test-net-listen-shared-ports.js +++ b/test/parallel/test-net-listen-shared-ports.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/parallel/test-net-local-address-port.js b/test/parallel/test-net-local-address-port.js index 0bbfee80211d0c..aa28d180dae6ff 100644 --- a/test/parallel/test-net-local-address-port.js +++ b/test/parallel/test-net-local-address-port.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-localerror.js b/test/parallel/test-net-localerror.js index c2ef96165a6e70..45ec1fc9099955 100644 --- a/test/parallel/test-net-localerror.js +++ b/test/parallel/test-net-localerror.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-pause-resume-connecting.js b/test/parallel/test-net-pause-resume-connecting.js index b692f3508529e1..fb3b66c8cf991c 100644 --- a/test/parallel/test-net-pause-resume-connecting.js +++ b/test/parallel/test-net-pause-resume-connecting.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), net = require('net'); diff --git a/test/parallel/test-net-pingpong.js b/test/parallel/test-net-pingpong.js index 7a05591caf969b..9a0c8af5b0697d 100644 --- a/test/parallel/test-net-pingpong.js +++ b/test/parallel/test-net-pingpong.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-pipe-connect-errors.js b/test/parallel/test-net-pipe-connect-errors.js index 5150c6de819787..a831b107122c8d 100644 --- a/test/parallel/test-net-pipe-connect-errors.js +++ b/test/parallel/test-net-pipe-connect-errors.js @@ -1,3 +1,4 @@ +'use strict'; var fs = require('fs'); var net = require('net'); var path = require('path'); diff --git a/test/parallel/test-net-reconnect-error.js b/test/parallel/test-net-reconnect-error.js index 541a481fe12705..ed889829ec8abe 100644 --- a/test/parallel/test-net-reconnect-error.js +++ b/test/parallel/test-net-reconnect-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/parallel/test-net-reconnect.js b/test/parallel/test-net-reconnect.js index d65efac998102b..b2e8f6ea8b4e3f 100644 --- a/test/parallel/test-net-reconnect.js +++ b/test/parallel/test-net-reconnect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-remote-address-port.js b/test/parallel/test-net-remote-address-port.js index 2f8c673b57ef98..11d753ea460b79 100644 --- a/test/parallel/test-net-remote-address-port.js +++ b/test/parallel/test-net-remote-address-port.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-server-close.js b/test/parallel/test-net-server-close.js index 4101baf166b555..446b835a4c67df 100644 --- a/test/parallel/test-net-server-close.js +++ b/test/parallel/test-net-server-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -23,7 +24,7 @@ var server = net.createServer(function(c) { if (sockets.length === 2) { server.close(); - sockets.forEach(function(c) { c.destroy() }); + sockets.forEach(function(c) { c.destroy(); }); } }); diff --git a/test/parallel/test-net-server-connections.js b/test/parallel/test-net-server-connections.js index 76e9c2af1cc97f..138a78defb260d 100644 --- a/test/parallel/test-net-server-connections.js +++ b/test/parallel/test-net-server-connections.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-server-listen-remove-callback.js b/test/parallel/test-net-server-listen-remove-callback.js index d9a5a8bdec4934..a7d54081a6bb03 100644 --- a/test/parallel/test-net-server-listen-remove-callback.js +++ b/test/parallel/test-net-server-listen-remove-callback.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-server-max-connections.js b/test/parallel/test-net-server-max-connections.js index ea89bd9d9b04a9..3b425ba3358fb5 100644 --- a/test/parallel/test-net-server-max-connections.js +++ b/test/parallel/test-net-server-max-connections.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-server-pause-on-connect.js b/test/parallel/test-net-server-pause-on-connect.js index 0f47565f0098d0..db57114302f490 100644 --- a/test/parallel/test-net-server-pause-on-connect.js +++ b/test/parallel/test-net-server-pause-on-connect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-server-try-ports.js b/test/parallel/test-net-server-try-ports.js index 698cbcfa23e7c6..65cd5887a1356d 100644 --- a/test/parallel/test-net-server-try-ports.js +++ b/test/parallel/test-net-server-try-ports.js @@ -1,3 +1,4 @@ +'use strict'; // This tests binds to one port, then attempts to start a server on that // port. It should be EADDRINUSE but be able to then bind to another port. var common = require('../common'); diff --git a/test/parallel/test-net-server-unref-persistent.js b/test/parallel/test-net-server-unref-persistent.js index 3a5092b92e0b8f..a071b625ef26d7 100644 --- a/test/parallel/test-net-server-unref-persistent.js +++ b/test/parallel/test-net-server-unref-persistent.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-server-unref.js b/test/parallel/test-net-server-unref.js index 2365864d6b41f3..98e95d6f105a84 100644 --- a/test/parallel/test-net-server-unref.js +++ b/test/parallel/test-net-server-unref.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-net-settimeout.js b/test/parallel/test-net-settimeout.js index a11c4a12ed0ce5..a1172b92e1dead 100644 --- a/test/parallel/test-net-settimeout.js +++ b/test/parallel/test-net-settimeout.js @@ -1,3 +1,4 @@ +'use strict'; // This example sets a timeout then immediately attempts to disable the timeout // https://github.com/joyent/node/pull/2245 diff --git a/test/parallel/test-net-socket-destroy-twice.js b/test/parallel/test-net-socket-destroy-twice.js index 2782048bd521c7..f23a70abb2c9a0 100644 --- a/test/parallel/test-net-socket-destroy-twice.js +++ b/test/parallel/test-net-socket-destroy-twice.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-socket-timeout-unref.js b/test/parallel/test-net-socket-timeout-unref.js index 16bdcecaf17e78..c7e651afef015f 100644 --- a/test/parallel/test-net-socket-timeout-unref.js +++ b/test/parallel/test-net-socket-timeout-unref.js @@ -1,8 +1,9 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); -var server = net.createServer(function (c) { +var server = net.createServer(function(c) { c.write('hello'); c.unref(); }); @@ -11,9 +12,9 @@ server.unref(); var timedout = false; -[8, 5, 3, 6, 2, 4].forEach(function (T) { +[8, 5, 3, 6, 2, 4].forEach(function(T) { var socket = net.createConnection(common.PORT, 'localhost'); - socket.setTimeout(T * 1000, function () { + socket.setTimeout(T * 1000, function() { console.log(process._getActiveHandles()); timedout = true; socket.destroy(); @@ -21,6 +22,7 @@ var timedout = false; socket.unref(); }); -process.on('exit', function () { - assert.strictEqual(timedout, false, 'Socket timeout should not hold loop open'); +process.on('exit', function() { + assert.strictEqual(timedout, false, + 'Socket timeout should not hold loop open'); }); diff --git a/test/parallel/test-net-socket-timeout.js b/test/parallel/test-net-socket-timeout.js index f4038298763e8d..5ab11909b4c306 100644 --- a/test/parallel/test-net-socket-timeout.js +++ b/test/parallel/test-net-socket-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/parallel/test-net-stream.js b/test/parallel/test-net-stream.js index 8f7efd45f6d18d..151b1b178f9adc 100644 --- a/test/parallel/test-net-stream.js +++ b/test/parallel/test-net-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -29,7 +30,7 @@ var server = net.createServer(function(socket) { socket.destroy(); }).on('close', function() { server.close(); - }) + }); for (var i = 0; i < N; ++i) { socket.write(buf, function() { }); diff --git a/test/parallel/test-net-write-after-close.js b/test/parallel/test-net-write-after-close.js index aaec89874674f3..b9516b839263cf 100644 --- a/test/parallel/test-net-write-after-close.js +++ b/test/parallel/test-net-write-after-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-write-connect-write.js b/test/parallel/test-net-write-connect-write.js index fbf6b51e6a1f5c..17b1b576d188be 100644 --- a/test/parallel/test-net-write-connect-write.js +++ b/test/parallel/test-net-write-connect-write.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-net-write-slow.js b/test/parallel/test-net-write-slow.js index 0b1cf4f5b2c9a5..4b8163984f556a 100644 --- a/test/parallel/test-net-write-slow.js +++ b/test/parallel/test-net-write-slow.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/parallel/test-next-tick-doesnt-hang.js b/test/parallel/test-next-tick-doesnt-hang.js index 7364b2f974d128..5e63463d4d1f94 100644 --- a/test/parallel/test-next-tick-doesnt-hang.js +++ b/test/parallel/test-next-tick-doesnt-hang.js @@ -1,3 +1,4 @@ +'use strict'; /* * This test verifies that having a single nextTick statement and nothing else * does not hang the event loop. If this test times out it has failed. diff --git a/test/parallel/test-next-tick-domain.js b/test/parallel/test-next-tick-domain.js index b07d741f65264f..4d53bba6c4f5cc 100644 --- a/test/parallel/test-next-tick-domain.js +++ b/test/parallel/test-next-tick-domain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -5,4 +6,5 @@ var origNextTick = process.nextTick; require('domain'); -assert.strictEqual(origNextTick, process.nextTick, 'Requiring domain should not change nextTick'); +assert.strictEqual(origNextTick, process.nextTick, + 'Requiring domain should not change nextTick'); diff --git a/test/parallel/test-next-tick-errors.js b/test/parallel/test-next-tick-errors.js index c2e635d5c5bd5c..eccd7a43a0825f 100644 --- a/test/parallel/test-next-tick-errors.js +++ b/test/parallel/test-next-tick-errors.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-next-tick-intentional-starvation.js b/test/parallel/test-next-tick-intentional-starvation.js index 5c8b414dcfead9..d4a8a1b7481329 100644 --- a/test/parallel/test-next-tick-intentional-starvation.js +++ b/test/parallel/test-next-tick-intentional-starvation.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-next-tick-ordering.js b/test/parallel/test-next-tick-ordering.js index 4340736aefec35..c2b936a1061d52 100644 --- a/test/parallel/test-next-tick-ordering.js +++ b/test/parallel/test-next-tick-ordering.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var i; diff --git a/test/parallel/test-next-tick-ordering2.js b/test/parallel/test-next-tick-ordering2.js index 69d4897fdbf9d2..4252d623679f65 100644 --- a/test/parallel/test-next-tick-ordering2.js +++ b/test/parallel/test-next-tick-ordering2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-next-tick.js b/test/parallel/test-next-tick.js index 1081a96fa2e35d..54e7b88cf022ca 100644 --- a/test/parallel/test-next-tick.js +++ b/test/parallel/test-next-tick.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index dd1a1ae339b385..31b92f7280c6cd 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var os = require('os'); diff --git a/test/parallel/test-path-makelong.js b/test/parallel/test-path-makelong.js index 51d6404c4d4385..b9cc116a5ed90e 100644 --- a/test/parallel/test-path-makelong.js +++ b/test/parallel/test-path-makelong.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var path = require('path'); var common = require('../common'); diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js index d31dc995720030..37f37fc9b57c17 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var path = require('path'); @@ -30,18 +31,30 @@ var unixPaths = [ ]; var errors = [ - {method: 'parse', input: [null], message: /Path must be a string. Received null/}, - {method: 'parse', input: [{}], message: /Path must be a string. Received {}/}, - {method: 'parse', input: [true], message: /Path must be a string. Received true/}, - {method: 'parse', input: [1], message: /Path must be a string. Received 1/}, - {method: 'parse', input: [], message: /Path must be a string. Received undefined/}, - // {method: 'parse', input: [''], message: /Invalid path/}, // omitted because it's hard to trigger! - {method: 'format', input: [null], message: /Parameter 'pathObject' must be an object, not/}, - {method: 'format', input: [''], message: /Parameter 'pathObject' must be an object, not string/}, - {method: 'format', input: [true], message: /Parameter 'pathObject' must be an object, not boolean/}, - {method: 'format', input: [1], message: /Parameter 'pathObject' must be an object, not number/}, - {method: 'format', input: [{root: true}], message: /'pathObject.root' must be a string or undefined, not boolean/}, - {method: 'format', input: [{root: 12}], message: /'pathObject.root' must be a string or undefined, not number/}, + {method: 'parse', input: [null], + message: /Path must be a string. Received null/}, + {method: 'parse', input: [{}], + message: /Path must be a string. Received {}/}, + {method: 'parse', input: [true], + message: /Path must be a string. Received true/}, + {method: 'parse', input: [1], + message: /Path must be a string. Received 1/}, + {method: 'parse', input: [], + message: /Path must be a string. Received undefined/}, + // {method: 'parse', input: [''], + // message: /Invalid path/}, // omitted because it's hard to trigger! + {method: 'format', input: [null], + message: /Parameter 'pathObject' must be an object, not/}, + {method: 'format', input: [''], + message: /Parameter 'pathObject' must be an object, not string/}, + {method: 'format', input: [true], + message: /Parameter 'pathObject' must be an object, not boolean/}, + {method: 'format', input: [1], + message: /Parameter 'pathObject' must be an object, not number/}, + {method: 'format', input: [{root: true}], + message: /'pathObject.root' must be a string or undefined, not boolean/}, + {method: 'format', input: [{root: 12}], + message: /'pathObject.root' must be a string or undefined, not number/}, ]; check(path.win32, winPaths); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index e0e9c5d5671e4e..b1209d762a53d3 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index 01c23cb418e426..12ce742c905bba 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-pipe-return-val.js b/test/parallel/test-pipe-return-val.js index 6a333584f8f315..718d052cd24c27 100644 --- a/test/parallel/test-pipe-return-val.js +++ b/test/parallel/test-pipe-return-val.js @@ -1,3 +1,4 @@ +'use strict'; // This test ensures SourceStream.pipe(DestStream) returns DestStream var common = require('../common'); diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 3f986d638fbd44..e6bbfda1dc5487 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), path = require('path'), @@ -12,15 +13,15 @@ var preloadOption = function(preloads) { option += '-r ' + preload + ' '; }); return option; -} +}; var fixture = function(name) { return path.join(__dirname, '../fixtures/' + name); -} +}; var fixtureA = fixture('printA.js'); var fixtureB = fixture('printB.js'); -var fixtureC = fixture('printC.js') +var fixtureC = fixture('printC.js'); var fixtureThrows = fixture('throws_error4.js'); // test preloading a single module works diff --git a/test/parallel/test-process-argv-0.js b/test/parallel/test-process-argv-0.js index daf8cb60ebff0d..4bdb7ac3e71971 100644 --- a/test/parallel/test-process-argv-0.js +++ b/test/parallel/test-process-argv-0.js @@ -1,3 +1,4 @@ +'use strict'; var util = require('util'); var path = require('path'); var assert = require('assert'); @@ -7,8 +8,8 @@ var common = require('../common'); console.error('argv=%j', process.argv); console.error('exec=%j', process.execPath); -if (process.argv[2] !== "child") { - var child = spawn('./iojs', [__filename, "child"], { +if (process.argv[2] !== 'child') { + var child = spawn('./iojs', [__filename, 'child'], { cwd: path.dirname(process.execPath) }); @@ -20,7 +21,7 @@ if (process.argv[2] !== "child") { child.stderr.on('data', function(chunk) { childErr += chunk; }); - child.on('exit', function () { + child.on('exit', function() { console.error('CHILD: %s', childErr.trim().split('\n').join('\nCHILD: ')); assert.equal(childArgv0, process.execPath); }); diff --git a/test/parallel/test-process-before-exit.js b/test/parallel/test-process-before-exit.js index 48639c249ddec1..eff96da98e4729 100644 --- a/test/parallel/test-process-before-exit.js +++ b/test/parallel/test-process-before-exit.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-process-binding.js b/test/parallel/test-process-binding.js index c803a8083f22b4..dad2816d40c185 100644 --- a/test/parallel/test-process-binding.js +++ b/test/parallel/test-process-binding.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); assert.throws( @@ -7,10 +8,10 @@ assert.throws( /No such module: test/ ); -assert.doesNotThrow(function () { +assert.doesNotThrow(function() { process.binding('buffer'); }, function(err) { if ( (err instanceof Error) ) { return true; } -}, "unexpected error"); +}, 'unexpected error'); diff --git a/test/parallel/test-process-config.js b/test/parallel/test-process-config.js index d9260ca94d6ff3..4fc3bcaa98afc8 100644 --- a/test/parallel/test-process-config.js +++ b/test/parallel/test-process-config.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); diff --git a/test/parallel/test-process-env.js b/test/parallel/test-process-env.js index f3e2957ba621a7..7e927d09bae668 100644 --- a/test/parallel/test-process-env.js +++ b/test/parallel/test-process-env.js @@ -1,3 +1,6 @@ +'use strict'; +/* eslint-disable max-len */ + // first things first, set the timezone; see tzset(3) process.env.TZ = 'Europe/Amsterdam'; diff --git a/test/parallel/test-process-exec-argv.js b/test/parallel/test-process-exec-argv.js index 7344000739576e..59c4264ee3c8b7 100644 --- a/test/parallel/test-process-exec-argv.js +++ b/test/parallel/test-process-exec-argv.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var spawn = require('child_process').spawn; @@ -9,11 +10,11 @@ if (process.argv[2] === 'child') { var child = spawn(process.execPath, execArgv.concat(args)); var out = ''; - child.stdout.on('data', function (chunk) { + child.stdout.on('data', function(chunk) { out += chunk; }); - child.on('exit', function () { + child.on('exit', function() { assert.deepEqual(JSON.parse(out), execArgv); }); } diff --git a/test/parallel/test-process-exit-code.js b/test/parallel/test-process-exit-code.js index 610cf662987850..fea8c2d4fcdc5d 100644 --- a/test/parallel/test-process-exit-code.js +++ b/test/parallel/test-process-exit-code.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-process-exit-from-before-exit.js b/test/parallel/test-process-exit-from-before-exit.js index e222f35245fb7d..30d358cb76da9d 100644 --- a/test/parallel/test-process-exit-from-before-exit.js +++ b/test/parallel/test-process-exit-from-before-exit.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-process-exit-recursive.js b/test/parallel/test-process-exit-recursive.js index a326ec7f630e8c..c1ee13370b26ca 100644 --- a/test/parallel/test-process-exit-recursive.js +++ b/test/parallel/test-process-exit-recursive.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); // recursively calling .exit() should not overflow the call stack diff --git a/test/parallel/test-process-exit.js b/test/parallel/test-process-exit.js index 58d7a276996c3c..999eefc1eff518 100644 --- a/test/parallel/test-process-exit.js +++ b/test/parallel/test-process-exit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-process-getgroups.js b/test/parallel/test-process-getgroups.js index f7c80ca6e02003..1cb5f38c1db203 100644 --- a/test/parallel/test-process-getgroups.js +++ b/test/parallel/test-process-getgroups.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; diff --git a/test/parallel/test-process-hrtime.js b/test/parallel/test-process-hrtime.js index c845f919bb2efd..0e2c5b110e9292 100644 --- a/test/parallel/test-process-hrtime.js +++ b/test/parallel/test-process-hrtime.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -18,7 +19,7 @@ assert.throws(function() { function validateTuple(tuple) { assert(Array.isArray(tuple)); assert.equal(2, tuple.length); - tuple.forEach(function (v) { + tuple.forEach(function(v) { assert.equal('number', typeof v); assert(isFinite(v)); }); diff --git a/test/parallel/test-process-kill-null.js b/test/parallel/test-process-kill-null.js index 77e2a8bb5ee5cb..65dab752f12e6d 100644 --- a/test/parallel/test-process-kill-null.js +++ b/test/parallel/test-process-kill-null.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 22ec5a68145961..f193e979166da7 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -20,8 +21,8 @@ assert.throws(function() { process.kill('SIGTERM'); }, TypeError); assert.throws(function() { process.kill(null); }, TypeError); assert.throws(function() { process.kill(undefined); }, TypeError); assert.throws(function() { process.kill(+'not a number'); }, TypeError); -assert.throws(function() { process.kill(1/0); }, TypeError); -assert.throws(function() { process.kill(-1/0); }, TypeError); +assert.throws(function() { process.kill(1 / 0); }, TypeError); +assert.throws(function() { process.kill(-1 / 0); }, TypeError); // Test kill argument processing in valid cases. // diff --git a/test/parallel/test-process-next-tick.js b/test/parallel/test-process-next-tick.js index 3b2d37ef68a3be..e7b5f8f3fe886e 100644 --- a/test/parallel/test-process-next-tick.js +++ b/test/parallel/test-process-next-tick.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var N = 2; diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js index 2264e59937517b..f849457d643894 100644 --- a/test/parallel/test-process-raw-debug.js +++ b/test/parallel/test-process-raw-debug.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var os = require('os'); diff --git a/test/parallel/test-process-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index e5dd5a13a16fca..408f6596c4419e 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -1,3 +1,4 @@ +'use strict'; if (process.platform === 'win32') { // Win32 doesn't have signals, just a kindof emulation, insufficient // for this test to apply. diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index c3159789cefeae..637ada7fa8e349 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-process-wrap.js b/test/parallel/test-process-wrap.js index f3d903adb11448..bf3dfe4e8b1651 100644 --- a/test/parallel/test-process-wrap.js +++ b/test/parallel/test-process-wrap.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Process = process.binding('process_wrap').Process; diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 997d147a6dcc34..9a186de8dfec79 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var domain = require('domain'); @@ -105,7 +106,8 @@ function onUnhandledFail(done) { }, 10); } -asyncTest('synchronously rejected promise should trigger unhandledRejection', function(done) { +asyncTest('synchronously rejected promise should trigger' + + ' unhandledRejection', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -113,7 +115,8 @@ asyncTest('synchronously rejected promise should trigger unhandledRejection', fu Promise.reject(e); }); -asyncTest('synchronously rejected promise should trigger unhandledRejection', function(done) { +asyncTest('synchronously rejected promise should trigger' + + ' unhandledRejection', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -123,7 +126,8 @@ asyncTest('synchronously rejected promise should trigger unhandledRejection', fu }); }); -asyncTest('Promise rejected after setImmediate should trigger unhandledRejection', function(done) { +asyncTest('Promise rejected after setImmediate should trigger' + + ' unhandledRejection', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -135,7 +139,8 @@ asyncTest('Promise rejected after setImmediate should trigger unhandledRejection }); }); -asyncTest('Promise rejected after setTimeout(,1) should trigger unhandled rejection', function(done) { +asyncTest('Promise rejected after setTimeout(,1) should trigger' + + ' unhandled rejection', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -147,7 +152,8 @@ asyncTest('Promise rejected after setTimeout(,1) should trigger unhandled reject }); }); -asyncTest('Catching a promise rejection after setImmediate is not soon enough to stop unhandledRejection', function(done) { +asyncTest('Catching a promise rejection after setImmediate is not' + + ' soon enough to stop unhandledRejection', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -155,14 +161,15 @@ asyncTest('Catching a promise rejection after setImmediate is not soon enough to var _reject; var promise = new Promise(function(_, reject) { _reject = reject; - }) + }); _reject(e); setImmediate(function() { - promise.then(assert.fail, function(){}); + promise.then(assert.fail, function() {}); }); }); -asyncTest('When re-throwing new errors in a promise catch, only the re-thrown error should hit unhandledRejection', function(done) { +asyncTest('When re-throwing new errors in a promise catch, only the' + + ' re-thrown error should hit unhandledRejection', function(done) { var e = new Error(); var e2 = new Error(); onUnhandledSucceed(done, function(reason, promise) { @@ -175,7 +182,8 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown er }); }); -asyncTest('Test params of unhandledRejection for a synchronously-rejected promise', function(done) { +asyncTest('Test params of unhandledRejection for a synchronously-rejected' + + 'promise', function(done) { var e = new Error(); var e2 = new Error(); onUnhandledSucceed(done, function(reason, promise) { @@ -185,7 +193,9 @@ asyncTest('Test params of unhandledRejection for a synchronously-rejected promis var promise = Promise.reject(e); }); -asyncTest('When re-throwing new errors in a promise catch, only the re-thrown error should hit unhandledRejection: original promise rejected async with setTimeout(,1)', function(done) { +asyncTest('When re-throwing new errors in a promise catch, only the ' + + 're-thrown error should hit unhandledRejection: original promise' + + ' rejected async with setTimeout(,1)', function(done) { var e = new Error(); var e2 = new Error(); onUnhandledSucceed(done, function(reason, promise) { @@ -202,7 +212,9 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown er }); }); -asyncTest('When re-throwing new errors in a promise catch, only the re-thrown error should hit unhandledRejection: promise catch attached a process.nextTick after rejection', function(done) { +asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' + + ' error should hit unhandledRejection: promise catch attached a' + + ' process.nextTick after rejection', function(done) { var e = new Error(); var e2 = new Error(); onUnhandledSucceed(done, function(reason, promise) { @@ -223,42 +235,50 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown er var promise2; }); -asyncTest('unhandledRejection should not be triggered if a promise catch is attached synchronously upon the promise\'s creation', function(done) { +asyncTest('unhandledRejection should not be triggered if a promise catch is' + + ' attached synchronously upon the promise\'s creation', + function(done) { var e = new Error(); onUnhandledFail(done); - Promise.reject(e).then(assert.fail, function(){}); + Promise.reject(e).then(assert.fail, function() {}); }); -asyncTest('unhandledRejection should not be triggered if a promise catch is attached synchronously upon the promise\'s creation', function(done) { +asyncTest('unhandledRejection should not be triggered if a promise catch is' + + ' attached synchronously upon the promise\'s creation', + function(done) { var e = new Error(); onUnhandledFail(done); new Promise(function(_, reject) { reject(e); - }).then(assert.fail, function(){}); + }).then(assert.fail, function() {}); }); -asyncTest('Attaching a promise catch in a process.nextTick is soon enough to prevent unhandledRejection', function(done) { +asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' + + ' prevent unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); var promise = Promise.reject(e); process.nextTick(function() { - promise.then(assert.fail, function(){}); + promise.then(assert.fail, function() {}); }); }); -asyncTest('Attaching a promise catch in a process.nextTick is soon enough to prevent unhandledRejection', function(done) { +asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' + + ' prevent unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); var promise = new Promise(function(_, reject) { reject(e); }); process.nextTick(function() { - promise.then(assert.fail, function(){}); + promise.then(assert.fail, function() {}); }); }); // State adapation tests -asyncTest('catching a promise which is asynchronously rejected (via resolution to an asynchronously-rejected promise) prevents unhandledRejection', function(done) { +asyncTest('catching a promise which is asynchronously rejected (via' + + 'resolution to an asynchronously-rejected promise) prevents' + + ' unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); Promise.resolve().then(function() { @@ -272,7 +292,8 @@ asyncTest('catching a promise which is asynchronously rejected (via resolution t }); }); -asyncTest('Catching a rejected promise derived from throwing in a fulfillment handler prevents unhandledRejection', function(done) { +asyncTest('Catching a rejected promise derived from throwing in a' + + ' fulfillment handler prevents unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); Promise.resolve().then(function() { @@ -282,7 +303,9 @@ asyncTest('Catching a rejected promise derived from throwing in a fulfillment ha }); }); -asyncTest('Catching a rejected promise derived from returning a synchronously-rejected promise in a fulfillment handler prevents unhandledRejection', function(done) { +asyncTest('Catching a rejected promise derived from returning a' + + ' synchronously-rejected promise in a fulfillment handler' + + ' prevents unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); Promise.resolve().then(function() { @@ -292,7 +315,9 @@ asyncTest('Catching a rejected promise derived from returning a synchronously-re }); }); -asyncTest('A rejected promise derived from returning an asynchronously-rejected promise in a fulfillment handler does trigger unhandledRejection', function(done) { +asyncTest('A rejected promise derived from returning an' + + ' asynchronously-rejected promise in a fulfillment handler' + + ' does trigger unhandledRejection', function(done) { var e = new Error(); var _promise; onUnhandledSucceed(done, function(reason, promise) { @@ -308,7 +333,8 @@ asyncTest('A rejected promise derived from returning an asynchronously-rejected }); }); -asyncTest('A rejected promise derived from throwing in a fulfillment handler does trigger unhandledRejection', function(done) { +asyncTest('A rejected promise derived from throwing in a fulfillment handler' + + ' does trigger unhandledRejection', function(done) { var e = new Error(); var _promise; onUnhandledSucceed(done, function(reason, promise) { @@ -320,7 +346,9 @@ asyncTest('A rejected promise derived from throwing in a fulfillment handler doe }); }); -asyncTest('A rejected promise derived from returning a synchronously-rejected promise in a fulfillment handler does trigger unhandledRejection', function(done) { +asyncTest('A rejected promise derived from returning a synchronously-rejected' + + ' promise in a fulfillment handler does trigger unhandledRejection', + function(done) { var e = new Error(); var _promise; onUnhandledSucceed(done, function(reason, promise) { @@ -333,13 +361,16 @@ asyncTest('A rejected promise derived from returning a synchronously-rejected pr }); // Combinations with Promise.all -asyncTest('Catching the Promise.all() of a collection that includes a rejected promise prevents unhandledRejection', function(done) { +asyncTest('Catching the Promise.all() of a collection that includes a' + + 'rejected promise prevents unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); Promise.all([Promise.reject(e)]).then(assert.fail, function() {}); }); -asyncTest('Catching the Promise.all() of a collection that includes a nextTick-async rejected promise prevents unhandledRejection', function(done) { +asyncTest('Catching the Promise.all() of a collection that includes a ' + + 'nextTick-async rejected promise prevents unhandledRejection', + function(done) { var e = new Error(); onUnhandledFail(done); var p = new Promise(function(_, reject) { @@ -353,7 +384,9 @@ asyncTest('Catching the Promise.all() of a collection that includes a nextTick-a }); }); -asyncTest('Failing to catch the Promise.all() of a collection that includes a rejected promise triggers unhandledRejection for the returned promise, not the passed promise', function(done) { +asyncTest('Failing to catch the Promise.all() of a collection that includes' + + ' a rejected promise triggers unhandledRejection for the returned' + + ' promise, not the passed promise', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -362,7 +395,8 @@ asyncTest('Failing to catch the Promise.all() of a collection that includes a re var p = Promise.all([Promise.reject(e)]); }); -asyncTest('Waiting setTimeout(, 10) to catch a promise causes an unhandledRejection + rejectionHandled pair', function(done) { +asyncTest('Waiting setTimeout(, 10) to catch a promise causes an' + + ' unhandledRejection + rejectionHandled pair', function(done) { clean(); var unhandledPromises = []; var e = new Error(); @@ -387,7 +421,9 @@ asyncTest('Waiting setTimeout(, 10) to catch a promise causes an unhandledReject }, 10); }); -asyncTest('Waiting for some combination of process.nextTick + promise microtasks to attach a catch handler is still soon enough to prevent unhandledRejection', function(done) { +asyncTest('Waiting for some combination of process.nextTick + promise' + + ' microtasks to attach a catch handler is still soon enough to' + + ' prevent unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); @@ -404,7 +440,9 @@ asyncTest('Waiting for some combination of process.nextTick + promise microtasks }); }); -asyncTest('Waiting for some combination of process.nextTick + promise microtasks to attach a catch handler is still soon enough to prevent unhandledRejection: inside setImmediate', function(done) { +asyncTest('Waiting for some combination of process.nextTick + promise' + + ' microtasks to attach a catch handler is still soon enough to ' + + 'prevent unhandledRejection: inside setImmediate', function(done) { var e = new Error(); onUnhandledFail(done); @@ -422,7 +460,9 @@ asyncTest('Waiting for some combination of process.nextTick + promise microtasks }); }); -asyncTest('Waiting for some combination of process.nextTick + promise microtasks to attach a catch handler is still soon enough to prevent unhandledRejection: inside setTimeout', function(done) { +asyncTest('Waiting for some combination of process.nextTick + promise ' + + 'microtasks to attach a catch handler is still soon enough to ' + + 'prevent unhandledRejection: inside setTimeout', function(done) { var e = new Error(); onUnhandledFail(done); @@ -440,7 +480,9 @@ asyncTest('Waiting for some combination of process.nextTick + promise microtasks }, 0); }); -asyncTest('Waiting for some combination of promise microtasks + process.nextTick to attach a catch handler is still soon enough to prevent unhandledRejection', function(done) { +asyncTest('Waiting for some combination of promise microtasks + ' + + 'process.nextTick to attach a catch handler is still soon enough' + + ' to prevent unhandledRejection', function(done) { var e = new Error(); onUnhandledFail(done); @@ -457,7 +499,10 @@ asyncTest('Waiting for some combination of promise microtasks + process.nextTick }); }); -asyncTest('Waiting for some combination of promise microtasks + process.nextTick to attach a catch handler is still soon enough to prevent unhandledRejection: inside setImmediate', function(done) { +asyncTest('Waiting for some combination of promise microtasks +' + + ' process.nextTick to attach a catch handler is still soon enough' + + ' to prevent unhandledRejection: inside setImmediate', + function(done) { var e = new Error(); onUnhandledFail(done); @@ -475,7 +520,9 @@ asyncTest('Waiting for some combination of promise microtasks + process.nextTick }); }); -asyncTest('Waiting for some combination of promise microtasks + process.nextTick to attach a catch handler is still soon enough to prevent unhandledRejection: inside setTimeout', function(done) { +asyncTest('Waiting for some combination of promise microtasks +' + + ' process.nextTick to attach a catch handler is still soon enough' + + ' to prevent unhandledRejection: inside setTimeout', function(done) { var e = new Error(); onUnhandledFail(done); @@ -493,7 +540,9 @@ asyncTest('Waiting for some combination of promise microtasks + process.nextTick }, 0); }); -asyncTest('setImmediate + promise microtasks is too late to attach a catch handler; unhandledRejection will be triggered in that case. (setImmediate before promise creation/rejection)', function(done) { +asyncTest('setImmediate + promise microtasks is too late to attach a catch' + + ' handler; unhandledRejection will be triggered in that case.' + + ' (setImmediate before promise creation/rejection)', function(done) { var e = new Error(); onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(e, reason); @@ -501,23 +550,25 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch handl }); var p = Promise.reject(e); setImmediate(function() { - Promise.resolve().then(function () { - p.catch(function(){}); + Promise.resolve().then(function() { + p.catch(function() {}); }); }); }); -asyncTest('setImmediate + promise microtasks is too late to attach a catch handler; unhandledRejection will be triggered in that case (setImmediate before promise creation/rejection)', function(done) { +asyncTest('setImmediate + promise microtasks is too late to attach a catch' + + ' handler; unhandledRejection will be triggered in that case' + + ' (setImmediate before promise creation/rejection)', function(done) { onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(undefined, reason); assert.strictEqual(p, promise); }); setImmediate(function() { - Promise.resolve().then(function () { - Promise.resolve().then(function () { - Promise.resolve().then(function () { - Promise.resolve().then(function () { - p.catch(function(){}); + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + p.catch(function() {}); }); }); }); @@ -526,18 +577,20 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch handl var p = Promise.reject(); }); -asyncTest('setImmediate + promise microtasks is too late to attach a catch handler; unhandledRejection will be triggered in that case (setImmediate after promise creation/rejection)', function(done) { +asyncTest('setImmediate + promise microtasks is too late to attach a catch' + + ' handler; unhandledRejection will be triggered in that case' + + ' (setImmediate after promise creation/rejection)', function(done) { onUnhandledSucceed(done, function(reason, promise) { assert.strictEqual(undefined, reason); assert.strictEqual(p, promise); }); var p = Promise.reject(); setImmediate(function() { - Promise.resolve().then(function () { - Promise.resolve().then(function () { - Promise.resolve().then(function () { - Promise.resolve().then(function () { - p.catch(function(){}); + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + p.catch(function() {}); }); }); }); @@ -545,7 +598,9 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch handl }); }); -asyncTest('Promise unhandledRejection handler does not interfere with domain error handlers being given exceptions thrown from nextTick.', function(done) { +asyncTest('Promise unhandledRejection handler does not interfere with domain' + + ' error handlers being given exceptions thrown from nextTick.', + function(done) { var d = domain.create(); var domainReceivedError; d.on('error', function(e) { @@ -566,7 +621,8 @@ asyncTest('Promise unhandledRejection handler does not interfere with domain err }); }); -asyncTest('nextTick is immediately scheduled when called inside an event handler', function(done) { +asyncTest('nextTick is immediately scheduled when called inside an event' + + ' handler', function(done) { clean(); var e = new Error('error'); process.on('unhandledRejection', function(reason, promise) { @@ -576,21 +632,23 @@ asyncTest('nextTick is immediately scheduled when called inside an event handler }); setTimeout(function() { order.push(2); - assert.deepEqual([1,2], order); + assert.deepEqual([1, 2], order); done(); }, 1); }); Promise.reject(e); }); -asyncTest('Throwing an error inside a rejectionHandled handler goes to unhandledException, and does not cause .catch() to throw an exception', function(done) { +asyncTest('Throwing an error inside a rejectionHandled handler goes to' + + ' unhandledException, and does not cause .catch() to throw an' + + 'exception', function(done) { clean(); var e = new Error(); var e2 = new Error(); var tearDownException = setupException(function(err) { - assert.equal(e2, err); - tearDownException(); - done(); + assert.equal(e2, err); + tearDownException(); + done(); }); process.on('rejectionHandled', function() { throw e2; @@ -598,7 +656,7 @@ asyncTest('Throwing an error inside a rejectionHandled handler goes to unhandled var p = Promise.reject(e); setTimeout(function() { try { - p.catch(function(){}); + p.catch(function() {}); } catch (e) { done(new Error('fail')); } diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index 4ac953849c0553..179bca51ec2fe0 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var punycode = require('punycode'); var assert = require('assert'); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 17fa6df9247747..66497ac2d3b6db 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -240,7 +241,7 @@ assert.equal( // test overriding .unescape var prevUnescape = qs.unescape; -qs.unescape = function (str) { +qs.unescape = function(str) { return str.replace(/o/g, '_'); }; assert.deepEqual(qs.parse('foo=bor'), {f__: 'b_r'}); diff --git a/test/parallel/test-readdouble.js b/test/parallel/test-readdouble.js index 6dfc4015492783..c0dab8956593fe 100644 --- a/test/parallel/test-readdouble.js +++ b/test/parallel/test-readdouble.js @@ -1,3 +1,4 @@ +'use strict'; /* * Tests to verify we're reading in doubles correctly */ diff --git a/test/parallel/test-readfloat.js b/test/parallel/test-readfloat.js index 9b2fc612c73324..5572bbf18e291b 100644 --- a/test/parallel/test-readfloat.js +++ b/test/parallel/test-readfloat.js @@ -1,3 +1,4 @@ +'use strict'; /* * Tests to verify we're reading in floats correctly */ diff --git a/test/parallel/test-readint.js b/test/parallel/test-readint.js index 208907d03ee153..233128d792d068 100644 --- a/test/parallel/test-readint.js +++ b/test/parallel/test-readint.js @@ -1,3 +1,4 @@ +'use strict'; /* * Tests to verify we're reading in signed integers correctly */ diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 0edee3190ccf26..6ee9ad227896b1 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var readline = require('readline'); var EventEmitter = require('events').EventEmitter; @@ -98,7 +99,7 @@ function isWarned(emitter) { assert.equal(callCount, expectedLines.length - 1); rli.close(); - // sending multiple newlines at once that does not end with a new(empty) + // sending multiple newlines at once that does not end with a new(empty) // line and a `end` event fi = new FakeInput(); rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); @@ -110,7 +111,7 @@ function isWarned(emitter) { }); rli.on('close', function() { callCount++; - }) + }); fi.emit('data', expectedLines.join('\n')); fi.emit('end'); assert.equal(callCount, expectedLines.length); @@ -249,10 +250,14 @@ function isWarned(emitter) { assert.equal(readline.getStringWidth('A\ud83c\ude00BC'), 5); // surrogate // check if vt control chars are stripped - assert.equal(readline.stripVTControlCharacters('\u001b[31m> \u001b[39m'), '> '); - assert.equal(readline.stripVTControlCharacters('\u001b[31m> \u001b[39m> '), '> > '); - assert.equal(readline.stripVTControlCharacters('\u001b[31m\u001b[39m'), ''); - assert.equal(readline.stripVTControlCharacters('> '), '> '); + assert.equal(readline + .stripVTControlCharacters('\u001b[31m> \u001b[39m'), '> '); + assert.equal(readline + .stripVTControlCharacters('\u001b[31m> \u001b[39m> '), '> > '); + assert.equal(readline + .stripVTControlCharacters('\u001b[31m\u001b[39m'), ''); + assert.equal(readline + .stripVTControlCharacters('> '), '> '); assert.equal(readline.getStringWidth('\u001b[31m> \u001b[39m'), 2); assert.equal(readline.getStringWidth('\u001b[31m> \u001b[39m> '), 4); assert.equal(readline.getStringWidth('\u001b[31m\u001b[39m'), 0); @@ -261,7 +266,7 @@ function isWarned(emitter) { assert.deepEqual(fi.listeners(terminal ? 'keypress' : 'data'), []); // check EventEmitter memory leak - for (var i=0; i<12; i++) { + for (var i = 0; i < 12; i++) { var rl = readline.createInterface({ input: process.stdin, output: process.stdout @@ -284,7 +289,7 @@ function isWarned(emitter) { assert.ok(called); assert.doesNotThrow(function() { - rli.setPrompt("ddd> "); + rli.setPrompt('ddd> '); }); assert.doesNotThrow(function() { @@ -296,10 +301,10 @@ function isWarned(emitter) { }); assert.doesNotThrow(function() { - rli.question("What do you think of node.js? ", function(answer) { - console.log("Thank you for your valuable feedback:", answer); + rli.question('What do you think of node.js? ', function(answer) { + console.log('Thank you for your valuable feedback:', answer); rli.close(); - }) + }); }); }); diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index 0bf2673435f584..150273f7993963 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -1,3 +1,4 @@ +'use strict'; var EventEmitter = require('events').EventEmitter; var PassThrough = require('stream').PassThrough; var assert = require('assert'); @@ -17,7 +18,7 @@ var fo = new FakeInput(); var rli = new Interface({ input: fi, output: fo, terminal: true }); var keys = []; -fi.on('keypress', function (s, k) { +fi.on('keypress', function(s, k) { keys.push(k); }); @@ -31,13 +32,13 @@ function addTest(sequences, expectedKeys) { expectedKeys = [ expectedKeys ]; } - expectedKeys = expectedKeys.map(function (k) { + expectedKeys = expectedKeys.map(function(k) { return k ? extend({ ctrl: false, meta: false, shift: false }, k) : k; }); keys = []; - sequences.forEach(function (sequence) { + sequences.forEach(function(sequence) { fi.write(sequence); }); assert.deepStrictEqual(keys, expectedKeys); diff --git a/test/parallel/test-readline-set-raw-mode.js b/test/parallel/test-readline-set-raw-mode.js index 622d64181fbfe1..f9d5111581fa90 100644 --- a/test/parallel/test-readline-set-raw-mode.js +++ b/test/parallel/test-readline-set-raw-mode.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var readline = require('readline'); var Stream = require('stream'); diff --git a/test/parallel/test-readuint.js b/test/parallel/test-readuint.js index 293cb554ce343f..b984541bfe9eb0 100644 --- a/test/parallel/test-readuint.js +++ b/test/parallel/test-readuint.js @@ -1,3 +1,4 @@ +'use strict'; /* * A battery of tests to help us read a series of uints */ diff --git a/test/parallel/test-regress-GH-4256.js b/test/parallel/test-regress-GH-4256.js index ead32446b7b59b..f512e613162522 100644 --- a/test/parallel/test-regress-GH-4256.js +++ b/test/parallel/test-regress-GH-4256.js @@ -1,4 +1,5 @@ +'use strict'; process.domain = null; -timer = setTimeout(function() { - console.log("this console.log statement should not make node crash"); +var timer = setTimeout(function() { + console.log('this console.log statement should not make node crash'); }, 1); diff --git a/test/parallel/test-regress-GH-5927.js b/test/parallel/test-regress-GH-5927.js index dee33d854abd9c..541820c7a214c8 100644 --- a/test/parallel/test-regress-GH-5927.js +++ b/test/parallel/test-regress-GH-5927.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var readline = require('readline'); @@ -10,12 +11,12 @@ var origPause = rl.pause; rl.pause = function() { hasPaused = true; origPause.apply(this, arguments); -} +}; var origSetRawMode = rl._setRawMode; rl._setRawMode = function(mode) { assert.ok(hasPaused); origSetRawMode.apply(this, arguments); -} +}; rl.close(); diff --git a/test/parallel/test-regress-GH-6235.js b/test/parallel/test-regress-GH-6235.js index f929282b16ab75..2f2f17d9698fc9 100644 --- a/test/parallel/test-regress-GH-6235.js +++ b/test/parallel/test-regress-GH-6235.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-regress-GH-7511.js b/test/parallel/test-regress-GH-7511.js index aa7a10c0474149..0e5c4ded011a43 100644 --- a/test/parallel/test-regress-GH-7511.js +++ b/test/parallel/test-regress-GH-7511.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), vm = require('vm'); diff --git a/test/parallel/test-regress-GH-897.js b/test/parallel/test-regress-GH-897.js index fae1bd4b5d2a72..4b7ba61f9ceca9 100644 --- a/test/parallel/test-regress-GH-897.js +++ b/test/parallel/test-regress-GH-897.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-regress-GH-io-1068.js b/test/parallel/test-regress-GH-io-1068.js index e769e6b81a880d..cc91fe28df3d3e 100644 --- a/test/parallel/test-regress-GH-io-1068.js +++ b/test/parallel/test-regress-GH-io-1068.js @@ -1 +1,2 @@ +'use strict'; process.stdin.emit('end'); diff --git a/test/parallel/test-regress-GH-node-9326.js b/test/parallel/test-regress-GH-node-9326.js index 15a2abbdc55af0..5dc73e044e560b 100644 --- a/test/parallel/test-regress-GH-node-9326.js +++ b/test/parallel/test-regress-GH-node-9326.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var child_process = require('child_process'); diff --git a/test/parallel/test-regression-object-prototype.js b/test/parallel/test-regression-object-prototype.js index 17fe1727d37070..040e718948a581 100644 --- a/test/parallel/test-regression-object-prototype.js +++ b/test/parallel/test-regression-object-prototype.js @@ -1,3 +1,4 @@ +'use strict'; //console.log('puts before'); Object.prototype.xadsadsdasasdxx = function() { diff --git a/test/parallel/test-repl-.save.load.js b/test/parallel/test-repl-.save.load.js index d1c0f13e92f851..cf3224ecaf55a3 100644 --- a/test/parallel/test-repl-.save.load.js +++ b/test/parallel/test-repl-.save.load.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var util = require('util'); var join = require('path').join; @@ -13,7 +14,7 @@ function ArrayStream() { data.forEach(function(line) { self.emit('data', line + '\n'); }); - } + }; } util.inherits(ArrayStream, require('stream').Stream); ArrayStream.prototype.readable = true; @@ -28,7 +29,7 @@ var testMe = repl.start('', putIn); var testFile = [ - 'var top = function () {', + 'var top = function() {', 'var inner = {one:1};' ]; var saveFileName = join(common.tmpDir, 'test.save.js'); diff --git a/test/parallel/test-repl-autolibs.js b/test/parallel/test-repl-autolibs.js index c7727f574a6ca5..4103a19243aec5 100644 --- a/test/parallel/test-repl-autolibs.js +++ b/test/parallel/test-repl-autolibs.js @@ -1,30 +1,31 @@ +'use strict'; var assert = require('assert'); var util = require('util'); var repl = require('repl'); // A stream to push an array into a REPL function ArrayStream() { - this.run = function (data) { + this.run = function(data) { var self = this; - data.forEach(function (line) { + data.forEach(function(line) { self.emit('data', line + '\n'); }); - } + }; } util.inherits(ArrayStream, require('stream').Stream); ArrayStream.prototype.readable = true; ArrayStream.prototype.writable = true; -ArrayStream.prototype.resume = function () {}; -ArrayStream.prototype.write = function () {}; +ArrayStream.prototype.resume = function() {}; +ArrayStream.prototype.write = function() {}; -var putIn = new ArrayStream; +var putIn = new ArrayStream(); var testMe = repl.start('', putIn, null, true); test1(); -function test1(){ +function test1() { var gotWrite = false; - putIn.write = function (data) { + putIn.write = function(data) { gotWrite = true; if (data.length) { @@ -40,7 +41,7 @@ function test1(){ assert(gotWrite); } -function test2(){ +function test2() { var gotWrite = false; putIn.write = function(data) { gotWrite = true; diff --git a/test/parallel/test-repl-console.js b/test/parallel/test-repl-console.js index 45dad0f390d00d..e66fcb1621adc5 100644 --- a/test/parallel/test-repl-console.js +++ b/test/parallel/test-repl-console.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), Stream = require('stream'), @@ -5,7 +6,7 @@ var common = require('../common'), // create a dummy stream that does nothing var stream = new Stream(); -stream.write = stream.pause = stream.resume = function(){}; +stream.write = stream.pause = stream.resume = function() {}; stream.readable = stream.writable = true; var r = repl.start({ diff --git a/test/parallel/test-repl-domain.js b/test/parallel/test-repl-domain.js index 929cb0ffd1e80f..7528f502878f63 100644 --- a/test/parallel/test-repl-domain.js +++ b/test/parallel/test-repl-domain.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); @@ -11,7 +12,7 @@ function ArrayStream() { data.forEach(function(line) { self.emit('data', line + '\n'); }); - } + }; } util.inherits(ArrayStream, require('stream').Stream); ArrayStream.prototype.readable = true; @@ -26,15 +27,15 @@ putIn.write = function(data) { // Don't use assert for this because the domain might catch it, and // give a false negative. Don't throw, just print and exit. if (data === 'OK\n') { - console.log('ok'); + console.log('ok'); } else { - console.error(data); - process.exit(1); + console.error(data); + process.exit(1); } }; putIn.run([ - 'require("domain").create().on("error", function () { console.log("OK") })' - + '.run(function () { throw new Error("threw") })' + 'require("domain").create().on("error", function() { console.log("OK") })' + + '.run(function() { throw new Error("threw") })' ]); diff --git a/test/parallel/test-repl-end-emits-exit.js b/test/parallel/test-repl-end-emits-exit.js index bcb13a14afd021..e4bc4da78c142d 100644 --- a/test/parallel/test-repl-end-emits-exit.js +++ b/test/parallel/test-repl-end-emits-exit.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), Stream = require('stream'), @@ -7,7 +8,7 @@ var common = require('../common'), // create a dummy stream that does nothing var stream = new Stream(); -stream.write = stream.pause = stream.resume = function(){}; +stream.write = stream.pause = stream.resume = function() {}; stream.readable = stream.writable = true; function testTerminalMode() { diff --git a/test/parallel/test-repl-harmony.js b/test/parallel/test-repl-harmony.js index 420b3163cce252..446aebe2d51c99 100644 --- a/test/parallel/test-repl-harmony.js +++ b/test/parallel/test-repl-harmony.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-repl-mode.js b/test/parallel/test-repl-mode.js index b71e213647de1a..ba7d983bad6d26 100644 --- a/test/parallel/test-repl-mode.js +++ b/test/parallel/test-repl-mode.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Stream = require('stream'); @@ -21,7 +22,7 @@ function testSloppyMode() { cli.input.emit('data', ` x = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), '> 3\n> ') + assert.equal(cli.output.accumulator.join(''), '> 3\n> '); cli.output.accumulator.length = 0; cli.input.emit('data', ` @@ -53,7 +54,7 @@ function testAutoMode() { cli.input.emit('data', ` x = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), '> 3\n> ') + assert.equal(cli.output.accumulator.join(''), '> 3\n> '); cli.output.accumulator.length = 0; cli.input.emit('data', ` @@ -64,7 +65,7 @@ function testAutoMode() { function initRepl(mode) { var input = new Stream(); - input.write = input.pause = input.resume = function(){}; + input.write = input.pause = input.resume = function() {}; input.readable = true; var output = new Stream(); diff --git a/test/parallel/test-repl-options.js b/test/parallel/test-repl-options.js index 31ea215054e576..5bc37d2d7117f3 100644 --- a/test/parallel/test-repl-options.js +++ b/test/parallel/test-repl-options.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), Stream = require('stream'), @@ -7,7 +8,7 @@ common.globalCheck = false; // create a dummy stream that does nothing var stream = new Stream(); -stream.write = stream.pause = stream.resume = function(){}; +stream.write = stream.pause = stream.resume = function() {}; stream.readable = stream.writable = true; // 1, mostly defaults @@ -75,7 +76,7 @@ var r3 = repl.start({ writer: writer, replMode: repl.REPL_MODE_MAGIC, historySize: 50 -}) +}); assert.equal(r3.replMode, repl.REPL_MODE_MAGIC); assert.equal(r3.historySize, 50); diff --git a/test/parallel/test-repl-require-cache.js b/test/parallel/test-repl-require-cache.js index 3ab3b7062c2603..d9b4d71d484640 100644 --- a/test/parallel/test-repl-require-cache.js +++ b/test/parallel/test-repl-require-cache.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), repl = require('repl'); diff --git a/test/parallel/test-repl-reset-event.js b/test/parallel/test-repl-reset-event.js index eee31e24bee5a0..e6157956d43a65 100644 --- a/test/parallel/test-repl-reset-event.js +++ b/test/parallel/test-repl-reset-event.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); common.globalCheck = false; @@ -7,7 +8,7 @@ var Stream = require('stream'); // create a dummy stream that does nothing var dummy = new Stream(); -dummy.write = dummy.pause = dummy.resume = function(){}; +dummy.write = dummy.pause = dummy.resume = function() {}; dummy.readable = dummy.writable = true; function testReset(cb) { @@ -20,7 +21,8 @@ function testReset(cb) { r.on('reset', function(context) { assert(!!context, 'REPL did not emit a context with reset event'); assert.equal(context, r.context, 'REPL emitted incorrect context'); - assert.equal(context.foo, undefined, 'REPL emitted the previous context, and is not using global as context'); + assert.equal(context.foo, undefined, 'REPL emitted the previous context' + + ', and is not using global as context'); context.foo = 42; cb(); }); @@ -35,7 +37,8 @@ function testResetGlobal(cb) { }); r.context.foo = 42; r.on('reset', function(context) { - assert.equal(context.foo, 42, '"foo" property is missing from REPL using global as context'); + assert.equal(context.foo, 42, + '"foo" property is missing from REPL using global as context'); cb(); }); r.resetContext(); diff --git a/test/parallel/test-repl-setprompt.js b/test/parallel/test-repl-setprompt.js index 56de10023f831f..b89dd6c928ab0a 100644 --- a/test/parallel/test-repl-setprompt.js +++ b/test/parallel/test-repl-setprompt.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), spawn = require('child_process').spawn, @@ -9,14 +10,14 @@ var args = [ 'var e = new (require("repl")).REPLServer("foo.. "); e.context.e = e;', ]; -var p = "bar.. "; +var p = 'bar.. '; var child = spawn(process.execPath, args); child.stdout.setEncoding('utf8'); var data = ''; -child.stdout.on('data', function(d) { data += d }); +child.stdout.on('data', function(d) { data += d; }); child.stdin.end(util.format("e.setPrompt('%s');%s", p, os.EOL)); diff --git a/test/parallel/test-repl-syntax-error-handling.js b/test/parallel/test-repl-syntax-error-handling.js index 79489628b588c7..66e8fb6b352c56 100644 --- a/test/parallel/test-repl-syntax-error-handling.js +++ b/test/parallel/test-repl-syntax-error-handling.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index c6a07f4017bef4..659c8046a98173 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -11,7 +12,7 @@ function ArrayStream() { data.forEach(function(line) { self.emit('data', line + '\n'); }); - } + }; } util.inherits(ArrayStream, require('stream').Stream); ArrayStream.prototype.readable = true; @@ -48,7 +49,7 @@ putIn.run(['.clear']); // Tab Complete will not break in an ternary operator with () putIn.run([ - 'var inner = ( true ' , + 'var inner = ( true ', '?', '{one: 1} : ' ]); @@ -60,7 +61,7 @@ putIn.run(['.clear']); // Tab Complete will return a simple local variable putIn.run([ - 'var top = function () {', + 'var top = function() {', 'var inner = {one:1};' ]); testMe.complete('inner.o', function(error, data) { @@ -78,7 +79,7 @@ putIn.run(['.clear']); // Tab Complete will return a complex local variable putIn.run([ - 'var top = function () {', + 'var top = function() {', 'var inner = {', ' one:1', '};' @@ -92,7 +93,7 @@ putIn.run(['.clear']); // Tab Complete will return a complex local variable even if the function // has parameters putIn.run([ - 'var top = function (one, two) {', + 'var top = function(one, two) {', 'var inner = {', ' one:1', '};' @@ -106,7 +107,7 @@ putIn.run(['.clear']); // Tab Complete will return a complex local variable even if the // scope is nested inside an immediately executed function putIn.run([ - 'var top = function () {', + 'var top = function() {', '(function test () {', 'var inner = {', ' one:1', @@ -121,7 +122,7 @@ putIn.run(['.clear']); // currently does not work, but should not break note the inner function // def has the params and { on a separate line putIn.run([ - 'var top = function () {', + 'var top = function() {', 'r = function test (', ' one, two) {', 'var inner = {', @@ -136,7 +137,7 @@ putIn.run(['.clear']); // currently does not work, but should not break, not the { putIn.run([ - 'var top = function () {', + 'var top = function() {', 'r = function test ()', '{', 'var inner = {', @@ -151,7 +152,7 @@ putIn.run(['.clear']); // currently does not work, but should not break putIn.run([ - 'var top = function () {', + 'var top = function() {', 'r = function test (', ')', '{', @@ -181,7 +182,7 @@ var spaceTimeout = setTimeout(function() { }, 1000); testMe.complete(' ', function(error, data) { - assert.deepEqual(data, [[],undefined]); + assert.deepEqual(data, [[], undefined]); clearTimeout(spaceTimeout); }); diff --git a/test/parallel/test-repl-tab.js b/test/parallel/test-repl-tab.js index 79d3c6322075ca..badab2133b7e7e 100644 --- a/test/parallel/test-repl-tab.js +++ b/test/parallel/test-repl-tab.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var util = require('util'); var repl = require('repl'); @@ -9,7 +10,7 @@ var testMe = repl.start('', putIn, function(cmd, context, filename, callback) { callback(null, cmd); }); -testMe._domain.on('error', function (e) { +testMe._domain.on('error', function(e) { assert.fail(); }); diff --git a/test/parallel/test-repl-timeout-throw.js b/test/parallel/test-repl-timeout-throw.js index eea2bea3ac9389..6c540c9e3197de 100644 --- a/test/parallel/test-repl-timeout-throw.js +++ b/test/parallel/test-repl-timeout-throw.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); @@ -14,10 +15,12 @@ child.stdout.on('data', function(c) { stdout += c; }); -child.stdin.write = function(original) { return function(c) { - process.stderr.write(c); - return original.call(child.stdin, c); -}}(child.stdin.write); +child.stdin.write = function(original) { + return function(c) { + process.stderr.write(c); + return original.call(child.stdin, c); + }; +}(child.stdin.write); child.stdout.once('data', function() { child.stdin.write('var throws = 0;'); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index ecee764b4dc5a6..6911c591505fef 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -1,3 +1,4 @@ +/* eslint-disable max-len, strict */ var common = require('../common'); var assert = require('assert'); @@ -170,7 +171,7 @@ function error_test() { { client: client_unix, send: '1 }', expect: '{ a: 1 }' }, // Multiline anonymous function with comment - { client: client_unix, send: '(function () {', + { client: client_unix, send: '(function() {', expect: prompt_multiline }, { client: client_unix, send: '// blah', expect: prompt_multiline }, @@ -181,7 +182,7 @@ function error_test() { // npm prompt error message { client: client_unix, send: 'npm install foobar', expect: expect_npm }, - { client: client_unix, send: '(function () {\n\nreturn 1;\n})()', + { client: client_unix, send: '(function() {\n\nreturn 1;\n})()', expect: '1' }, { client: client_unix, send: '{\n\na: 1\n}', expect: '{ a: 1 }' }, diff --git a/test/parallel/test-require-cache.js b/test/parallel/test-require-cache.js index a069d0a799892a..f2245345e3e4bd 100644 --- a/test/parallel/test-require-cache.js +++ b/test/parallel/test-require-cache.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-require-dot.js b/test/parallel/test-require-dot.js index 2551d88d2204e8..aab466e3eb6204 100644 --- a/test/parallel/test-require-dot.js +++ b/test/parallel/test-require-dot.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var module = require('module'); diff --git a/test/parallel/test-require-exceptions.js b/test/parallel/test-require-exceptions.js index 16c63a90aa41ed..e7a191b47ad6f2 100644 --- a/test/parallel/test-require-exceptions.js +++ b/test/parallel/test-require-exceptions.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-require-extensions-main.js b/test/parallel/test-require-extensions-main.js index 06d28ab30bddcf..6e67d3ae045bb6 100644 --- a/test/parallel/test-require-extensions-main.js +++ b/test/parallel/test-require-extensions-main.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js b/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js index cc2cd94ea6994c..1837a17bab0add 100644 --- a/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js +++ b/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js @@ -1,3 +1,5 @@ +/* eslint-disable max-len */ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-require-extensions-same-filename-as-dir.js b/test/parallel/test-require-extensions-same-filename-as-dir.js index 387620afa74cb2..41051dad45e10f 100644 --- a/test/parallel/test-require-extensions-same-filename-as-dir.js +++ b/test/parallel/test-require-extensions-same-filename-as-dir.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-require-json.js b/test/parallel/test-require-json.js index dbf8c8f866d8c6..4c17fc8d025d73 100644 --- a/test/parallel/test-require-json.js +++ b/test/parallel/test-require-json.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); try { diff --git a/test/parallel/test-require-process.js b/test/parallel/test-require-process.js index 4693b4984e6dfe..fdd921a61195e5 100644 --- a/test/parallel/test-require-process.js +++ b/test/parallel/test-require-process.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var nativeProcess = require('process'); diff --git a/test/parallel/test-require-resolve.js b/test/parallel/test-require-resolve.js index c11ff65ac43307..13897c74da1752 100644 --- a/test/parallel/test-require-resolve.js +++ b/test/parallel/test-require-resolve.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var fixturesDir = common.fixturesDir; var assert = require('assert'); diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js index 30cad31eef5995..f186287b0c72a7 100644 --- a/test/parallel/test-signal-handler.js +++ b/test/parallel/test-signal-handler.js @@ -1,3 +1,4 @@ +'use strict'; // SIGUSR1 and SIGHUP are not supported on Windows if (process.platform === 'win32') { process.exit(0); @@ -39,7 +40,7 @@ setInterval(function() { // has been previously registered, and `process.listeners(SIGNAL).length === 1` process.on('SIGHUP', function() {}); process.removeAllListeners('SIGHUP'); -process.on('SIGHUP', function() { sighup = true }); +process.on('SIGHUP', function() { sighup = true; }); process.kill(process.pid, 'SIGHUP'); process.on('exit', function() { diff --git a/test/parallel/test-signal-safety.js b/test/parallel/test-signal-safety.js index b037232a6b89f7..549c26662f717a 100644 --- a/test/parallel/test-signal-safety.js +++ b/test/parallel/test-signal-safety.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Signal = process.binding('signal_wrap').Signal; diff --git a/test/parallel/test-signal-unregister.js b/test/parallel/test-signal-unregister.js index c3ab108dffbf08..b65ade73db9422 100644 --- a/test/parallel/test-signal-unregister.js +++ b/test/parallel/test-signal-unregister.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-smalloc.js b/test/parallel/test-smalloc.js index ef1aa60bad6838..ce4e4f43cd08f0 100644 --- a/test/parallel/test-smalloc.js +++ b/test/parallel/test-smalloc.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var os = require('os'); diff --git a/test/parallel/test-stdin-hang.js b/test/parallel/test-stdin-hang.js index c22a097925b456..4818a9ee952026 100644 --- a/test/parallel/test-stdin-hang.js +++ b/test/parallel/test-stdin-hang.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); // This test *only* verifies that invoking the stdin getter does not diff --git a/test/parallel/test-stdin-pause-resume-sync.js b/test/parallel/test-stdin-pause-resume-sync.js index fdb8e030b70edb..4fe4d445a2443e 100644 --- a/test/parallel/test-stdin-pause-resume-sync.js +++ b/test/parallel/test-stdin-pause-resume-sync.js @@ -1,3 +1,4 @@ +'use strict'; console.error('before opening stdin'); process.stdin.resume(); console.error('stdin opened'); diff --git a/test/parallel/test-stdin-pause-resume.js b/test/parallel/test-stdin-pause-resume.js index a9282d5aa030ed..2685deb0e9b33c 100644 --- a/test/parallel/test-stdin-pause-resume.js +++ b/test/parallel/test-stdin-pause-resume.js @@ -1,3 +1,4 @@ +'use strict'; console.error('before opening stdin'); process.stdin.resume(); console.error('stdin opened'); diff --git a/test/parallel/test-stdin-resume-pause.js b/test/parallel/test-stdin-resume-pause.js index 6290ff7999b250..963fd989f085a3 100644 --- a/test/parallel/test-stdin-resume-pause.js +++ b/test/parallel/test-stdin-resume-pause.js @@ -1,2 +1,3 @@ +'use strict'; process.stdin.resume(); process.stdin.pause(); diff --git a/test/parallel/test-stdio-closed.js b/test/parallel/test-stdio-closed.js index 2543d8b021b91d..2101f85ac061c3 100644 --- a/test/parallel/test-stdio-closed.js +++ b/test/parallel/test-stdio-closed.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-stdio-readable-writable.js b/test/parallel/test-stdio-readable-writable.js index 95ae679bca0389..f8a8923498cb03 100644 --- a/test/parallel/test-stdio-readable-writable.js +++ b/test/parallel/test-stdio-readable-writable.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stdout-close-unref.js b/test/parallel/test-stdout-close-unref.js index 0b03e7142a8615..12a031562bf6f0 100644 --- a/test/parallel/test-stdout-close-unref.js +++ b/test/parallel/test-stdout-close-unref.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index cfde7e47fb700a..a9f6064c7e7277 100644 --- a/test/parallel/test-stream-big-packet.js +++ b/test/parallel/test-stream-big-packet.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -5,20 +6,20 @@ var stream = require('stream'); var passed = false; -function PassThrough () { +function PassThrough() { stream.Transform.call(this); }; util.inherits(PassThrough, stream.Transform); -PassThrough.prototype._transform = function (chunk, encoding, done) { +PassThrough.prototype._transform = function(chunk, encoding, done) { this.push(chunk); done(); }; -function TestStream () { +function TestStream() { stream.Transform.call(this); }; util.inherits(TestStream, stream.Transform); -TestStream.prototype._transform = function (chunk, encoding, done) { +TestStream.prototype._transform = function(chunk, encoding, done) { if (!passed) { // Char 'a' only exists in the last write passed = chunk.toString().indexOf('a') >= 0; @@ -47,6 +48,6 @@ assert(s2.write('tiny')); setImmediate(s1.write.bind(s1), 'later'); // Assert after two IO loops when all operations have been done. -process.on('exit', function () { +process.on('exit', function() { assert(passed, 'Large buffer is not handled properly by Writable Stream'); }); diff --git a/test/parallel/test-stream-big-push.js b/test/parallel/test-stream-big-push.js index b4ed8f8a527acd..e02ff98d3c7454 100644 --- a/test/parallel/test-stream-big-push.js +++ b/test/parallel/test-stream-big-push.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var stream = require('stream'); diff --git a/test/parallel/test-stream-duplex.js b/test/parallel/test-stream-duplex.js index 8efc9d4b5f4160..0e8789d6bf5555 100644 --- a/test/parallel/test-stream-duplex.js +++ b/test/parallel/test-stream-duplex.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -11,21 +12,21 @@ assert(stream._writableState.objectMode); var written; var read; -stream._write = function (obj, _, cb) { +stream._write = function(obj, _, cb) { written = obj; cb(); }; -stream._read = function () {}; +stream._read = function() {}; -stream.on('data', function (obj) { +stream.on('data', function(obj) { read = obj; }); stream.push({ val: 1 }); stream.end({ val: 2 }); -process.on('exit', function () { +process.on('exit', function() { assert(read.val === 1); assert(written.val === 2); }); diff --git a/test/parallel/test-stream-end-paused.js b/test/parallel/test-stream-end-paused.js index 72825dc440df91..585d6c327fd592 100644 --- a/test/parallel/test-stream-end-paused.js +++ b/test/parallel/test-stream-end-paused.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var gotEnd = false; diff --git a/test/parallel/test-stream-ispaused.js b/test/parallel/test-stream-ispaused.js index fe895ce7c39884..8112dc733a7205 100644 --- a/test/parallel/test-stream-ispaused.js +++ b/test/parallel/test-stream-ispaused.js @@ -1,9 +1,10 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var stream = require('stream'); -var readable = new stream.Readable; +var readable = new stream.Readable(); // _read is a noop, here. readable._read = Function(); diff --git a/test/parallel/test-stream-pipe-after-end.js b/test/parallel/test-stream-pipe-after-end.js index a2fece3f7f6264..4bead73f68ce5b 100644 --- a/test/parallel/test-stream-pipe-after-end.js +++ b/test/parallel/test-stream-pipe-after-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-pipe-cleanup.js b/test/parallel/test-stream-pipe-cleanup.js index b2963c4f56c1a3..08da96f92c3a0f 100644 --- a/test/parallel/test-stream-pipe-cleanup.js +++ b/test/parallel/test-stream-pipe-cleanup.js @@ -1,3 +1,4 @@ +'use strict'; // This test asserts that Stream.prototype.pipe does not leave listeners // hanging on the source or dest. diff --git a/test/parallel/test-stream-pipe-error-handling.js b/test/parallel/test-stream-pipe-error-handling.js index 18ce5a1edef021..031a0da7e395db 100644 --- a/test/parallel/test-stream-pipe-error-handling.js +++ b/test/parallel/test-stream-pipe-error-handling.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Stream = require('stream').Stream; @@ -41,8 +42,8 @@ var Stream = require('stream').Stream; var R = Stream.Readable; var W = Stream.Writable; - var r = new R; - var w = new W; + var r = new R(); + var w = new W(); var removed = false; var didTest = false; @@ -76,8 +77,8 @@ var Stream = require('stream').Stream; var R = Stream.Readable; var W = Stream.Writable; - var r = new R; - var w = new W; + var r = new R(); + var w = new W(); var removed = false; var didTest = false; var caught = false; diff --git a/test/parallel/test-stream-pipe-event.js b/test/parallel/test-stream-pipe-event.js index bcae20c581ebbd..0d10533b0c496a 100644 --- a/test/parallel/test-stream-pipe-event.js +++ b/test/parallel/test-stream-pipe-event.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var stream = require('stream'); var assert = require('assert'); diff --git a/test/parallel/test-stream-push-order.js b/test/parallel/test-stream-push-order.js index 5e403c7824beaf..d67233aff7a498 100644 --- a/test/parallel/test-stream-push-order.js +++ b/test/parallel/test-stream-push-order.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var Readable = require('stream').Readable; var assert = require('assert'); @@ -9,7 +10,7 @@ var s = new Readable({ var list = ['1', '2', '3', '4', '5', '6']; -s._read = function (n) { +s._read = function(n) { var one = list.shift(); if (!one) { s.push(null); @@ -24,8 +25,8 @@ var v = s.read(0); // ACTUALLY [1, 3, 5, 6, 4, 2] -process.on("exit", function () { +process.on('exit', function() { assert.deepEqual(s._readableState.buffer, ['1', '2', '3', '4', '5', '6']); - console.log("ok"); + console.log('ok'); }); diff --git a/test/parallel/test-stream-push-strings.js b/test/parallel/test-stream-push-strings.js index f673173de5ea57..0d9c0653c0dc66 100644 --- a/test/parallel/test-stream-push-strings.js +++ b/test/parallel/test-stream-push-strings.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-readable-constructor-set-methods.js b/test/parallel/test-stream-readable-constructor-set-methods.js index a88ffcd67a1446..928ce31a8ebe7b 100644 --- a/test/parallel/test-stream-readable-constructor-set-methods.js +++ b/test/parallel/test-stream-readable-constructor-set-methods.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -12,7 +13,7 @@ function _read(n) { var r = new Readable({ read: _read }); r.resume(); -process.on('exit', function () { +process.on('exit', function() { assert.equal(r._read, _read); assert(_readCalled); }); diff --git a/test/parallel/test-stream-readable-event.js b/test/parallel/test-stream-readable-event.js index 2d7d1cc4f9020e..965fc82c05a1d9 100644 --- a/test/parallel/test-stream-readable-event.js +++ b/test/parallel/test-stream-readable-event.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js index c3dfbef53bd971..07edd579f1deea 100644 --- a/test/parallel/test-stream-readable-flow-recursion.js +++ b/test/parallel/test-stream-readable-flow-recursion.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-transform-constructor-set-methods.js b/test/parallel/test-stream-transform-constructor-set-methods.js index 55e64ed9b2e733..c24c273b6f20e1 100644 --- a/test/parallel/test-stream-transform-constructor-set-methods.js +++ b/test/parallel/test-stream-transform-constructor-set-methods.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -23,7 +24,7 @@ var t = new Transform({ t.end(new Buffer('blerg')); t.resume(); -process.on('exit', function () { +process.on('exit', function() { assert.equal(t._transform, _transform); assert.equal(t._flush, _flush); assert(_transformCalled); diff --git a/test/parallel/test-stream-transform-objectmode-falsey-value.js b/test/parallel/test-stream-transform-objectmode-falsey-value.js index 89feabef118e59..762f0500ad3e60 100644 --- a/test/parallel/test-stream-transform-objectmode-falsey-value.js +++ b/test/parallel/test-stream-transform-objectmode-falsey-value.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-transform-split-objectmode.js b/test/parallel/test-stream-transform-split-objectmode.js index df10ed1b6553e7..24833ece051e9e 100644 --- a/test/parallel/test-stream-transform-split-objectmode.js +++ b/test/parallel/test-stream-transform-split-objectmode.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -10,19 +11,19 @@ assert(!parser._writableState.objectMode); assert(parser._readableState.highWaterMark === 16); assert(parser._writableState.highWaterMark === (16 * 1024)); -parser._transform = function (chunk, enc, callback) { +parser._transform = function(chunk, enc, callback) { callback(null, { val : chunk[0] }); }; var parsed; -parser.on('data', function (obj) { +parser.on('data', function(obj) { parsed = obj; }); parser.end(new Buffer([42])); -process.on('exit', function () { +process.on('exit', function() { assert(parsed.val === 42); }); @@ -34,18 +35,18 @@ assert(serializer._writableState.objectMode); assert(serializer._readableState.highWaterMark === (16 * 1024)); assert(serializer._writableState.highWaterMark === 16); -serializer._transform = function (obj, _, callback) { +serializer._transform = function(obj, _, callback) { callback(null, new Buffer([obj.val])); }; var serialized; -serializer.on('data', function (chunk) { +serializer.on('data', function(chunk) { serialized = chunk; }); serializer.write({ val : 42 }); -process.on('exit', function () { +process.on('exit', function() { assert(serialized[0] === 42); }); diff --git a/test/parallel/test-stream-unshift-empty-chunk.js b/test/parallel/test-stream-unshift-empty-chunk.js index c985d4bc37d279..e6c427221294a2 100644 --- a/test/parallel/test-stream-unshift-empty-chunk.js +++ b/test/parallel/test-stream-unshift-empty-chunk.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-unshift-read-race.js b/test/parallel/test-stream-unshift-read-race.js index dd7c6dfb37e10c..90f519b5b5d738 100644 --- a/test/parallel/test-stream-unshift-read-race.js +++ b/test/parallel/test-stream-unshift-read-race.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream-writable-change-default-encoding.js b/test/parallel/test-stream-writable-change-default-encoding.js index 3e2277ad980c3d..a6fcda3e62a517 100644 --- a/test/parallel/test-stream-writable-change-default-encoding.js +++ b/test/parallel/test-stream-writable-change-default-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -11,7 +12,7 @@ function MyWritable(fn, options) { util.inherits(MyWritable, stream.Writable); -MyWritable.prototype._write = function (chunk, encoding, callback) { +MyWritable.prototype._write = function(chunk, encoding, callback) { this.fn(Buffer.isBuffer(chunk), typeof chunk, encoding); callback(); }; diff --git a/test/parallel/test-stream-writable-constructor-set-methods.js b/test/parallel/test-stream-writable-constructor-set-methods.js index 496ce6697582d0..47fc458ce9713b 100644 --- a/test/parallel/test-stream-writable-constructor-set-methods.js +++ b/test/parallel/test-stream-writable-constructor-set-methods.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -25,7 +26,7 @@ w2.write(new Buffer('blerg')); w2.write(new Buffer('blerg')); w2.end(); -process.on('exit', function () { +process.on('exit', function() { assert.equal(w._write, _write); assert(_writeCalled); assert.equal(w2._writev, _writev); diff --git a/test/parallel/test-stream-writable-decoded-encoding.js b/test/parallel/test-stream-writable-decoded-encoding.js index fb530d0830a5d9..b637838c0c65be 100644 --- a/test/parallel/test-stream-writable-decoded-encoding.js +++ b/test/parallel/test-stream-writable-decoded-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -11,7 +12,7 @@ function MyWritable(fn, options) { util.inherits(MyWritable, stream.Writable); -MyWritable.prototype._write = function (chunk, encoding, callback) { +MyWritable.prototype._write = function(chunk, encoding, callback) { this.fn(Buffer.isBuffer(chunk), typeof chunk, encoding); callback(); }; diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 2a2ed3cdae3c07..f73270f2ff53ba 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -45,19 +46,24 @@ function test(decode, uncork, multi, next) { }; var expectChunks = decode ? - [{ encoding: 'buffer', - chunk: [104, 101, 108, 108, 111, 44, 32] }, - { encoding: 'buffer', chunk: [119, 111, 114, 108, 100] }, - { encoding: 'buffer', chunk: [33] }, - { encoding: 'buffer', - chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] }, - { encoding: 'buffer', - chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173] }] : - [{ encoding: 'ascii', chunk: 'hello, ' }, + [ + { encoding: 'buffer', + chunk: [104, 101, 108, 108, 111, 44, 32] }, + { encoding: 'buffer', + chunk: [119, 111, 114, 108, 100] }, + { encoding: 'buffer', + chunk: [33] }, + { encoding: 'buffer', + chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] }, + { encoding: 'buffer', + chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]} + ] : [ + { encoding: 'ascii', chunk: 'hello, ' }, { encoding: 'utf8', chunk: 'world' }, { encoding: 'buffer', chunk: [33] }, { encoding: 'binary', chunk: '\nand then...' }, - { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }]; + { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' } + ]; var actualChunks; w._writev = function(chunks, cb) { diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js index 2082c714cc69a5..37a97cd817e05b 100644 --- a/test/parallel/test-stream2-base64-single-char-read-end.js +++ b/test/parallel/test-stream2-base64-single-char-read-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var R = require('_stream_readable'); var W = require('_stream_writable'); @@ -27,7 +28,7 @@ dst._write = function(chunk, enc, cb) { src.on('end', function() { assert.equal(Buffer.concat(accum) + '', 'MQ=='); clearTimeout(timeout); -}) +}); src.pipe(dst); diff --git a/test/parallel/test-stream2-compatibility.js b/test/parallel/test-stream2-compatibility.js index 72b1e428505988..9eab7b713bf167 100644 --- a/test/parallel/test-stream2-compatibility.js +++ b/test/parallel/test-stream2-compatibility.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var R = require('_stream_readable'); var assert = require('assert'); diff --git a/test/parallel/test-stream2-finish-pipe.js b/test/parallel/test-stream2-finish-pipe.js index beabea0f0e5728..913bb7b0b4db09 100644 --- a/test/parallel/test-stream2-finish-pipe.js +++ b/test/parallel/test-stream2-finish-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var stream = require('stream'); var Buffer = require('buffer').Buffer; diff --git a/test/parallel/test-stream2-large-read-stall.js b/test/parallel/test-stream2-large-read-stall.js index 55d25a9b7366df..4cd89599fee730 100644 --- a/test/parallel/test-stream2-large-read-stall.js +++ b/test/parallel/test-stream2-large-read-stall.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js index d7c532917962da..a2f554a0b8a004 100644 --- a/test/parallel/test-stream2-objects.js +++ b/test/parallel/test-stream2-objects.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var Readable = require('_stream_readable'); var Writable = require('_stream_writable'); diff --git a/test/parallel/test-stream2-pipe-error-handling.js b/test/parallel/test-stream2-pipe-error-handling.js index c7303accead89b..9eddbdd90d00c3 100644 --- a/test/parallel/test-stream2-pipe-error-handling.js +++ b/test/parallel/test-stream2-pipe-error-handling.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var stream = require('stream'); diff --git a/test/parallel/test-stream2-pipe-error-once-listener.js b/test/parallel/test-stream2-pipe-error-once-listener.js index 0dbe8782e92229..f2ecb87ce97a75 100644 --- a/test/parallel/test-stream2-pipe-error-once-listener.js +++ b/test/parallel/test-stream2-pipe-error-once-listener.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream2-push.js b/test/parallel/test-stream2-push.js index 9268f052a2381a..b58bce143585f4 100644 --- a/test/parallel/test-stream2-push.js +++ b/test/parallel/test-stream2-push.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var stream = require('stream'); var Readable = stream.Readable; @@ -15,7 +16,7 @@ var stream = new Readable({ encoding: 'utf8' }); -var source = new EE; +var source = new EE(); stream._read = function() { console.error('stream._read'); @@ -80,7 +81,7 @@ writer.on('finish', finish); // now emit some chunks. -var chunk = "asdfg"; +var chunk = 'asdfg'; var set = 0; readStart(); diff --git a/test/parallel/test-stream2-read-sync-stack.js b/test/parallel/test-stream2-read-sync-stack.js index 48b605e46a1865..e912e1039ff558 100644 --- a/test/parallel/test-stream2-read-sync-stack.js +++ b/test/parallel/test-stream2-read-sync-stack.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Readable = require('stream').Readable; diff --git a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js index e71c37e36afcb0..8e4001f8022f1c 100644 --- a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js +++ b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js index 3604ae3ec361cb..f142c49f144fbc 100644 --- a/test/parallel/test-stream2-readable-from-list.js +++ b/test/parallel/test-stream2-readable-from-list.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var fromList = require('_stream_readable')._fromList; @@ -22,7 +23,7 @@ function run() { fn({ same: assert.deepEqual, equal: assert.equal, - end: function () { + end: function() { count--; run(); } @@ -30,7 +31,7 @@ function run() { } // ensure all tests have run -process.on("exit", function () { +process.on('exit', function() { assert.equal(count, 0); }); diff --git a/test/parallel/test-stream2-readable-legacy-drain.js b/test/parallel/test-stream2-readable-legacy-drain.js index 7e8eb6b1ef3898..4218bace2b878f 100644 --- a/test/parallel/test-stream2-readable-legacy-drain.js +++ b/test/parallel/test-stream2-readable-legacy-drain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-stream2-readable-non-empty-end.js b/test/parallel/test-stream2-readable-non-empty-end.js index d77564cacb7535..46d6f92f2b9df2 100644 --- a/test/parallel/test-stream2-readable-non-empty-end.js +++ b/test/parallel/test-stream2-readable-non-empty-end.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var Readable = require('_stream_readable'); @@ -5,7 +6,7 @@ var Readable = require('_stream_readable'); var len = 0; var chunks = new Array(10); for (var i = 1; i <= 10; i++) { - chunks[i-1] = new Buffer(i); + chunks[i - 1] = new Buffer(i); len += i; } diff --git a/test/parallel/test-stream2-readable-wrap-empty.js b/test/parallel/test-stream2-readable-wrap-empty.js index c1bc3361f23030..60417ca893300d 100644 --- a/test/parallel/test-stream2-readable-wrap-empty.js +++ b/test/parallel/test-stream2-readable-wrap-empty.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -5,18 +6,18 @@ var Readable = require('_stream_readable'); var EE = require('events').EventEmitter; var oldStream = new EE(); -oldStream.pause = function(){}; -oldStream.resume = function(){}; +oldStream.pause = function() {}; +oldStream.resume = function() {}; var newStream = new Readable().wrap(oldStream); var ended = false; newStream - .on('readable', function(){}) - .on('end', function(){ ended = true; }); + .on('readable', function() {}) + .on('end', function() { ended = true; }); oldStream.emit('end'); -process.on('exit', function(){ +process.on('exit', function() { assert.ok(ended); }); diff --git a/test/parallel/test-stream2-readable-wrap.js b/test/parallel/test-stream2-readable-wrap.js index 71f8a28265bc76..8e3e04b966010f 100644 --- a/test/parallel/test-stream2-readable-wrap.js +++ b/test/parallel/test-stream2-readable-wrap.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -9,8 +10,9 @@ var testRuns = 0, completedRuns = 0; function runTest(highWaterMark, objectMode, produce) { testRuns++; - var old = new EE; - var r = new Readable({ highWaterMark: highWaterMark, objectMode: objectMode }); + var old = new EE(); + var r = new Readable({ highWaterMark: highWaterMark, + objectMode: objectMode }); assert.equal(r, r.wrap(old)); var ended = false; @@ -50,7 +52,8 @@ function runTest(highWaterMark, objectMode, produce) { } } - var w = new Writable({ highWaterMark: highWaterMark * 2, objectMode: objectMode }); + var w = new Writable({ highWaterMark: highWaterMark * 2, + objectMode: objectMode }); var written = []; w._write = function(chunk, encoding, cb) { console.log('_write', chunk); @@ -67,19 +70,19 @@ function runTest(highWaterMark, objectMode, produce) { flow(); - function performAsserts() { + function performAsserts() { assert(ended); assert(oldEnded); assert.deepEqual(written, expected); } } -runTest(100, false, function(){ return new Buffer(100); }); -runTest(10, false, function(){ return new Buffer('xxxxxxxxxx'); }); -runTest(1, true, function(){ return { foo: 'bar' }; }); +runTest(100, false, function() { return new Buffer(100); }); +runTest(10, false, function() { return new Buffer('xxxxxxxxxx'); }); +runTest(1, true, function() { return { foo: 'bar' }; }); var objectChunks = [ 5, 'a', false, 0, '', 'xyz', { x: 4 }, 7, [], 555 ]; -runTest(1, true, function(){ return objectChunks.shift() }); +runTest(1, true, function() { return objectChunks.shift(); }); process.on('exit', function() { assert.equal(testRuns, completedRuns); diff --git a/test/parallel/test-stream2-set-encoding.js b/test/parallel/test-stream2-set-encoding.js index 47f078935bd03d..ea9a315cb1a6e1 100644 --- a/test/parallel/test-stream2-set-encoding.js +++ b/test/parallel/test-stream2-set-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var R = require('_stream_readable'); @@ -23,7 +24,7 @@ function run() { fn({ same: assert.deepEqual, equal: assert.equal, - end: function () { + end: function() { count--; run(); } @@ -31,7 +32,7 @@ function run() { } // ensure all tests have run -process.on("exit", function () { +process.on('exit', function() { assert.equal(count, 0); }); @@ -68,7 +69,7 @@ TestReader.prototype._read = function(n) { var ret = new Buffer(n); ret.fill('a'); - console.log("this.push(ret)", ret) + console.log('this.push(ret)', ret); return this.push(ret); }.bind(this), 1); @@ -146,32 +147,32 @@ test('setEncoding hex with read(13)', function(t) { tr.setEncoding('hex'); var out = []; var expect = - [ "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "16161" ]; + [ '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '16161' ]; tr.on('readable', function flow() { - console.log("readable once") + console.log('readable once'); var chunk; while (null !== (chunk = tr.read(13))) out.push(chunk); }); tr.on('end', function() { - console.log("END") + console.log('END'); t.same(out, expect); t.end(); }); @@ -278,22 +279,22 @@ test('encoding: hex with read(13)', function(t) { var tr = new TestReader(100, { encoding: 'hex' }); var out = []; var expect = - [ "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "1616161616161", - "6161616161616", - "16161" ]; + [ '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '1616161616161', + '6161616161616', + '16161' ]; tr.on('readable', function flow() { var chunk; diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index 3bdef8fbf626e4..e45c913c94f559 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var PassThrough = require('_stream_passthrough'); @@ -24,7 +25,7 @@ function run() { same: assert.deepEqual, equal: assert.equal, ok: assert, - end: function () { + end: function() { count--; run(); } @@ -32,7 +33,7 @@ function run() { } // ensure all tests have run -process.on("exit", function () { +process.on('exit', function() { assert.equal(count, 0); }); @@ -83,7 +84,7 @@ test('passthrough', function(t) { t.end(); }); -test('object passthrough', function (t) { +test('object passthrough', function(t) { var pt = new PassThrough({ objectMode: true }); pt.write(1); @@ -106,7 +107,7 @@ test('object passthrough', function (t) { }); test('simple transform', function(t) { - var pt = new Transform; + var pt = new Transform(); pt._transform = function(c, e, cb) { var ret = new Buffer(c.length); ret.fill('x'); @@ -154,7 +155,7 @@ test('simple object transform', function(t) { }); test('async passthrough', function(t) { - var pt = new Transform; + var pt = new Transform(); pt._transform = function(chunk, encoding, cb) { setTimeout(function() { pt.push(chunk); @@ -178,7 +179,7 @@ test('async passthrough', function(t) { }); test('assymetric transform (expand)', function(t) { - var pt = new Transform; + var pt = new Transform(); // emit each chunk 2 times. pt._transform = function(chunk, encoding, cb) { @@ -187,7 +188,7 @@ test('assymetric transform (expand)', function(t) { setTimeout(function() { pt.push(chunk); cb(); - }, 10) + }, 10); }, 10); }; @@ -210,7 +211,7 @@ test('assymetric transform (expand)', function(t) { }); test('assymetric transform (compress)', function(t) { - var pt = new Transform; + var pt = new Transform(); // each output is the first char of 3 consecutive chunks, // or whatever's left. @@ -348,10 +349,10 @@ test('passthrough event emission', function(t) { }); test('passthrough event emission reordered', function(t) { - var pt = new PassThrough; + var pt = new PassThrough(); var emits = 0; pt.on('readable', function() { - console.error('emit readable', emits) + console.error('emit readable', emits); emits++; }); @@ -390,7 +391,7 @@ test('passthrough event emission reordered', function(t) { test('passthrough facaded', function(t) { console.error('passthrough facaded'); - var pt = new PassThrough; + var pt = new PassThrough(); var datas = []; pt.on('data', function(chunk) { datas.push(chunk.toString()); @@ -433,8 +434,8 @@ test('object transform (json parse)', function(t) { var objects = [ { foo: 'bar' }, 100, - "string", - { nested: { things: [ { foo: 'bar' }, 100, "string" ] } } + 'string', + { nested: { things: [ { foo: 'bar' }, 100, 'string' ] } } ]; var ended = false; @@ -455,7 +456,7 @@ test('object transform (json parse)', function(t) { process.nextTick(function() { t.ok(ended); t.end(); - }) + }); }); test('object transform (json stringify)', function(t) { @@ -475,8 +476,8 @@ test('object transform (json stringify)', function(t) { var objects = [ { foo: 'bar' }, 100, - "string", - { nested: { things: [ { foo: 'bar' }, 100, "string" ] } } + 'string', + { nested: { things: [ { foo: 'bar' }, 100, 'string' ] } } ]; var ended = false; @@ -497,5 +498,5 @@ test('object transform (json stringify)', function(t) { process.nextTick(function() { t.ok(ended); t.end(); - }) + }); }); diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index 12d1c0648d2345..a430e4a58d6514 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var stream = require('stream'); @@ -11,11 +12,11 @@ var crypto = require('crypto'); var util = require('util'); function TestWriter() { - stream.Writable.call(this); + stream.Writable.call(this); } util.inherits(TestWriter, stream.Writable); -TestWriter.prototype._write = function (buffer, encoding, callback) { +TestWriter.prototype._write = function(buffer, encoding, callback) { console.log('write called'); // super slow write stream (callback never called) }; @@ -23,12 +24,12 @@ TestWriter.prototype._write = function (buffer, encoding, callback) { var dest = new TestWriter(); function TestReader(id) { - stream.Readable.call(this); - this.reads = 0; + stream.Readable.call(this); + this.reads = 0; } util.inherits(TestReader, stream.Readable); -TestReader.prototype._read = function (size) { +TestReader.prototype._read = function(size) { this.reads += 1; this.push(crypto.randomBytes(size)); }; @@ -38,13 +39,13 @@ var src2 = new TestReader(); src1.pipe(dest); -src1.once('readable', function () { - process.nextTick(function () { +src1.once('readable', function() { + process.nextTick(function() { src2.pipe(dest); - src2.once('readable', function () { - process.nextTick(function () { + src2.once('readable', function() { + process.nextTick(function() { src1.unpipe(dest); }); @@ -53,7 +54,7 @@ src1.once('readable', function () { }); -process.on('exit', function () { +process.on('exit', function() { assert.equal(src1.reads, 2); assert.equal(src2.reads, 2); }); diff --git a/test/parallel/test-stream2-unpipe-leak.js b/test/parallel/test-stream2-unpipe-leak.js index fae2b73ac4f6cf..15b510e7f643cc 100644 --- a/test/parallel/test-stream2-unpipe-leak.js +++ b/test/parallel/test-stream2-unpipe-leak.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var stream = require('stream'); diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index d90a2b6f75c468..1d87d7f920c052 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var W = require('_stream_writable'); var D = require('_stream_duplex'); @@ -46,7 +47,7 @@ function run() { fn({ same: assert.deepEqual, equal: assert.equal, - end: function () { + end: function() { count--; run(); } @@ -54,7 +55,7 @@ function run() { } // ensure all tests have run -process.on("exit", function () { +process.on('exit', function() { assert.equal(count, 0); }); @@ -196,7 +197,7 @@ test('write no bufferize', function(t) { t.end(); }); -test('write callbacks', function (t) { +test('write callbacks', function(t) { var callbacks = chunks.map(function(chunk, i) { return [i, function(er) { callbacks._called[i] = chunk; @@ -225,42 +226,42 @@ test('write callbacks', function (t) { tw.end(); }); -test('end callback', function (t) { +test('end callback', function(t) { var tw = new TestWriter(); - tw.end(function () { + tw.end(function() { t.end(); }); }); -test('end callback with chunk', function (t) { +test('end callback with chunk', function(t) { var tw = new TestWriter(); - tw.end(new Buffer('hello world'), function () { + tw.end(new Buffer('hello world'), function() { t.end(); }); }); -test('end callback with chunk and encoding', function (t) { +test('end callback with chunk and encoding', function(t) { var tw = new TestWriter(); - tw.end('hello world', 'ascii', function () { + tw.end('hello world', 'ascii', function() { t.end(); }); }); -test('end callback after .write() call', function (t) { +test('end callback after .write() call', function(t) { var tw = new TestWriter(); tw.write(new Buffer('hello world')); - tw.end(function () { + tw.end(function() { t.end(); }); }); -test('end callback called after write callback', function (t) { +test('end callback called after write callback', function(t) { var tw = new TestWriter(); var writeCalledback = false; tw.write(new Buffer('hello world'), function() { writeCalledback = true; }); - tw.end(function () { + tw.end(function() { t.equal(writeCalledback, true); t.end(); }); diff --git a/test/parallel/test-stream3-pause-then-read.js b/test/parallel/test-stream3-pause-then-read.js index 737a2f30a1d136..135629a243d66c 100644 --- a/test/parallel/test-stream3-pause-then-read.js +++ b/test/parallel/test-stream3-pause-then-read.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-string-decoder-end.js b/test/parallel/test-string-decoder-end.js index 0bac7a5f28f4d7..f931c6abb9864c 100644 --- a/test/parallel/test-string-decoder-end.js +++ b/test/parallel/test-string-decoder-end.js @@ -1,3 +1,4 @@ +'use strict'; // verify that the string decoder works getting 1 byte at a time, // the whole buffer at once, and that both match the .toString(enc) // result of the entire buffer. diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index dd28ba748b389f..c540ecfacdbf07 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var StringDecoder = require('string_decoder').StringDecoder; @@ -54,11 +55,11 @@ function test(encoding, input, expected, singleSequence) { process.stdout.write('.'); if (output !== expected) { var message = - 'Expected "'+unicodeEscape(expected)+'", '+ - 'but got "'+unicodeEscape(output)+'"\n'+ - 'Write sequence: '+JSON.stringify(sequence)+'\n'+ - 'Decoder charBuffer: 0x'+decoder.charBuffer.toString('hex')+'\n'+ - 'Full Decoder State: '+JSON.stringify(decoder, null, 2); + 'Expected "' + unicodeEscape(expected) + '", ' + + 'but got "' + unicodeEscape(output) + '"\n' + + 'Write sequence: ' + JSON.stringify(sequence) + '\n' + + 'Decoder charBuffer: 0x' + decoder.charBuffer.toString('hex') + '\n' + + 'Full Decoder State: ' + JSON.stringify(decoder, null, 2); assert.fail(output, expected, message); } }); @@ -68,7 +69,7 @@ function test(encoding, input, expected, singleSequence) { function unicodeEscape(str) { var r = ''; for (var i = 0; i < str.length; i++) { - r += '\\u'+str.charCodeAt(i).toString(16); + r += '\\u' + str.charCodeAt(i).toString(16); } return r; } @@ -86,7 +87,7 @@ function unicodeEscape(str) { function writeSequences(length, start, sequence) { if (start === undefined) { start = 0; - sequence = [] + sequence = []; } else if (start === length) { return [sequence]; } diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js index ab8eb68d34efde..4453580bd94f30 100644 --- a/test/parallel/test-stringbytes-external.js +++ b/test/parallel/test-stringbytes-external.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); // minimum string size to overflow into external string space @@ -54,7 +55,7 @@ var RADIOS = 2; var PRE_HALF_APEX = Math.ceil(EXTERN_APEX / 2) - RADIOS; var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; -(function () { +(function() { for (var j = 0; j < RADIOS * 2; j += 1) { var datum = b; var slice = datum.slice(0, PRE_HALF_APEX + j); @@ -63,7 +64,7 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; var pumped_string2 = slice2.toString('hex'); var decoded = new Buffer(pumped_string, 'hex'); - var metadata = "\nEXTERN_APEX=1031913 - pumped_string.length=" + var metadata = '\nEXTERN_APEX=1031913 - pumped_string.length='; metadata += pumped_string.length + '\n'; // the string are the same? @@ -80,7 +81,7 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; } })(); -(function () { +(function() { for (var j = 0; j < RADIOS * 2; j += 1) { var datum = b; var slice = datum.slice(0, PRE_3OF4_APEX + j); @@ -89,8 +90,8 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; var pumped_string2 = slice2.toString('base64'); var decoded = new Buffer(pumped_string, 'base64'); - var metadata = "\nEXTERN_APEX=1031913 - data=" + slice.length - metadata += " pumped_string.length=" + pumped_string.length + '\n'; + var metadata = '\nEXTERN_APEX=1031913 - data=" + slice.length'; + metadata += ' pumped_string.length=' + pumped_string.length + '\n'; // the string are the same? for (var k = 0; k < pumped_string.length - 3; ++k) { diff --git a/test/parallel/test-sys.js b/test/parallel/test-sys.js index 8b3ea082b6e135..a5631a5cb16930 100644 --- a/test/parallel/test-sys.js +++ b/test/parallel/test-sys.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tcp-wrap.js b/test/parallel/test-tcp-wrap.js index 6ed8fb44ca806e..93da3e5b3b41c8 100644 --- a/test/parallel/test-tcp-wrap.js +++ b/test/parallel/test-tcp-wrap.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timer-close.js b/test/parallel/test-timer-close.js index b374fe162cfed1..79f06dffa98731 100644 --- a/test/parallel/test-timer-close.js +++ b/test/parallel/test-timer-close.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var t = new (process.binding('timer_wrap').Timer); diff --git a/test/parallel/test-timers-args.js b/test/parallel/test-timers-args.js index 599037b95bc6e6..abb785ea0fc79c 100644 --- a/test/parallel/test-timers-args.js +++ b/test/parallel/test-timers-args.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timers-first-fire.js b/test/parallel/test-timers-first-fire.js index 385724b0b08e44..88460e1e3acb12 100644 --- a/test/parallel/test-timers-first-fire.js +++ b/test/parallel/test-timers-first-fire.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timers-immediate-queue.js b/test/parallel/test-timers-immediate-queue.js index 1c0b095f18c3d6..a71472d46442ab 100644 --- a/test/parallel/test-timers-immediate-queue.js +++ b/test/parallel/test-timers-immediate-queue.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timers-immediate.js b/test/parallel/test-timers-immediate.js index 00652d04060569..bcfc4616ac6264 100644 --- a/test/parallel/test-timers-immediate.js +++ b/test/parallel/test-timers-immediate.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timers-linked-list.js b/test/parallel/test-timers-linked-list.js index 79a9839627c98c..00b2129d126c4a 100644 --- a/test/parallel/test-timers-linked-list.js +++ b/test/parallel/test-timers-linked-list.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var L = require('_linklist'); diff --git a/test/parallel/test-timers-non-integer-delay.js b/test/parallel/test-timers-non-integer-delay.js index 229db3892dba06..a3e5420a5e4858 100644 --- a/test/parallel/test-timers-non-integer-delay.js +++ b/test/parallel/test-timers-non-integer-delay.js @@ -1,3 +1,4 @@ +'use strict'; /* * This test makes sure that non-integer timer delays do not make the process * hang. See https://github.com/joyent/node/issues/8065 and diff --git a/test/parallel/test-timers-ordering.js b/test/parallel/test-timers-ordering.js index 9f40288ec56068..730a78a072c663 100644 --- a/test/parallel/test-timers-ordering.js +++ b/test/parallel/test-timers-ordering.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var Timer = process.binding('timer_wrap').Timer; @@ -13,13 +14,15 @@ var start = Timer.now(); var f = function(i) { if (i <= N) { // check order - assert.equal(i, last_i + 1, 'order is broken: ' + i + ' != ' + last_i + ' + 1'); + assert.equal(i, last_i + 1, 'order is broken: ' + i + ' != ' + + last_i + ' + 1'); last_i = i; // check that this iteration is fired at least 1ms later than the previous var now = Timer.now(); console.log(i, now); - assert(now >= last_ts + 1, 'current ts ' + now + ' < prev ts ' + last_ts + ' + 1'); + assert(now >= last_ts + 1, + 'current ts ' + now + ' < prev ts ' + last_ts + ' + 1'); last_ts = now; // schedule next iteration diff --git a/test/parallel/test-timers-this.js b/test/parallel/test-timers-this.js index cacb3f247cc4b8..df710b9cb8d5c9 100644 --- a/test/parallel/test-timers-this.js +++ b/test/parallel/test-timers-this.js @@ -1,37 +1,38 @@ +'use strict'; var assert = require('assert'); var immediateThis, intervalThis, timeoutThis, immediateArgsThis, intervalArgsThis, timeoutArgsThis; -var immediateHandler = setImmediate(function () { +var immediateHandler = setImmediate(function() { immediateThis = this; }); -var immediateArgsHandler = setImmediate(function () { +var immediateArgsHandler = setImmediate(function() { immediateArgsThis = this; -}, "args ..."); +}, 'args ...'); -var intervalHandler = setInterval(function () { +var intervalHandler = setInterval(function() { clearInterval(intervalHandler); intervalThis = this; }); -var intervalArgsHandler = setInterval(function () { +var intervalArgsHandler = setInterval(function() { clearInterval(intervalArgsHandler); intervalArgsThis = this; -}, 0, "args ..."); +}, 0, 'args ...'); -var timeoutHandler = setTimeout(function () { +var timeoutHandler = setTimeout(function() { timeoutThis = this; }); -var timeoutArgsHandler = setTimeout(function () { +var timeoutArgsHandler = setTimeout(function() { timeoutArgsThis = this; -}, 0, "args ..."); +}, 0, 'args ...'); -process.once('exit', function () { +process.once('exit', function() { assert.strictEqual(immediateThis, immediateHandler); assert.strictEqual(immediateArgsThis, immediateArgsHandler); diff --git a/test/parallel/test-timers-uncaught-exception.js b/test/parallel/test-timers-uncaught-exception.js index 4e137427939654..794b3b923be1df 100644 --- a/test/parallel/test-timers-uncaught-exception.js +++ b/test/parallel/test-timers-uncaught-exception.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timers-unref-call.js b/test/parallel/test-timers-unref-call.js index 4f7865b8457601..b348330d200d65 100644 --- a/test/parallel/test-timers-unref-call.js +++ b/test/parallel/test-timers-unref-call.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var Timer = process.binding('timer_wrap').Timer; diff --git a/test/parallel/test-timers-unref-leak.js b/test/parallel/test-timers-unref-leak.js index c8f958a47c40d2..55907d9bc4898d 100644 --- a/test/parallel/test-timers-unref-leak.js +++ b/test/parallel/test-timers-unref-leak.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var called = 0; diff --git a/test/parallel/test-timers-unref.js b/test/parallel/test-timers-unref.js index 2f750228a4ef3f..ab2e33acd21019 100644 --- a/test/parallel/test-timers-unref.js +++ b/test/parallel/test-timers-unref.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -53,9 +54,14 @@ setInterval(function() { })(); process.on('exit', function() { - assert.strictEqual(interval_fired, false, 'Interval should not fire'); - assert.strictEqual(timeout_fired, false, 'Timeout should not fire'); - assert.strictEqual(unref_timer, true, 'An unrefd timeout should still fire'); - assert.strictEqual(unref_interval, true, 'An unrefd interval should still fire'); - assert.strictEqual(unref_callbacks, 1, 'Callback should only run once'); + assert.strictEqual(interval_fired, false, + 'Interval should not fire'); + assert.strictEqual(timeout_fired, false, + 'Timeout should not fire'); + assert.strictEqual(unref_timer, true, + 'An unrefd timeout should still fire'); + assert.strictEqual(unref_interval, true, + 'An unrefd interval should still fire'); + assert.strictEqual(unref_callbacks, 1, + 'Callback should only run once'); }); diff --git a/test/parallel/test-timers-unrefd-interval-still-fires.js b/test/parallel/test-timers-unrefd-interval-still-fires.js index 3ea94454cfdb49..50a473b9c8b4b8 100644 --- a/test/parallel/test-timers-unrefd-interval-still-fires.js +++ b/test/parallel/test-timers-unrefd-interval-still-fires.js @@ -1,3 +1,4 @@ +'use strict'; /* * This test is a regression test for joyent/node#8900. */ diff --git a/test/parallel/test-timers-zero-timeout.js b/test/parallel/test-timers-zero-timeout.js index 939b8db1bb30db..1c84814363a641 100644 --- a/test/parallel/test-timers-zero-timeout.js +++ b/test/parallel/test-timers-zero-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-timers.js b/test/parallel/test-timers.js index dad1bcc69389a0..e784e262959d97 100644 --- a/test/parallel/test-timers.js +++ b/test/parallel/test-timers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js index 0d01805154255a..fd10206a126359 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -31,8 +32,8 @@ var server = tls.createServer({ assert.equal(cert.subjectaltname, 'DNS:google.com\0.evil.com, ' + 'DNS:just-another.com, ' + - 'IP Address:8.8.8.8, '+ - 'IP Address:8.8.4.4, '+ + 'IP Address:8.8.8.8, ' + + 'IP Address:8.8.4.4, ' + 'DNS:last.com'); c.write('ok'); }); diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js index 045e69b9495e74..ed8999b6b7a409 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index a96a104f24d3d2..97087d0b3b4c03 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -30,7 +31,8 @@ var server = tls.Server({ key: loadPEM('agent2-key'), cert:loadPEM('agent2-cert') }, null).listen(common.PORT, function() { - var args = ['s_client', '-quiet', '-tls1_1','-connect', '127.0.0.1:' + common.PORT]; + var args = ['s_client', '-quiet', '-tls1_1', + '-connect', '127.0.0.1:' + common.PORT]; var client = spawn(common.opensslCli, args); var out = ''; client.stderr.setEncoding('utf8'); diff --git a/test/parallel/test-tls-cert-regression.js b/test/parallel/test-tls-cert-regression.js index c7b1742856aead..24bc4242749f6c 100644 --- a/test/parallel/test-tls-cert-regression.js +++ b/test/parallel/test-tls-cert-regression.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index 85413b62e3d591..e40cbb0f9da137 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); diff --git a/test/parallel/test-tls-client-abort.js b/test/parallel/test-tls-client-abort.js index a2a4bba5bbd28c..25e44716c1d700 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-client-abort2.js b/test/parallel/test-tls-client-abort2.js index 7874d3d25acd56..b64482b58dc03c 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-client-default-ciphers.js b/test/parallel/test-tls-client-default-ciphers.js index e1422bac6f3662..5da57173315a09 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); @@ -15,7 +16,7 @@ function test1() { tls.createSecureContext = function(options) { ciphers = options.ciphers; throw new Done(); - } + }; try { var s = tls.connect(common.PORT); diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js index 08b261a7222e0c..6a1a899103d9e9 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -1,3 +1,4 @@ +'use strict'; // Create an ssl server. First connection, validate that not resume. // Cache session and close connection. Use session on second connection. // ASSERT resumption. diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js index 887ff283ad0a52..9e09493c6a464d 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js index 75d96b69335d84..8b36224a7f2a37 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -1,3 +1,4 @@ +'use strict'; // Create an ssl server. First connection, validate that not resume. // Cache session and close connection. Use session on second connection. // ASSERT resumption. diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index bdbde6f9931175..f206929f59560c 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js index 3960a62694042e..cfb9aab0d9789f 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/parallel/test-tls-connect-given-socket.js b/test/parallel/test-tls-connect-given-socket.js index e309d824aba201..9e8170b13af1b7 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-connect-no-host.js b/test/parallel/test-tls-connect-no-host.js index 2faf97867cafc9..6d04890d4dcca1 100644 --- a/test/parallel/test-tls-connect-no-host.js +++ b/test/parallel/test-tls-connect-no-host.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.hasCrypto) { @@ -29,6 +30,6 @@ var socket = tls.connect({ // Error: Hostname/IP doesn't match certificate's altnames: // "Host: undefined. is not cert's CN: localhost" }, function() { - assert(socket.authorized); - process.exit(); + assert(socket.authorized); + process.exit(); }); diff --git a/test/parallel/test-tls-connect-pipe.js b/test/parallel/test-tls-connect-pipe.js index 70daa0d75ab047..bded532720f98b 100644 --- a/test/parallel/test-tls-connect-pipe.js +++ b/test/parallel/test-tls-connect-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js index 04eb5f408a6b81..feaa7c887b1e30 100644 --- a/test/parallel/test-tls-connect-simple.js +++ b/test/parallel/test-tls-connect-simple.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-connect-stream-writes.js b/test/parallel/test-tls-connect-stream-writes.js index 0bf1db12b71eb8..4187c9b439e2f1 100644 --- a/test/parallel/test-tls-connect-stream-writes.js +++ b/test/parallel/test-tls-connect-stream-writes.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'), fs = require('fs'), path = require('path'), diff --git a/test/parallel/test-tls-connect.js b/test/parallel/test-tls-connect.js index f74dc089533c00..160d874bed3355 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js index fba10ceffd97bd..00731592445f04 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index eb59c84957b52d..5c9eb87b2e2935 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 1799ec454c0cec..1ed4ea35738d5f 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 042491672ff407..cd144d79e0e073 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index c339fc5be60a61..f451df68470c53 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js index e9245aa0d5eae1..24e8bfc6886f16 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js index efff0c66a3169b..b2f2de137da8fa 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index 414010c0336e7e..12e3b8f9c64ecf 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-handshake-nohang.js b/test/parallel/test-tls-handshake-nohang.js index 73869892fb9ff7..181d6408e05abc 100644 --- a/test/parallel/test-tls-handshake-nohang.js +++ b/test/parallel/test-tls-handshake-nohang.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index 463fdaa44b53e3..3ed82c536a9e7a 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -40,7 +41,7 @@ var server = tls.createServer(options, function(c) { } }); - client.on('close', function (hadError) { + client.on('close', function(hadError) { assert.strictEqual(hadError, true, 'Client never errored'); }); }); diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js index 7fd0b813d6d4c4..76e6fe077ffef9 100644 --- a/test/parallel/test-tls-inception.js +++ b/test/parallel/test-tls-inception.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -20,7 +21,7 @@ options = { }; // the "proxy" server -a = tls.createServer(options, function (socket) { +a = tls.createServer(options, function(socket) { var options = { host: '127.0.0.1', port: b.address().port, @@ -36,16 +37,16 @@ a = tls.createServer(options, function (socket) { }); // the "target" server -b = tls.createServer(options, function (socket) { +b = tls.createServer(options, function(socket) { socket.end('hello'); }); -process.on('exit', function () { +process.on('exit', function() { assert(gotHello); }); -a.listen(common.PORT, function () { - b.listen(common.PORT + 1, function () { +a.listen(common.PORT, function() { + b.listen(common.PORT + 1, function() { options = { host: '127.0.0.1', port: a.address().port, @@ -58,11 +59,11 @@ a.listen(common.PORT, function () { rejectUnauthorized: false }); ssl.setEncoding('utf8'); - ssl.once('data', function (data) { + ssl.once('data', function(data) { assert.equal('hello', data); gotHello = true; }); - ssl.on('end', function () { + ssl.on('end', function() { ssl.end(); a.close(); b.close(); diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js index 96a7a600381d1b..e726e16998a908 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index c6e94158829c35..f9607e1f4fa928 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js index 12c3381cb4fd60..e156f446f57de9 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js index 3fd129cbf6d470..01a83ef214e0b6 100644 --- a/test/parallel/test-tls-junk-closes-server.js +++ b/test/parallel/test-tls-junk-closes-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.hasCrypto) { diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js index cd7ad605a89675..35da4687493a21 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index 4033b308acdb71..3e41cfa45c7d30 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js index 85ff5e808cfe16..76aa97d1ff3daf 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index 75afc110999aa6..02bbb6b664a2cf 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.hasCrypto) { diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js index 389cd329c6fd4f..fd64438ead7f4e 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index 56fd89f76a3225..931bf5dba050b9 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index 0fc0dcc3ae3fea..4e1975a1e00a25 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index 406751b0289cb5..bebb6799b9f49c 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -1,3 +1,4 @@ +'use strict'; if (!process.features.tls_npn) { console.error('Skipping because node compiled without OpenSSL or ' + 'with old OpenSSL version.'); diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js index a9ac6ffa17d359..73f1c5772a59fb 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!process.features.tls_ocsp) { diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js index f4866701e23eb5..8d95a997200786 100644 --- a/test/parallel/test-tls-on-empty-socket.js +++ b/test/parallel/test-tls-on-empty-socket.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js index c851f02a575259..cf7ab78685c364 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index f1253ee51b986f..ce68fce5f02b99 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index 95f293d234e803..f9d68f1395420a 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 536bfae2031934..533b9126cda573 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-peer-certificate-multi-keys.js b/test/parallel/test-tls-peer-certificate-multi-keys.js index 3488600e272091..fde55af50be2bf 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js index afd88531ea4a31..8164154779f998 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-request-timeout.js b/test/parallel/test-tls-request-timeout.js index a5dcdd37e4dfdc..8915dee1f199c3 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 99bd4dd6f92606..7ddba939bacd30 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index 0204bc5d1f074e..f30134f04ac0a5 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.opensslCli) { diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index 8ba2deec2e2ebd..7ba063a3a029af 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.opensslCli) { diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index ba4341633b0895..f5284c1b58b4ac 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.opensslCli) { diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js index d73572c93ba0f7..fa0d72b5ad4bd7 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index 3768c7eaac8f48..68ef2caa9819d3 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -1,3 +1,4 @@ +'use strict'; if (!process.features.tls_sni) { console.error('Skipping because node compiled without OpenSSL or ' + 'with old OpenSSL version.'); @@ -146,6 +147,6 @@ process.on('exit', function() { assert.deepEqual(serverResults, ['a.example.com', 'b.example.com', 'c.wrong.com', null]); assert.deepEqual(clientResults, [true, true, false, false]); - assert.deepEqual(clientErrors, [null, null, null, "socket hang up"]); - assert.deepEqual(serverErrors, [null, null, null, "Invalid SNI context"]); + assert.deepEqual(clientErrors, [null, null, null, 'socket hang up']); + assert.deepEqual(serverErrors, [null, null, null, 'Invalid SNI context']); }); diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js index a1d867233b047a..dec829face184e 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -1,3 +1,4 @@ +'use strict'; if (!process.features.tls_sni) { console.error('Skipping because node compiled without OpenSSL or ' + 'with old OpenSSL version.'); diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index 1b20e5ac8e90d9..a9798df0597945 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js index cf5cae9c8a8f7c..450f6b54a52809 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -31,7 +32,9 @@ function createServer() { return server; } -var servers = [ createServer(), createServer(), createServer(), createServer(), createServer(), createServer() ]; +var servers = [ createServer(), createServer(), + createServer(), createServer(), + createServer(), createServer() ]; // Create one TCP server and balance sockets to multiple TLS server instances var shared = net.createServer(function(c) { diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index dc3d52da01b875..f2dca0b9ab1f7e 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js index 47845fae39751c..4a9265079bf136 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js index 75952da6a37326..af1d84317854d9 100644 --- a/test/parallel/test-tls-wrap-timeout.js +++ b/test/parallel/test-tls-wrap-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tls-zero-clear-in.js b/test/parallel/test-tls-zero-clear-in.js index 38b21f401e21a4..6eeba92585603f 100644 --- a/test/parallel/test-tls-zero-clear-in.js +++ b/test/parallel/test-tls-zero-clear-in.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tty-stdout-end.js b/test/parallel/test-tty-stdout-end.js index a2f3ad12f4aca7..190acae42870a9 100644 --- a/test/parallel/test-tty-stdout-end.js +++ b/test/parallel/test-tty-stdout-end.js @@ -1,3 +1,4 @@ +'use strict'; // Can't test this when 'make test' doesn't assign a tty to the stdout. var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-tty-wrap.js b/test/parallel/test-tty-wrap.js index 1cd014992dcad6..370c959ea297a6 100644 --- a/test/parallel/test-tty-wrap.js +++ b/test/parallel/test-tty-wrap.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-umask.js b/test/parallel/test-umask.js index 84c34412189d25..94d3a1d06f9c6c 100644 --- a/test/parallel/test-umask.js +++ b/test/parallel/test-umask.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js index 9b5211d29bc400..4e3251a9da3517 100644 --- a/test/parallel/test-url.js +++ b/test/parallel/test-url.js @@ -1,3 +1,5 @@ +/* eslint-disable max-len */ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -553,7 +555,6 @@ var parseTests = { 'http://bucket_name.s3.amazonaws.com/image.jpg': { protocol: 'http:', - 'slashes': true, slashes: true, host: 'bucket_name.s3.amazonaws.com', hostname: 'bucket_name.s3.amazonaws.com', @@ -857,11 +858,11 @@ var parseTests = { }; for (var u in parseTests) { - var actual = url.parse(u), - spaced = url.parse(' \t ' + u + '\n\t'); - expected = parseTests[u]; + var actual = url.parse(u); + var spaced = url.parse(' \t ' + u + '\n\t'); + var expected = parseTests[u]; - Object.keys(actual).forEach(function (i) { + Object.keys(actual).forEach(function(i) { if (expected[i] === undefined && actual[i] === null) { expected[i] = null; } @@ -1097,7 +1098,7 @@ var formatTests = { query: { foo: 'theA1' }, - hash: "#bar" + hash: '#bar' }, // `#`,`?` in path + `#` in query @@ -1107,7 +1108,7 @@ var formatTests = { query: { foo: 'the#1' }, - hash: "#bar" + hash: '#bar' }, // `?` and `#` in path and search @@ -1269,7 +1270,7 @@ var relativeTests2 = [ ['g?y#s', bases[0], 'http://a/b/c/g?y#s'], [';x', bases[0], 'http://a/b/c/;x'], ['g;x', bases[0], 'http://a/b/c/g;x'], - ['g;x?y#s' , bases[0], 'http://a/b/c/g;x?y#s'], + ['g;x?y#s', bases[0], 'http://a/b/c/g;x?y#s'], // changed with RFC 2396bis //('', bases[0], CURRENT_DOC_URI], ['', bases[0], 'http://a/b/c/d;p?q'], @@ -1280,7 +1281,7 @@ var relativeTests2 = [ ['../g', bases[0], 'http://a/b/g'], ['../..', bases[0], 'http://a/'], ['../../', bases[0], 'http://a/'], - ['../../g' , bases[0], 'http://a/g'], + ['../../g', bases[0], 'http://a/g'], ['../../../g', bases[0], ('http://a/../g', 'http://a/g')], ['../../../../g', bases[0], ('http://a/../../g', 'http://a/g')], // changed with RFC 2396bis @@ -1319,16 +1320,16 @@ var relativeTests2 = [ //('?y', bases[1], 'http://a/b/c/?y'], ['?y', bases[1], 'http://a/b/c/d;p?y'], ['g?y', bases[1], 'http://a/b/c/g?y'], - ['g?y/./x' , bases[1], 'http://a/b/c/g?y/./x'], + ['g?y/./x', bases[1], 'http://a/b/c/g?y/./x'], ['g?y/../x', bases[1], 'http://a/b/c/g?y/../x'], ['g#s', bases[1], 'http://a/b/c/g#s'], - ['g#s/./x' , bases[1], 'http://a/b/c/g#s/./x'], + ['g#s/./x', bases[1], 'http://a/b/c/g#s/./x'], ['g#s/../x', bases[1], 'http://a/b/c/g#s/../x'], ['./', bases[1], 'http://a/b/c/'], ['../', bases[1], 'http://a/b/'], ['../g', bases[1], 'http://a/b/g'], ['../../', bases[1], 'http://a/'], - ['../../g' , bases[1], 'http://a/g'], + ['../../g', bases[1], 'http://a/g'], // http://gbiv.com/protocols/uri/test/rel_examples3.html // slashes in path params @@ -1345,7 +1346,7 @@ var relativeTests2 = [ ['../', bases[2], 'http://a/b/c/'], ['../g', bases[2], 'http://a/b/c/g'], ['../../', bases[2], 'http://a/b/'], - ['../../g' , bases[2], 'http://a/b/g'], + ['../../g', bases[2], 'http://a/b/g'], // http://gbiv.com/protocols/uri/test/rel_examples4.html // double and triple slash, unknown scheme @@ -1362,7 +1363,7 @@ var relativeTests2 = [ ['../g', bases[3], 'fred:///s//a/g'], ['../../', bases[3], 'fred:///s//'], - ['../../g' , bases[3], 'fred:///s//g'], + ['../../g', bases[3], 'fred:///s//g'], ['../../../g', bases[3], 'fred:///s/g'], // may change to fred:///s//a/../../../g ['../../../../g', bases[3], 'fred:///g'], @@ -1381,7 +1382,7 @@ var relativeTests2 = [ ['../', bases[4], 'http:///s//a/'], ['../g', bases[4], 'http:///s//a/g'], ['../../', bases[4], 'http:///s//'], - ['../../g' , bases[4], 'http:///s//g'], + ['../../g', bases[4], 'http:///s//g'], // may change to http:///s//a/../../g ['../../../g', bases[4], 'http:///s/g'], // may change to http:///s//a/../../../g @@ -1569,10 +1570,10 @@ var throws = [ true, false, 0, - function () {} + function() {} ]; for (var i = 0; i < throws.length; i++) { - assert.throws(function () { url.format(throws[i]); }, TypeError); + assert.throws(function() { url.format(throws[i]); }, TypeError); }; assert(url.format('') === ''); assert(url.format({}) === ''); diff --git a/test/parallel/test-utf8-scripts.js b/test/parallel/test-utf8-scripts.js index b9bef97a5eabfe..3a891283509b9e 100644 --- a/test/parallel/test-utf8-scripts.js +++ b/test/parallel/test-utf8-scripts.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index 715509419806af..6761671e1997bd 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -57,8 +58,10 @@ assert.equal(util.format('%%%s%%%%', 'hi'), '%hi%%'); assert.equal(util.format(new Error('foo')), '[Error: foo]'); function CustomError(msg) { Error.call(this); - Object.defineProperty(this, 'message', { value: msg, enumerable: false }); - Object.defineProperty(this, 'name', { value: 'CustomError', enumerable: false }); + Object.defineProperty(this, 'message', + { value: msg, enumerable: false }); + Object.defineProperty(this, 'name', + { value: 'CustomError', enumerable: false }); } util.inherits(CustomError, Error); assert.equal(util.format(new CustomError('bar')), '[CustomError: bar]'); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index ac4bb0e84706b9..f583005ce96f75 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -92,7 +93,7 @@ var w = { '\\\\': 2, '\\\\\\': 3, '\\\\\\\\': 4, -} +}; var y = ['a', 'b', 'c']; y['\\\\\\'] = 'd'; @@ -112,16 +113,16 @@ function test_color_style(style, input, implicit) { var with_color = util.inspect(input, false, 0, true); var expect = '\u001b[' + color[0] + 'm' + without_color + '\u001b[' + color[1] + 'm'; - assert.equal(with_color, expect, 'util.inspect color for style '+style); + assert.equal(with_color, expect, 'util.inspect color for style ' + style); } -test_color_style('special', function(){}); +test_color_style('special', function() {}); test_color_style('number', 123.456); test_color_style('boolean', true); test_color_style('undefined', undefined); test_color_style('null', null); test_color_style('string', 'test string'); -test_color_style('date', new Date); +test_color_style('date', new Date()); test_color_style('regexp', /regexp/); // an object with "hasOwnProperty" overwritten should not throw @@ -146,10 +147,14 @@ assert(util.inspect(subject, { depth: null }).indexOf('{ d: 0 }') !== -1); // "customInspect" option can enable/disable calling inspect() on objects subject = { inspect: function() { return 123; } }; -assert(util.inspect(subject, { customInspect: true }).indexOf('123') !== -1); -assert(util.inspect(subject, { customInspect: true }).indexOf('inspect') === -1); -assert(util.inspect(subject, { customInspect: false }).indexOf('123') === -1); -assert(util.inspect(subject, { customInspect: false }).indexOf('inspect') !== -1); +assert(util.inspect(subject, + { customInspect: true }).indexOf('123') !== -1); +assert(util.inspect(subject, + { customInspect: true }).indexOf('inspect') === -1); +assert(util.inspect(subject, + { customInspect: false }).indexOf('123') === -1); +assert(util.inspect(subject, + { customInspect: false }).indexOf('inspect') !== -1); // custom inspect() functions should be able to return other Objects subject.inspect = function() { return { foo: 'bar' }; }; @@ -166,7 +171,7 @@ util.inspect(subject, { customInspectOptions: true }); function test_lines(input) { var count_lines = function(str) { return (str.match(/\n/g) || []).length; - } + }; var without_color = util.inspect(input); var with_color = util.inspect(input, {colors: true}); @@ -232,19 +237,20 @@ if (typeof Symbol !== 'undefined') { subject[Symbol('symbol')] = 42; assert.equal(util.inspect(subject), '[ 1, 2, 3 ]'); - assert.equal(util.inspect(subject, options), '[ 1, 2, 3, [length]: 3, [Symbol(symbol)]: 42 ]'); + assert.equal(util.inspect(subject, options), + '[ 1, 2, 3, [length]: 3, [Symbol(symbol)]: 42 ]'); } // test Set -assert.equal(util.inspect(new Set), 'Set {}'); +assert.equal(util.inspect(new Set()), 'Set {}'); assert.equal(util.inspect(new Set([1, 2, 3])), 'Set { 1, 2, 3 }'); var set = new Set(['foo']); set.bar = 42; assert.equal(util.inspect(set, true), 'Set { \'foo\', [size]: 1, bar: 42 }'); // test Map -assert.equal(util.inspect(new Map), 'Map {}'); +assert.equal(util.inspect(new Map()), 'Map {}'); assert.equal(util.inspect(new Map([[1, 'a'], [2, 'b'], [3, 'c']])), 'Map { 1 => \'a\', 2 => \'b\', 3 => \'c\' }'); var map = new Map([['foo', null]]); @@ -265,7 +271,7 @@ assert.equal(util.inspect(promise), 'Promise { \'foo\', bar: 42 }'); // a bonafide native Promise. var oldPromise = Promise; global.Promise = function() { this.bar = 42; }; -assert.equal(util.inspect(new Promise), '{ bar: 42 }'); +assert.equal(util.inspect(new Promise()), '{ bar: 42 }'); global.Promise = oldPromise; @@ -299,4 +305,4 @@ checkAlignment(function() { return obj; }()); checkAlignment(new Set(big_array)); -checkAlignment(new Map(big_array.map(function (y) { return [y, null] }))); +checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js index f157c80bec93dc..fbe3963348adb9 100644 --- a/test/parallel/test-util-log.js +++ b/test/parallel/test-util-log.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var util = require('util'); @@ -17,7 +18,7 @@ var tests = [ {input: null, output: 'null'}, {input: false, output: 'false'}, {input: 42, output: '42'}, - {input: function(){}, output: '[Function]'}, + {input: function() {}, output: '[Function]'}, {input: parseInt('not a number', 10), output: 'NaN'}, {input: {answer: 42}, output: '{ answer: 42 }'}, {input: [1,2,3], output: '[ 1, 2, 3 ]'} diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js index 03456d64393842..2795d3ecd68662 100644 --- a/test/parallel/test-util.js +++ b/test/parallel/test-util.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -13,7 +14,7 @@ assert.equal(true, util.isArray(context('Array')())); assert.equal(false, util.isArray({})); assert.equal(false, util.isArray({ push: function() {} })); assert.equal(false, util.isArray(/regexp/)); -assert.equal(false, util.isArray(new Error)); +assert.equal(false, util.isArray(new Error())); assert.equal(false, util.isArray(Object.create(Array.prototype))); // isRegExp @@ -33,13 +34,13 @@ assert.equal(true, util.isDate(new (context('Date')))); assert.equal(false, util.isDate(Date())); assert.equal(false, util.isDate({})); assert.equal(false, util.isDate([])); -assert.equal(false, util.isDate(new Error)); +assert.equal(false, util.isDate(new Error())); assert.equal(false, util.isDate(Object.create(Date.prototype))); // isError -assert.equal(true, util.isError(new Error)); -assert.equal(true, util.isError(new TypeError)); -assert.equal(true, util.isError(new SyntaxError)); +assert.equal(true, util.isError(new Error())); +assert.equal(true, util.isError(new TypeError())); +assert.equal(true, util.isError(new SyntaxError())); assert.equal(true, util.isError(new (context('Error')))); assert.equal(true, util.isError(new (context('TypeError')))); assert.equal(true, util.isError(new (context('SyntaxError')))); @@ -53,11 +54,11 @@ assert.ok(util.isObject({}) === true); // isPrimitive assert.equal(false, util.isPrimitive({})); -assert.equal(false, util.isPrimitive(new Error)); +assert.equal(false, util.isPrimitive(new Error())); assert.equal(false, util.isPrimitive(new Date())); assert.equal(false, util.isPrimitive([])); assert.equal(false, util.isPrimitive(/regexp/)); -assert.equal(false, util.isPrimitive(function(){})); +assert.equal(false, util.isPrimitive(function() {})); assert.equal(false, util.isPrimitive(new Number(1))); assert.equal(false, util.isPrimitive(new String('bla'))); assert.equal(false, util.isPrimitive(new Boolean(true))); @@ -81,7 +82,7 @@ assert.deepEqual(util._extend({a:1, b:2}, {b:3}), {a:1, b:3}); // inherits var ctor = function() {}; -assert.throws(function() { util.inherits(ctor, {}) }, TypeError); -assert.throws(function() { util.inherits(ctor, null) }, TypeError); -assert.throws(function() { util.inherits(null, ctor) }, TypeError); -assert.doesNotThrow(function() { util.inherits(ctor, ctor) }, TypeError); +assert.throws(function() { util.inherits(ctor, {}); }, TypeError); +assert.throws(function() { util.inherits(ctor, null); }, TypeError); +assert.throws(function() { util.inherits(null, ctor); }, TypeError); +assert.doesNotThrow(function() { util.inherits(ctor, ctor); }, TypeError); diff --git a/test/parallel/test-v8-flag-type-check.js b/test/parallel/test-v8-flag-type-check.js index 1bb501df43606c..68bf30dba3cdbc 100644 --- a/test/parallel/test-v8-flag-type-check.js +++ b/test/parallel/test-v8-flag-type-check.js @@ -1,6 +1,7 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var v8 = require('v8'); -assert.throws(function() {v8.setFlagsFromString(1)}, TypeError); -assert.throws(function() {v8.setFlagsFromString()}, TypeError); +assert.throws(function() {v8.setFlagsFromString(1);}, TypeError); +assert.throws(function() {v8.setFlagsFromString();}, TypeError); diff --git a/test/parallel/test-v8-flags.js b/test/parallel/test-v8-flags.js index 886583e4c51229..d21cbc6c2635a5 100644 --- a/test/parallel/test-v8-flags.js +++ b/test/parallel/test-v8-flags.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var v8 = require('v8'); @@ -8,5 +9,5 @@ assert(eval('%_IsSmi(42)')); assert(vm.runInThisContext('%_IsSmi(42)')); v8.setFlagsFromString('--noallow_natives_syntax'); -assert.throws(function() { eval('%_IsSmi(42)') }, SyntaxError); -assert.throws(function() { vm.runInThisContext('%_IsSmi(42)') }, SyntaxError); +assert.throws(function() { eval('%_IsSmi(42)'); }, SyntaxError); +assert.throws(function() { vm.runInThisContext('%_IsSmi(42)'); }, SyntaxError); diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js index 7acb9db1e04306..e48c1d70365073 100644 --- a/test/parallel/test-v8-stats.js +++ b/test/parallel/test-v8-stats.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var v8 = require('v8'); diff --git a/test/parallel/test-vm-basic.js b/test/parallel/test-vm-basic.js index 092aa1a6363904..96c615c44af10c 100644 --- a/test/parallel/test-vm-basic.js +++ b/test/parallel/test-vm-basic.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-context-async-script.js b/test/parallel/test-vm-context-async-script.js index 979fc24a1671b4..e146d48343aa60 100644 --- a/test/parallel/test-vm-context-async-script.js +++ b/test/parallel/test-vm-context-async-script.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); @@ -7,7 +8,7 @@ var sandbox = { setTimeout: setTimeout }; var ctx = vm.createContext(sandbox); vm.runInContext('setTimeout(function() { x = 3; }, 0);', ctx); -setTimeout(function () { +setTimeout(function() { assert.strictEqual(sandbox.x, 3); assert.strictEqual(ctx.x, 3); }, 1); diff --git a/test/parallel/test-vm-context-property-forwarding.js b/test/parallel/test-vm-context-property-forwarding.js index b1012f5dee05a5..5fcd64b8ba9094 100644 --- a/test/parallel/test-vm-context-property-forwarding.js +++ b/test/parallel/test-vm-context-property-forwarding.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-context.js b/test/parallel/test-vm-context.js index cdf76529efc08b..45e19e6638892e 100644 --- a/test/parallel/test-vm-context.js +++ b/test/parallel/test-vm-context.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -22,7 +23,7 @@ assert.equal(3, context.foo); assert.equal('lala', context.thing); // Issue GH-227: -assert.throws(function () { +assert.throws(function() { vm.runInNewContext('', null, 'some.js'); }, TypeError); diff --git a/test/parallel/test-vm-create-and-run-in-context.js b/test/parallel/test-vm-create-and-run-in-context.js index cf6a4875d5aa64..01df6ad4531e4a 100644 --- a/test/parallel/test-vm-create-and-run-in-context.js +++ b/test/parallel/test-vm-create-and-run-in-context.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-vm-create-context-accessors.js b/test/parallel/test-vm-create-context-accessors.js index 23fc935389def8..678cf3fbd2128e 100644 --- a/test/parallel/test-vm-create-context-accessors.js +++ b/test/parallel/test-vm-create-context-accessors.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-create-context-arg.js b/test/parallel/test-vm-create-context-arg.js index 65dcf05e2b2bf3..d44eeec18decd5 100644 --- a/test/parallel/test-vm-create-context-arg.js +++ b/test/parallel/test-vm-create-context-arg.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); @@ -12,7 +13,7 @@ assert.doesNotThrow(function() { }); assert.doesNotThrow(function() { - var sandbox = {}; - vm.createContext(sandbox); - vm.createContext(sandbox); + var sandbox = {}; + vm.createContext(sandbox); + vm.createContext(sandbox); }); diff --git a/test/parallel/test-vm-create-context-circular-reference.js b/test/parallel/test-vm-create-context-circular-reference.js index ae23eba167b9fb..cb6a90dcaef321 100644 --- a/test/parallel/test-vm-create-context-circular-reference.js +++ b/test/parallel/test-vm-create-context-circular-reference.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-cross-context.js b/test/parallel/test-vm-cross-context.js index 56c6040be7f5d6..20a3792b28578e 100644 --- a/test/parallel/test-vm-cross-context.js +++ b/test/parallel/test-vm-cross-context.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -5,5 +6,5 @@ var vm = require('vm'); var ctx = vm.createContext(global); assert.doesNotThrow(function() { - vm.runInContext("!function() { var x = console.log; }()", ctx); + vm.runInContext('!function() { var x = console.log; }()', ctx); }); diff --git a/test/parallel/test-vm-debug-context.js b/test/parallel/test-vm-debug-context.js index 0d6f4d0ac4a775..2f74f3ed8e2099 100644 --- a/test/parallel/test-vm-debug-context.js +++ b/test/parallel/test-vm-debug-context.js @@ -1,3 +1,5 @@ +/* eslint-disable no-debugger */ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-function-declaration.js b/test/parallel/test-vm-function-declaration.js index c9a4fbb03eb620..5ff194e12dd8d8 100644 --- a/test/parallel/test-vm-function-declaration.js +++ b/test/parallel/test-vm-function-declaration.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -13,7 +14,7 @@ code += 'function b(){}\n'; // Grab the global b function as the completion value, to ensure that // we are getting the global function, and not some other thing -code += '(function(){return this})().b;\n' +code += '(function(){return this})().b;\n'; var res = vm.runInContext(code, o, 'test'); diff --git a/test/parallel/test-vm-global-define-property.js b/test/parallel/test-vm-global-define-property.js index ea30a4f3156745..f7f3e4f3df7d76 100644 --- a/test/parallel/test-vm-global-define-property.js +++ b/test/parallel/test-vm-global-define-property.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-vm-global-identity.js b/test/parallel/test-vm-global-identity.js index bc3d9653a7c437..647edb22b44db0 100644 --- a/test/parallel/test-vm-global-identity.js +++ b/test/parallel/test-vm-global-identity.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-harmony-proxies.js b/test/parallel/test-vm-harmony-proxies.js index 859d77cd62d73b..2f008615ebaf54 100644 --- a/test/parallel/test-vm-harmony-proxies.js +++ b/test/parallel/test-vm-harmony-proxies.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --harmony_proxies var common = require('../common'); diff --git a/test/parallel/test-vm-harmony-symbols.js b/test/parallel/test-vm-harmony-symbols.js index 127e3c4a2b291e..86fde1b978ffb2 100644 --- a/test/parallel/test-vm-harmony-symbols.js +++ b/test/parallel/test-vm-harmony-symbols.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-is-context.js b/test/parallel/test-vm-is-context.js index 7b3d6616ee4a1d..5a46a452b91634 100644 --- a/test/parallel/test-vm-is-context.js +++ b/test/parallel/test-vm-is-context.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-vm-new-script-new-context.js b/test/parallel/test-vm-new-script-new-context.js index 742f247a11c19a..4619c9345c5e5c 100644 --- a/test/parallel/test-vm-new-script-new-context.js +++ b/test/parallel/test-vm-new-script-new-context.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); var Script = require('vm').Script; @@ -23,7 +24,7 @@ assert.throws(function() { console.error('undefined reference'); var error; script = new Script('foo.bar = 5;'); -assert.throws(function () { +assert.throws(function() { script.runInNewContext(); }, /not defined/); @@ -48,7 +49,7 @@ assert.equal(2, foo); console.error('call a function by reference'); script = new Script('f()'); -function changeFoo() { foo = 100 } +function changeFoo() { foo = 100; } script.runInNewContext({ f: changeFoo }); assert.equal(foo, 100); diff --git a/test/parallel/test-vm-new-script-this-context.js b/test/parallel/test-vm-new-script-this-context.js index 99d40bea2e2237..16d8acd1ca6700 100644 --- a/test/parallel/test-vm-new-script-this-context.js +++ b/test/parallel/test-vm-new-script-this-context.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); var Script = require('vm').Script; @@ -34,7 +35,7 @@ assert.equal(2, bar); assert.equal(1, foo); console.error('call a function'); -f = function() { foo = 100 }; +f = function() { foo = 100; }; script = new Script('f()'); script.runInThisContext(script); assert.equal(100, foo); diff --git a/test/parallel/test-vm-run-in-new-context.js b/test/parallel/test-vm-run-in-new-context.js index 4772c3b99d9eb5..da14a041face31 100644 --- a/test/parallel/test-vm-run-in-new-context.js +++ b/test/parallel/test-vm-run-in-new-context.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ // Flags: --expose-gc var common = require('../common'); @@ -34,7 +35,7 @@ assert.equal(2, obj.bar); assert.equal(2, foo); console.error('call a function by reference'); -function changeFoo() { foo = 100 } +function changeFoo() { foo = 100; } vm.runInNewContext('f()', { f: changeFoo }); assert.equal(foo, 100); @@ -44,7 +45,7 @@ vm.runInNewContext('f.a = 2', { f: f }); assert.equal(f.a, 2); console.error('use function in context without referencing context'); -var fn = vm.runInNewContext('(function() { obj.p = {}; })', { obj: {} }) +var fn = vm.runInNewContext('(function() { obj.p = {}; })', { obj: {} }); gc(); fn(); // Should not crash diff --git a/test/parallel/test-vm-static-this.js b/test/parallel/test-vm-static-this.js index b7b013396bef8a..fb9cb764f8422c 100644 --- a/test/parallel/test-vm-static-this.js +++ b/test/parallel/test-vm-static-this.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); var vm = require('vm'); @@ -30,6 +31,6 @@ assert.equal(2, bar); assert.equal(1, foo); console.error('call a function'); -f = function() { foo = 100 }; +f = function() { foo = 100; }; vm.runInThisContext('f()'); assert.equal(100, foo); diff --git a/test/parallel/test-vm-timeout.js b/test/parallel/test-vm-timeout.js index 9925e03ad69d30..e9511e59230a84 100644 --- a/test/parallel/test-vm-timeout.js +++ b/test/parallel/test-vm-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var vm = require('vm'); diff --git a/test/parallel/test-writedouble.js b/test/parallel/test-writedouble.js index 24ceb885f54318..2a9ab11107f147 100644 --- a/test/parallel/test-writedouble.js +++ b/test/parallel/test-writedouble.js @@ -1,3 +1,4 @@ +'use strict'; /* * Tests to verify we're writing doubles correctly */ diff --git a/test/parallel/test-writefloat.js b/test/parallel/test-writefloat.js index 5d5be20354377f..948bf4910208a5 100644 --- a/test/parallel/test-writefloat.js +++ b/test/parallel/test-writefloat.js @@ -1,3 +1,4 @@ +'use strict'; /* * Tests to verify we're writing floats correctly */ diff --git a/test/parallel/test-writeint.js b/test/parallel/test-writeint.js index 064716ad0ccd16..ee981a157ad761 100644 --- a/test/parallel/test-writeint.js +++ b/test/parallel/test-writeint.js @@ -1,3 +1,4 @@ +'use strict'; /* * Tests to verify we're writing signed integers correctly */ diff --git a/test/parallel/test-writeuint.js b/test/parallel/test-writeuint.js index ec2efa12fb95ef..22579ceecaef2d 100644 --- a/test/parallel/test-writeuint.js +++ b/test/parallel/test-writeuint.js @@ -1,3 +1,4 @@ +'use strict'; /* * A battery of tests to help us read a series of uints */ diff --git a/test/parallel/test-zlib-close-after-write.js b/test/parallel/test-zlib-close-after-write.js index cbb1ac1fe1f26a..c02ff33fb5eb63 100644 --- a/test/parallel/test-zlib-close-after-write.js +++ b/test/parallel/test-zlib-close-after-write.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/parallel/test-zlib-const.js b/test/parallel/test-zlib-const.js index df9ca3d50097ad..511eca613a5229 100644 --- a/test/parallel/test-zlib-const.js +++ b/test/parallel/test-zlib-const.js @@ -1,3 +1,4 @@ +/* eslint-disable strict */ var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-zlib-convenience-methods.js b/test/parallel/test-zlib-convenience-methods.js index a32d5d1d4c3f18..5808bdf04a8f14 100644 --- a/test/parallel/test-zlib-convenience-methods.js +++ b/test/parallel/test-zlib-convenience-methods.js @@ -1,3 +1,4 @@ +'use strict'; // test convenience methods with and without options supplied var common = require('../common'); diff --git a/test/parallel/test-zlib-dictionary-fail.js b/test/parallel/test-zlib-dictionary-fail.js index ea50bf40982d6d..ced829f8d49963 100644 --- a/test/parallel/test-zlib-dictionary-fail.js +++ b/test/parallel/test-zlib-dictionary-fail.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/parallel/test-zlib-dictionary.js b/test/parallel/test-zlib-dictionary.js index 3a159e6090126e..109f4273f767d0 100644 --- a/test/parallel/test-zlib-dictionary.js +++ b/test/parallel/test-zlib-dictionary.js @@ -1,3 +1,4 @@ +'use strict'; // test compression/decompression with dictionary var common = require('../common'); diff --git a/test/parallel/test-zlib-flush.js b/test/parallel/test-zlib-flush.js index cfebda7bd2e5fa..6281b8eb21feb2 100644 --- a/test/parallel/test-zlib-flush.js +++ b/test/parallel/test-zlib-flush.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/parallel/test-zlib-from-gzip.js b/test/parallel/test-zlib-from-gzip.js index b218b4edfcae69..6076a6f09ba00b 100644 --- a/test/parallel/test-zlib-from-gzip.js +++ b/test/parallel/test-zlib-from-gzip.js @@ -1,3 +1,4 @@ +'use strict'; // test unzipping a file that was created with a non-node gzip lib, // piped in as fast as possible. diff --git a/test/parallel/test-zlib-from-string.js b/test/parallel/test-zlib-from-string.js index 4ce77a8b528136..49f4d139c148d9 100644 --- a/test/parallel/test-zlib-from-string.js +++ b/test/parallel/test-zlib-from-string.js @@ -1,3 +1,4 @@ +'use strict'; // test compressing and uncompressing a string with zlib var common = require('../common'); diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js index 948ea2244808b2..e1e81bacc1a499 100644 --- a/test/parallel/test-zlib-invalid-input.js +++ b/test/parallel/test-zlib-invalid-input.js @@ -1,3 +1,4 @@ +'use strict'; // test uncompressing invalid input var common = require('../common'), @@ -24,15 +25,15 @@ var unzips = [ zlib.Unzip(), zlib.Inflate(), zlib.InflateRaw() ]; var hadError = []; -unzips.forEach(function (uz, i) { - console.error('Error for '+uz.constructor.name); +unzips.forEach(function(uz, i) { + console.error('Error for ' + uz.constructor.name); uz.on('error', function(er) { console.error('Error event', er); hadError[i] = true; }); uz.on('end', function(er) { - throw new Error('end event should not be emitted '+uz.constructor.name); + throw new Error('end event should not be emitted ' + uz.constructor.name); }); // this will trigger error event diff --git a/test/parallel/test-zlib-params.js b/test/parallel/test-zlib-params.js index 6f1920956159f3..f349c8dbd0afec 100644 --- a/test/parallel/test-zlib-params.js +++ b/test/parallel/test-zlib-params.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js index 4044cbd211a857..fcdc81443cac91 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/parallel/test-zlib-write-after-close.js b/test/parallel/test-zlib-write-after-close.js index 54b316631f739d..a1d9adb6d9b996 100644 --- a/test/parallel/test-zlib-write-after-close.js +++ b/test/parallel/test-zlib-write-after-close.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/parallel/test-zlib-write-after-flush.js b/test/parallel/test-zlib-write-after-flush.js index c0dbee7774b42d..4c53ca49ebf758 100644 --- a/test/parallel/test-zlib-write-after-flush.js +++ b/test/parallel/test-zlib-write-after-flush.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/parallel/test-zlib-zero-byte.js b/test/parallel/test-zlib-zero-byte.js index e7c8ddc954f77a..9aa260a7f3149d 100644 --- a/test/parallel/test-zlib-zero-byte.js +++ b/test/parallel/test-zlib-zero-byte.js @@ -1,8 +1,9 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); -var gz = zlib.Gzip() +var gz = zlib.Gzip(); var emptyBuffer = new Buffer(0); var received = 0; gz.on('data', function(c) { diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index bb9ba53d5df2cc..aaa965c424ed98 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/pummel/test-abort-fatal-error.js b/test/pummel/test-abort-fatal-error.js index 045ff6da7f69e0..9f012c9dfb14b8 100644 --- a/test/pummel/test-abort-fatal-error.js +++ b/test/pummel/test-abort-fatal-error.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); diff --git a/test/pummel/test-buffer-big.js b/test/pummel/test-buffer-big.js index 9caa9287663a19..b36b992214ffc5 100644 --- a/test/pummel/test-buffer-big.js +++ b/test/pummel/test-buffer-big.js @@ -1,8 +1,9 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); // The tests below should throw an error, not abort the process... -assert.throws(function() { new Buffer(0x3fffffff + 1) }, RangeError); -assert.throws(function() { new Int8Array(0x3fffffff + 1) }, RangeError); -assert.throws(function() { new ArrayBuffer(0x3fffffff + 1) }, RangeError); -assert.throws(function() { new Float64Array(0x7ffffff + 1) }, RangeError); +assert.throws(function() { new Buffer(0x3fffffff + 1); }, RangeError); +assert.throws(function() { new Int8Array(0x3fffffff + 1); }, RangeError); +assert.throws(function() { new ArrayBuffer(0x3fffffff + 1); }, RangeError); +assert.throws(function() { new Float64Array(0x7ffffff + 1); }, RangeError); diff --git a/test/pummel/test-child-process-spawn-loop.js b/test/pummel/test-child-process-spawn-loop.js index a6129dd0bb2081..defed7d5f613d2 100644 --- a/test/pummel/test-child-process-spawn-loop.js +++ b/test/pummel/test-child-process-spawn-loop.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index 0f3a5407dc7ed5..5588cdb7089b5b 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -19,21 +20,22 @@ assert.throws(function() { }); var hashes = { - modp1 : "b4b330a6ffeacfbd861e7fe2135b4431", - modp2 : "7c3c5cad8b9f378d88f1dd64a4b6413a", - modp5 : "b1d2acc22c542e08669a5c5ae812694d", - modp14 : "8d041538cecc1a7d915ba4b718f8ad20", - modp15 : "dc3b93def24e078c4fbf92d5e14ba69b", - modp16 : "a273487f46f699461f613b3878d9dfd9", - modp17 : "dc76e09935310348c492de9bd82014d0", - modp18 : "db08973bfd2371758a69db180871c993" -} + modp1 : 'b4b330a6ffeacfbd861e7fe2135b4431', + modp2 : '7c3c5cad8b9f378d88f1dd64a4b6413a', + modp5 : 'b1d2acc22c542e08669a5c5ae812694d', + modp14 : '8d041538cecc1a7d915ba4b718f8ad20', + modp15 : 'dc3b93def24e078c4fbf92d5e14ba69b', + modp16 : 'a273487f46f699461f613b3878d9dfd9', + modp17 : 'dc76e09935310348c492de9bd82014d0', + modp18 : 'db08973bfd2371758a69db180871c993' +}; for (var name in hashes) { var group = crypto.getDiffieHellman(name); var private_key = group.getPrime('hex'); var hash1 = hashes[name]; - var hash2 = crypto.createHash('md5').update(private_key.toUpperCase()).digest('hex'); + var hash2 = crypto.createHash('md5') + .update(private_key.toUpperCase()).digest('hex'); assert.equal(hash1, hash2); assert.equal(group.getGenerator('hex'), '02'); } diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index 5c40173b121040..a6270bd2419cb0 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js index e86a497f6967ba..831402fc87c780 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var os = require('os'); @@ -14,18 +15,18 @@ if (os.type() != 'SunOS') { var frames = [ 'stalloogle', 'bagnoogle', 'doogle' ]; var expected; -var stalloogle = function (str) { +var stalloogle = function(str) { expected = str; os.loadavg(); }; -var bagnoogle = function (arg0, arg1) { +var bagnoogle = function(arg0, arg1) { stalloogle(arg0 + ' is ' + arg1 + ' except that it is read-only'); }; var done = false; -var doogle = function () { +var doogle = function() { if (!done) setTimeout(doogle, 10); @@ -46,15 +47,15 @@ var dtrace = spawn('dtrace', [ '-qwn', 'syscall::getloadavg:entry/pid == ' + var output = ''; -dtrace.stderr.on('data', function (data) { +dtrace.stderr.on('data', function(data) { console.log('dtrace: ' + data); }); -dtrace.stdout.on('data', function (data) { +dtrace.stdout.on('data', function(data) { output += data; }); -dtrace.on('exit', function (code) { +dtrace.on('exit', function(code) { if (code != 0) { console.error('dtrace exited with code ' + code); process.exit(code); diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js index bbedc3a5729515..41d81426e63e6f 100644 --- a/test/pummel/test-exec.js +++ b/test/pummel/test-exec.js @@ -1,14 +1,15 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; if (process.platform !== 'win32') { // Unix. - var SLEEP3_COMMAND = "sleep 3"; + var SLEEP3_COMMAND = 'sleep 3'; } else { // Windows: `choice` is a command built into cmd.exe. Use another cmd process // to create a process tree, so we can catch bugs related to it. - var SLEEP3_COMMAND = "cmd /c choice /t 3 /c X /d X"; + var SLEEP3_COMMAND = 'cmd /c choice /t 3 /c X /d X'; } diff --git a/test/pummel/test-fs-readfile-large.js b/test/pummel/test-fs-readfile-large.js index d8c6634fb827ab..b6afbc254d317c 100644 --- a/test/pummel/test-fs-readfile-large.js +++ b/test/pummel/test-fs-readfile-large.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -26,7 +27,7 @@ function makeFile(done) { } } -makeFile(function () { +makeFile(function() { fs.readFile(filename, function(err) { assert.ok(err, 'should get RangeError'); assert.equal(err.name, 'RangeError', 'should get RangeError'); @@ -34,6 +35,6 @@ makeFile(function () { }); }); -process.on('uncaughtException', function (err) { +process.on('uncaughtException', function(err) { assert.ok(!err, 'should not throw uncaughtException'); }); diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js index df8763a4e2839d..cd4b16bf310b99 100644 --- a/test/pummel/test-fs-watch-file-slow.js +++ b/test/pummel/test-fs-watch-file-slow.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -42,13 +43,13 @@ setTimeout(createFile, TIMEOUT); function createFile() { console.log('creating file'); - fs.writeFileSync(FILENAME, "test"); + fs.writeFileSync(FILENAME, 'test'); setTimeout(touchFile, TIMEOUT); } function touchFile() { console.log('touch file'); - fs.writeFileSync(FILENAME, "test"); + fs.writeFileSync(FILENAME, 'test'); setTimeout(removeFile, TIMEOUT); } diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js index 199bf5242e251b..7b57803dd4ec93 100644 --- a/test/pummel/test-fs-watch-file.js +++ b/test/pummel/test-fs-watch-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -123,7 +124,7 @@ assert.doesNotThrow( function a(curr, prev) { ++watchSeenFour; assert.equal(1, watchSeenFour); - fs.unwatchFile("." + path.sep + filenameFour, a); + fs.unwatchFile('.' + path.sep + filenameFour, a); } fs.watchFile(filenameFour, a); } diff --git a/test/pummel/test-fs-watch-non-recursive.js b/test/pummel/test-fs-watch-non-recursive.js index 60d2c6b6a84900..6adb193928e44f 100644 --- a/test/pummel/test-fs-watch-non-recursive.js +++ b/test/pummel/test-fs-watch-non-recursive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -14,7 +15,7 @@ function cleanup() { process.on('exit', cleanup); cleanup(); -try { fs.mkdirSync(testsubdir, 0700); } catch (e) {} +try { fs.mkdirSync(testsubdir, 0o700); } catch (e) {} // Need a grace period, else the mkdirSync() above fires off an event. setTimeout(function() { diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js index 00a38608125dbd..bd852e45f19410 100644 --- a/test/pummel/test-http-client-reconnect-bug.js +++ b/test/pummel/test-http-client-reconnect-bug.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-http-many-keep-alive-connections.js b/test/pummel/test-http-many-keep-alive-connections.js index fdd7a068102c3d..d90d4d97531095 100644 --- a/test/pummel/test-http-many-keep-alive-connections.js +++ b/test/pummel/test-http-many-keep-alive-connections.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/pummel/test-http-upload-timeout.js b/test/pummel/test-http-upload-timeout.js index f889c60f177b5f..08132e3c7594d1 100644 --- a/test/pummel/test-http-upload-timeout.js +++ b/test/pummel/test-http-upload-timeout.js @@ -1,3 +1,4 @@ +'use strict'; // This tests setTimeout() by having multiple clients connecting and sending // data in random intervals. Clients are also randomly disconnecting until there // are no more clients left. If no false timeout occurs, this test has passed. diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index 1ca965e99ec583..fa38bea0011131 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-large-response.js index 5ad5da480ca7a4..1aa36464a158e4 100644 --- a/test/pummel/test-https-large-response.js +++ b/test/pummel/test-https-large-response.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-https-no-reader.js b/test/pummel/test-https-no-reader.js index 798a4f70b64f81..8f407e2d7d48f8 100644 --- a/test/pummel/test-https-no-reader.js +++ b/test/pummel/test-https-no-reader.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index 58af58a25353a6..d03cb1d74f3683 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -1,3 +1,4 @@ +'use strict'; if (process.platform === 'win32') { console.log('skipping this test because there is no wrk on windows'); process.exit(0); @@ -37,7 +38,8 @@ function runAb(opts, callback) { args.push('Connection: close'); } - args.push(url.format({ hostname: '127.0.0.1', port: common.PORT, protocol: 'http'})); + args.push(url.format({ hostname: '127.0.0.1', + port: common.PORT, protocol: 'http'})); //console.log(comm, args.join(' ')); diff --git a/test/pummel/test-net-connect-econnrefused.js b/test/pummel/test-net-connect-econnrefused.js index be3db49aa4fe7a..113b04e31f3ae1 100644 --- a/test/pummel/test-net-connect-econnrefused.js +++ b/test/pummel/test-net-connect-econnrefused.js @@ -1,3 +1,4 @@ +'use strict'; // verify that connect reqs are properly cleaned up var common = require('../common'); diff --git a/test/pummel/test-net-connect-memleak.js b/test/pummel/test-net-connect-memleak.js index 66b7e926d8cadc..855bf1f070d7c8 100644 --- a/test/pummel/test-net-connect-memleak.js +++ b/test/pummel/test-net-connect-memleak.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --expose-gc var common = require('../common'); diff --git a/test/pummel/test-net-many-clients.js b/test/pummel/test-net-many-clients.js index fce7f33e669ccb..b70efbda582571 100644 --- a/test/pummel/test-net-many-clients.js +++ b/test/pummel/test-net-many-clients.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/pummel/test-net-pause.js b/test/pummel/test-net-pause.js index 26eec2cfd092d6..6386d29835da11 100644 --- a/test/pummel/test-net-pause.js +++ b/test/pummel/test-net-pause.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/pummel/test-net-pingpong-delay.js b/test/pummel/test-net-pingpong-delay.js index 8a30e7bae7f5fd..e459c71a7185ac 100644 --- a/test/pummel/test-net-pingpong-delay.js +++ b/test/pummel/test-net-pingpong-delay.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/pummel/test-net-pingpong.js b/test/pummel/test-net-pingpong.js index d38064e64a4067..a7ede0b0565ac9 100644 --- a/test/pummel/test-net-pingpong.js +++ b/test/pummel/test-net-pingpong.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js index 45c0a6fb6d9cc5..d556d8aaa86c43 100644 --- a/test/pummel/test-net-throttle.js +++ b/test/pummel/test-net-throttle.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -20,7 +21,8 @@ var server = net.createServer(function(connection) { connection.write(body.slice(part_N, 2 * part_N)); assert.equal(false, connection.write(body.slice(2 * part_N, N))); console.log('bufferSize: ' + connection.bufferSize, 'expecting', N); - assert.ok(0 <= connection.bufferSize && connection._writableState.length <= N); + assert.ok(0 <= connection.bufferSize && + connection._writableState.length <= N); connection.end(); }); diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js index 47214fc98f528a..347e3a4344d37b 100644 --- a/test/pummel/test-net-timeout.js +++ b/test/pummel/test-net-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -12,7 +13,7 @@ var echo_server = net.createServer(function(socket) { socket.on('timeout', function() { console.log('server timeout'); - timeouttime = new Date; + timeouttime = new Date(); console.dir(timeouttime); socket.destroy(); }); @@ -53,7 +54,7 @@ echo_server.listen(common.PORT, function() { if (exchanges == 5) { console.log('wait for timeout - should come in ' + timeout + ' ms'); - starttime = new Date; + starttime = new Date(); console.dir(starttime); } } diff --git a/test/pummel/test-net-timeout2.js b/test/pummel/test-net-timeout2.js index 2eb97a6e7e2f1c..c7b445f96c4e38 100644 --- a/test/pummel/test-net-timeout2.js +++ b/test/pummel/test-net-timeout2.js @@ -1,3 +1,4 @@ +'use strict'; // socket.write was not resetting the timeout timer. See // https://github.com/joyent/node/issues/2002 diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js index b43729d0c1ed46..21eae0f5ab72d0 100644 --- a/test/pummel/test-net-write-callbacks.js +++ b/test/pummel/test-net-write-callbacks.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/pummel/test-next-tick-infinite-calls.js b/test/pummel/test-next-tick-infinite-calls.js index 5177135a34a6e2..d4fdb3496423eb 100644 --- a/test/pummel/test-next-tick-infinite-calls.js +++ b/test/pummel/test-next-tick-infinite-calls.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-process-hrtime.js b/test/pummel/test-process-hrtime.js index faf97d8a8daed1..4fd66c03907aac 100644 --- a/test/pummel/test-process-hrtime.js +++ b/test/pummel/test-process-hrtime.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-process-uptime.js b/test/pummel/test-process-uptime.js index b105edebbd8689..a80806c2099cb1 100644 --- a/test/pummel/test-process-uptime.js +++ b/test/pummel/test-process-uptime.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-regress-GH-814.js b/test/pummel/test-regress-GH-814.js index 20183960e04af8..0059af1037a80b 100644 --- a/test/pummel/test-regress-GH-814.js +++ b/test/pummel/test-regress-GH-814.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --expose_gc function newBuffer(size, value) { diff --git a/test/pummel/test-regress-GH-814_2.js b/test/pummel/test-regress-GH-814_2.js index 7443e4f57eaf98..6dd2f2d32e5646 100644 --- a/test/pummel/test-regress-GH-814_2.js +++ b/test/pummel/test-regress-GH-814_2.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --expose_gc var common = require('../common'); diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index af314349ffd962..d84170d7648a10 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -1,3 +1,4 @@ +'use strict'; // Uploading a big file via HTTPS causes node to drop out of the event loop. // https://github.com/joyent/node/issues/892 // In this test we set up an HTTPS in this process and launch a subprocess diff --git a/test/pummel/test-smalloc-alloc-segfault.js b/test/pummel/test-smalloc-alloc-segfault.js index 3e89f726ce7f70..d41ccaee09b79d 100644 --- a/test/pummel/test-smalloc-alloc-segfault.js +++ b/test/pummel/test-smalloc-alloc-segfault.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-smalloc-dispose-segfault.js b/test/pummel/test-smalloc-dispose-segfault.js index e94d9d5ba17c76..9364cca344c136 100644 --- a/test/pummel/test-smalloc-dispose-segfault.js +++ b/test/pummel/test-smalloc-dispose-segfault.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-smalloc-sliceonto-segfault.js b/test/pummel/test-smalloc-sliceonto-segfault.js index ed43828a530ee6..e9e00979ff2814 100644 --- a/test/pummel/test-smalloc-sliceonto-segfault.js +++ b/test/pummel/test-smalloc-sliceonto-segfault.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-stream-pipe-multi.js b/test/pummel/test-stream-pipe-multi.js index 00d17f17425c0b..807e3c1415154e 100644 --- a/test/pummel/test-stream-pipe-multi.js +++ b/test/pummel/test-stream-pipe-multi.js @@ -1,3 +1,4 @@ +'use strict'; // Test that having a bunch of streams piping in parallel // doesn't break anything. diff --git a/test/pummel/test-stream2-basic.js b/test/pummel/test-stream2-basic.js index 543acd61c11d67..c83d80c5029e70 100644 --- a/test/pummel/test-stream2-basic.js +++ b/test/pummel/test-stream2-basic.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var R = require('_stream_readable'); var assert = require('assert'); @@ -88,7 +89,7 @@ function run() { same: assert.deepEqual, ok: assert, equal: assert.equal, - end: function () { + end: function() { count--; run(); } @@ -96,7 +97,7 @@ function run() { } // ensure all tests have run -process.on("exit", function () { +process.on('exit', function() { assert.equal(count, 0); }); @@ -153,9 +154,9 @@ test('pipe', function(t) { 'xxxxx', 'xxxxx', 'xxxxx', - 'xxxxx' ] + 'xxxxx' ]; - var w = new TestWriter; + var w = new TestWriter(); var flush = true; w.on('end', function(received) { @@ -168,7 +169,7 @@ test('pipe', function(t) { -[1,2,3,4,5,6,7,8,9].forEach(function(SPLIT) { +[1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function(SPLIT) { test('unpipe', function(t) { var r = new TestReader(5); @@ -226,7 +227,7 @@ test('pipe', function(t) { // both writers should get the same exact data. test('multipipe', function(t) { var r = new TestReader(5); - var w = [ new TestWriter, new TestWriter ]; + var w = [ new TestWriter(), new TestWriter() ]; var expect = [ 'xxxxx', 'xxxxx', @@ -254,7 +255,7 @@ test('multipipe', function(t) { }); -[1,2,3,4,5,6,7,8,9].forEach(function(SPLIT) { +[1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function(SPLIT) { test('multi-unpipe', function(t) { var r = new TestReader(5); @@ -301,90 +302,90 @@ test('multipipe', function(t) { }); }); -test('back pressure respected', function (t) { +test('back pressure respected', function(t) { function noop() {} var r = new R({ objectMode: true }); r._read = noop; var counter = 0; - r.push(["one"]); - r.push(["two"]); - r.push(["three"]); - r.push(["four"]); + r.push(['one']); + r.push(['two']); + r.push(['three']); + r.push(['four']); r.push(null); var w1 = new R(); - w1.write = function (chunk) { + w1.write = function(chunk) { console.error('w1.emit("close")'); - assert.equal(chunk[0], "one"); - w1.emit("close"); - process.nextTick(function () { + assert.equal(chunk[0], 'one'); + w1.emit('close'); + process.nextTick(function() { r.pipe(w2); r.pipe(w3); - }) + }); }; w1.end = noop; r.pipe(w1); - var expected = ["two", "two", "three", "three", "four", "four"]; + var expected = ['two', 'two', 'three', 'three', 'four', 'four']; var w2 = new R(); - w2.write = function (chunk) { + w2.write = function(chunk) { console.error('w2 write', chunk, counter); assert.equal(chunk[0], expected.shift()); assert.equal(counter, 0); counter++; - if (chunk[0] === "four") { + if (chunk[0] === 'four') { return true; } - setTimeout(function () { + setTimeout(function() { counter--; - console.error("w2 drain"); - w2.emit("drain"); + console.error('w2 drain'); + w2.emit('drain'); }, 10); return false; - } + }; w2.end = noop; var w3 = new R(); - w3.write = function (chunk) { + w3.write = function(chunk) { console.error('w3 write', chunk, counter); assert.equal(chunk[0], expected.shift()); assert.equal(counter, 1); counter++; - if (chunk[0] === "four") { + if (chunk[0] === 'four') { return true; } - setTimeout(function () { + setTimeout(function() { counter--; - console.error("w3 drain"); - w3.emit("drain"); + console.error('w3 drain'); + w3.emit('drain'); }, 50); return false; }; - w3.end = function () { + w3.end = function() { assert.equal(counter, 2); assert.equal(expected.length, 0); t.end(); }; }); -test('read(0) for ended streams', function (t) { +test('read(0) for ended streams', function(t) { var r = new R(); var written = false; var ended = false; - r._read = function (n) {}; + r._read = function(n) {}; - r.push(new Buffer("foo")); + r.push(new Buffer('foo')); r.push(null); var v = r.read(0); @@ -393,38 +394,38 @@ test('read(0) for ended streams', function (t) { var w = new R(); - w.write = function (buffer) { + w.write = function(buffer) { written = true; assert.equal(ended, false); - assert.equal(buffer.toString(), "foo") + assert.equal(buffer.toString(), 'foo'); }; - w.end = function () { + w.end = function() { ended = true; assert.equal(written, true); t.end(); }; r.pipe(w); -}) +}); -test('sync _read ending', function (t) { +test('sync _read ending', function(t) { var r = new R(); var called = false; - r._read = function (n) { + r._read = function(n) { r.push(null); }; - r.once('end', function () { + r.once('end', function() { called = true; - }) + }); r.read(); - process.nextTick(function () { + process.nextTick(function() { assert.equal(called, true); t.end(); - }) + }); }); test('adding readable triggers data flow', function(t) { diff --git a/test/pummel/test-timer-wrap.js b/test/pummel/test-timer-wrap.js index fdfb855a75830d..62ba69d3fde033 100644 --- a/test/pummel/test-timer-wrap.js +++ b/test/pummel/test-timer-wrap.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-timer-wrap2.js b/test/pummel/test-timer-wrap2.js index 8a7502888b5557..b289a85644a068 100644 --- a/test/pummel/test-timer-wrap2.js +++ b/test/pummel/test-timer-wrap2.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js index f676b98438852e..2225da91edcf5f 100644 --- a/test/pummel/test-timers.js +++ b/test/pummel/test-timers.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -11,9 +12,9 @@ clearTimeout(null); clearInterval(null); assert.equal(true, setTimeout instanceof Function); -var starttime = new Date; +var starttime = new Date(); setTimeout(function() { - var endtime = new Date; + var endtime = new Date(); var diff = endtime - starttime; assert.ok(diff > 0); @@ -29,7 +30,7 @@ clearTimeout(id); setInterval(function() { interval_count += 1; - var endtime = new Date; + var endtime = new Date( ); var diff = endtime - starttime; assert.ok(diff > 0); diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index 22c48699d080a7..49b9a87a7dbdc3 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js index 53275da60ed2a9..0345f9a6f62886 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --expose-gc var common = require('../common'); diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js index cbff5feac8fb39..7542ce62bcd154 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -1,3 +1,4 @@ +'use strict'; // var common = require('../common'); diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index c5eebb01a16fdb..e6ef89c72eb659 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/pummel/test-tls-session-timeout.js b/test/pummel/test-tls-session-timeout.js index 74a1abc99052cb..962b1206b6c956 100644 --- a/test/pummel/test-tls-session-timeout.js +++ b/test/pummel/test-tls-session-timeout.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); if (!common.opensslCli) { @@ -46,7 +47,7 @@ function doTest() { // file containing a proper serialization of a session ticket. // To avoid a source control diff, we copy the ticket to a temporary file. - var sessionFileName = (function () { + var sessionFileName = (function() { var ticketFileName = 'tls-session-ticket.txt'; var fixturesPath = join(common.fixturesDir, ticketFileName); var tmpPath = join(common.tmpDir, ticketFileName); @@ -56,7 +57,7 @@ function doTest() { // Expects a callback -- cb(connectionType : enum ['New'|'Reused']) - var Client = function (cb) { + var Client = function(cb) { var flags = [ 's_client', '-connect', 'localhost:' + common.PORT, @@ -73,7 +74,7 @@ function doTest() { }); client.on('exit', function(code) { var connectionType; - var grepConnectionType = function (line) { + var grepConnectionType = function(line) { var matches = line.match(/(New|Reused), /); if (matches) { connectionType = matches[1]; @@ -101,7 +102,7 @@ function doTest() { assert(connectionType === 'New'); Client(function(connectionType) { assert(connectionType === 'Reused'); - setTimeout(function () { + setTimeout(function() { Client(function(connectionType) { assert(connectionType === 'New'); server.close(); diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js index a8a83a2a3a9001..3eb1af6da75818 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -1,3 +1,4 @@ +'use strict'; // Server sends a large string. Client counts bytes and pauses every few // seconds. Makes sure that pause and resume work properly. diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index 916b65d6da49a9..f93f34127f9219 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --max_old_space_size=32 var assert = require('assert'); diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js index 3e92efc26c9edb..1d0ef77d543e43 100644 --- a/test/pummel/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-chdir.js b/test/sequential/test-chdir.js index a24753de2d28e0..0fab45cb0c2803 100644 --- a/test/sequential/test-chdir.js +++ b/test/sequential/test-chdir.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var fs = require('fs'); @@ -20,4 +21,5 @@ fs.rmdirSync(dir); assert.throws(function() { process.chdir({}); }, TypeError, 'Bad argument.'); assert.throws(function() { process.chdir(); }, TypeError, 'Bad argument.'); -assert.throws(function() { process.chdir("x", "y"); }, TypeError, 'Bad argument.'); +assert.throws(function() { process.chdir('x', 'y'); }, + TypeError, 'Bad argument.'); diff --git a/test/sequential/test-child-process-emfile.js b/test/sequential/test-child-process-emfile.js index 66be12749c9f03..964b63a2b4513d 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js index 5cd9ee433d6d35..13982e00a6756d 100644 --- a/test/sequential/test-child-process-execsync.js +++ b/test/sequential/test-child-process-execsync.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var util = require('util'); @@ -58,7 +59,8 @@ assert.deepEqual(ret, msgBuf); ret = execFileSync(process.execPath, args, { encoding: 'utf8' }); -assert.strictEqual(ret, msg + '\n', 'execFileSync encoding result should match'); +assert.strictEqual(ret, msg + '\n', + 'execFileSync encoding result should match'); // Verify that the cwd option works - GH #7824 (function() { diff --git a/test/sequential/test-child-process-fork-getconnections.js b/test/sequential/test-child-process-fork-getconnections.js index 6848b2ffa0b9c6..a587713b6132f2 100644 --- a/test/sequential/test-child-process-fork-getconnections.js +++ b/test/sequential/test-child-process-fork-getconnections.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var common = require('../common'); var fork = require('child_process').fork; diff --git a/test/sequential/test-cluster-listening-port.js b/test/sequential/test-cluster-listening-port.js index 5d68b066cfd9e2..eb8a974d04bbf8 100644 --- a/test/sequential/test-cluster-listening-port.js +++ b/test/sequential/test-cluster-listening-port.js @@ -1,3 +1,4 @@ +'use strict'; var assert = require('assert'); var cluster = require('cluster'); var net = require('net'); diff --git a/test/sequential/test-debug-args.js b/test/sequential/test-debug-args.js index 7aaef76a641fd6..eb1533d4418a55 100644 --- a/test/sequential/test-debug-args.js +++ b/test/sequential/test-debug-args.js @@ -1,3 +1,4 @@ +'use strict'; // Flags: --debugger var common = require('../common'); diff --git a/test/sequential/test-deprecation-flags.js b/test/sequential/test-deprecation-flags.js index 2af60a17364999..e8565a33635744 100644 --- a/test/sequential/test-deprecation-flags.js +++ b/test/sequential/test-deprecation-flags.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var execFile = require('child_process').execFile; @@ -12,7 +13,8 @@ execFile(node, normal, function(er, stdout, stderr) { console.error('normal: show deprecation warning'); assert.equal(er, null); assert.equal(stdout, ''); - assert.equal(stderr, 'util.p: Use console.error() instead\n\'This is deprecated\'\n'); + assert.equal(stderr, + 'util.p: Use console.error() instead\n\'This is deprecated\'\n'); console.log('normal ok'); }); diff --git a/test/sequential/test-force-repl.js b/test/sequential/test-force-repl.js index c0ad1484ff25cc..5907dc2019a3a3 100644 --- a/test/sequential/test-force-repl.js +++ b/test/sequential/test-force-repl.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/sequential/test-fs-watch-recursive.js b/test/sequential/test-fs-watch-recursive.js index a789dcb3061b3d..f77b86e436985b 100644 --- a/test/sequential/test-fs-watch-recursive.js +++ b/test/sequential/test-fs-watch-recursive.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -23,7 +24,7 @@ if (process.platform === 'darwin') { try { fs.rmdirSync(testsubdir); } catch (e) { } }; - try { fs.mkdirSync(testsubdir, 0700); } catch (e) {} + try { fs.mkdirSync(testsubdir, 0o700); } catch (e) {} assert.doesNotThrow(function() { var watcher = fs.watch(testDir, {recursive: true}); diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index d92a10cd808a10..1cfaad9b3ec975 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -41,7 +42,7 @@ fs.writeFileSync(filepathOne, 'hello'); assert.doesNotThrow( function() { - var watcher = fs.watch(filepathOne) + var watcher = fs.watch(filepathOne); watcher.on('change', function(event, filename) { assert.equal('change', event); @@ -82,7 +83,7 @@ setTimeout(function() { }, 20); try { fs.unlinkSync(filepathThree); } catch (e) {} -try { fs.mkdirSync(testsubdir, 0700); } catch (e) {} +try { fs.mkdirSync(testsubdir, 0o700); } catch (e) {} assert.doesNotThrow( function() { @@ -123,7 +124,7 @@ assert.throws(function() { oldhandle.close(); // clean up assert.throws(function() { - var w = fs.watchFile(__filename, {persistent:false}, function(){}); + var w = fs.watchFile(__filename, {persistent:false}, function() {}); oldhandle = w._handle; w._handle = { stop: w._handle.stop }; w.stop(); diff --git a/test/sequential/test-http-pipeline-flood.js b/test/sequential/test-http-pipeline-flood.js index 6eeb785f9cbc2a..cb9fc97a865b70 100644 --- a/test/sequential/test-http-pipeline-flood.js +++ b/test/sequential/test-http-pipeline-flood.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-init.js b/test/sequential/test-init.js index abc6378a637e93..f68c001f64fffa 100644 --- a/test/sequential/test-init.js +++ b/test/sequential/test-init.js @@ -1,3 +1,4 @@ +'use strict'; (function() { var assert = require('assert'), child = require('child_process'), diff --git a/test/sequential/test-memory-usage-emfile.js b/test/sequential/test-memory-usage-emfile.js index e95fe429c37645..e4f85488f40d42 100644 --- a/test/sequential/test-memory-usage-emfile.js +++ b/test/sequential/test-memory-usage-emfile.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-mkdir-rmdir.js b/test/sequential/test-mkdir-rmdir.js index 63dc78df381e78..7bd156419e8a94 100644 --- a/test/sequential/test-mkdir-rmdir.js +++ b/test/sequential/test-mkdir-rmdir.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -9,12 +10,12 @@ var d = path.join(common.tmpDir, 'dir'); var mkdir_error = false; var rmdir_error = false; -fs.mkdir(d, 0666, function(err) { +fs.mkdir(d, 0o666, function(err) { if (err) { console.log('mkdir error: ' + err.message); mkdir_error = true; } else { - fs.mkdir(d, 0666, function(err) { + fs.mkdir(d, 0o666, function(err) { console.log('expect EEXIST error: ', err); assert.ok(err.message.match(/^EEXIST/), 'got EEXIST message'); assert.equal(err.code, 'EEXIST', 'got EEXIST code'); diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index c1d8df4553370c..dfca2e420263b6 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -53,7 +54,7 @@ assert.equal('D', d3.D()); assert.equal(true, common.indirectInstanceOf(d4.D, Function)); assert.equal('D', d4.D()); -assert.ok((new a.SomeClass) instanceof c.SomeClass); +assert.ok((new a.SomeClass()) instanceof c.SomeClass); common.debug('test index.js modules ids and relative loading'); var one = require('../fixtures/nested-index/one'), @@ -89,7 +90,7 @@ common.debug('test name clashes'); var my_path = require('../fixtures/path'); assert.ok(common.indirectInstanceOf(my_path.path_func, Function)); // this one does not exist and should throw -assert.throws(function() { require('./utils')}); +assert.throws(function() { require('./utils'); }); var errorThrown = false; try { @@ -187,7 +188,7 @@ assert.deepEqual(json, { // the appropriate children, and so on. var children = module.children.reduce(function red(set, child) { - var id = path.relative(path.dirname(__dirname), child.id) + var id = path.relative(path.dirname(__dirname), child.id); id = id.replace(/\\/g, '/'); set[id] = child.children.reduce(red, {}); return set; diff --git a/test/sequential/test-net-GH-5504.js b/test/sequential/test-net-GH-5504.js index 2ee0a1d86d7af3..0478de55d62592 100644 --- a/test/sequential/test-net-GH-5504.js +++ b/test/sequential/test-net-GH-5504.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-net-listen-exclusive-random-ports.js b/test/sequential/test-net-listen-exclusive-random-ports.js index 2922a2b06e140f..c32273a59b2a50 100644 --- a/test/sequential/test-net-listen-exclusive-random-ports.js +++ b/test/sequential/test-net-listen-exclusive-random-ports.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); diff --git a/test/sequential/test-net-localport.js b/test/sequential/test-net-localport.js index 239196813ad8a3..09b6627c79ce47 100644 --- a/test/sequential/test-net-localport.js +++ b/test/sequential/test-net-localport.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -17,4 +18,4 @@ var server = net.createServer(function(socket) { }).on('connect', function() { assert.strictEqual(client.localPort, common.PORT + 1); }); -}) +}); diff --git a/test/sequential/test-net-server-address.js b/test/sequential/test-net-server-address.js index 717d46f1bbb059..1e91c348ef02ca 100644 --- a/test/sequential/test-net-server-address.js +++ b/test/sequential/test-net-server-address.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -60,12 +61,12 @@ server1.listen(common.PORT, function() { // Test without hostname or port var server2 = net.createServer(); -server2.on('error', function (e) { +server2.on('error', function(e) { console.log('Error on ip socket: ' + e.toString()); }); // Don't specify the port number -server2.listen(function () { +server2.listen(function() { var address = server2.address(); assert.strictEqual(address.address, anycast_ipv6); assert.strictEqual(address.family, family_ipv6); @@ -75,12 +76,12 @@ server2.listen(function () { // Test without hostname, but with a false-y port var server3 = net.createServer(); -server3.on('error', function (e) { +server3.on('error', function(e) { console.log('Error on ip socket: ' + e.toString()); }); // Specify a false-y port number -server3.listen(0, function () { +server3.listen(0, function() { var address = server3.address(); assert.strictEqual(address.address, anycast_ipv6); assert.strictEqual(address.family, family_ipv6); @@ -90,12 +91,12 @@ server3.listen(0, function () { // Test without hostname, but with port -1 var server4 = net.createServer(); -server4.on('error', function (e) { +server4.on('error', function(e) { console.log('Error on ip socket: ' + e.toString()); }); // Specify -1 as port number -server4.listen(-1, function () { +server4.listen(-1, function() { var address = server4.address(); assert.strictEqual(address.address, anycast_ipv6); assert.strictEqual(address.family, family_ipv6); diff --git a/test/sequential/test-net-server-bind.js b/test/sequential/test-net-server-bind.js index 3a7cd0e15b21db..c77341418c2c6d 100644 --- a/test/sequential/test-net-server-bind.js +++ b/test/sequential/test-net-server-bind.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/sequential/test-next-tick-error-spin.js b/test/sequential/test-next-tick-error-spin.js index a150ea7a589f63..7a76ab1e12df68 100644 --- a/test/sequential/test-next-tick-error-spin.js +++ b/test/sequential/test-next-tick-error-spin.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -22,24 +23,24 @@ if (process.argv[2] !== 'child') { // in the error handler, we trigger several MakeCallback events d.on('error', function(e) { - console.log('a') - console.log('b') - console.log('c') - console.log('d') - console.log('e') + console.log('a'); + console.log('b'); + console.log('c'); + console.log('d'); + console.log('e'); f(); }); function f() { process.nextTick(function() { d.run(function() { - throw(new Error('x')); + throw new Error('x'); }); }); } f(); - setTimeout(function () { + setTimeout(function() { console.error('broke in!'); //process.stdout.close(); //process.stderr.close(); diff --git a/test/sequential/test-pipe-address.js b/test/sequential/test-pipe-address.js index 6497eb7f1246c1..b9e544e97458b4 100644 --- a/test/sequential/test-pipe-address.js +++ b/test/sequential/test-pipe-address.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/sequential/test-pipe-head.js b/test/sequential/test-pipe-head.js index 4fa3eaa4daa59c..ac8b16515158eb 100644 --- a/test/sequential/test-pipe-head.js +++ b/test/sequential/test-pipe-head.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-pipe-stream.js b/test/sequential/test-pipe-stream.js index 5e5837b29843b6..ba4005e9e02fe0 100644 --- a/test/sequential/test-pipe-stream.js +++ b/test/sequential/test-pipe-stream.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/sequential/test-pipe-unref.js b/test/sequential/test-pipe-unref.js index 53853b9bdcba66..4580f2a66ee4d6 100644 --- a/test/sequential/test-pipe-unref.js +++ b/test/sequential/test-pipe-unref.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-pipe.js b/test/sequential/test-pipe.js index 11ea83b88422ba..2ef19c37ea8ca4 100644 --- a/test/sequential/test-pipe.js +++ b/test/sequential/test-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/sequential/test-pump-file2tcp-noexist.js b/test/sequential/test-pump-file2tcp-noexist.js index 8b2057e533c60e..1ffdb5d4615ce3 100644 --- a/test/sequential/test-pump-file2tcp-noexist.js +++ b/test/sequential/test-pump-file2tcp-noexist.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/sequential/test-pump-file2tcp.js b/test/sequential/test-pump-file2tcp.js index 50b576771f9074..86effb7c6c9a28 100644 --- a/test/sequential/test-pump-file2tcp.js +++ b/test/sequential/test-pump-file2tcp.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); diff --git a/test/sequential/test-readdir.js b/test/sequential/test-readdir.js index bba28d0d7a8bfc..4987dc1848035d 100644 --- a/test/sequential/test-readdir.js +++ b/test/sequential/test-readdir.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/sequential/test-regress-GH-1531.js b/test/sequential/test-regress-GH-1531.js index 9e1b8e3077870e..0d06cc3485218a 100644 --- a/test/sequential/test-regress-GH-1531.js +++ b/test/sequential/test-regress-GH-1531.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-regress-GH-1697.js b/test/sequential/test-regress-GH-1697.js index 18d1829174dd8b..ff5754f357dfc1 100644 --- a/test/sequential/test-regress-GH-1697.js +++ b/test/sequential/test-regress-GH-1697.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'), cp = require('child_process'), @@ -39,7 +40,7 @@ if (process.argv[2] === 'server') { // Block the event loop for 1 second var start = (new Date()).getTime(); - while ((new Date).getTime() < start + 1000) {} + while ((new Date()).getTime() < start + 1000) {} client.write(alittle); diff --git a/test/sequential/test-regress-GH-1726.js b/test/sequential/test-regress-GH-1726.js index 74578ab4e0fe55..859ab6cc5e4253 100644 --- a/test/sequential/test-regress-GH-1726.js +++ b/test/sequential/test-regress-GH-1726.js @@ -1,3 +1,4 @@ +'use strict'; // Open a chain of five Node processes each a child of the next. The final // process exits immediately. Each process in the chain is instructed to // exit when its child exits. @@ -26,7 +27,7 @@ assert.ok(!child.stderr); console.error('gen=%d, pid=%d', gen, process.pid); /* -var timer = setTimeout(function () { +var timer = setTimeout(function() { throw new Error('timeout! gen='+gen); }, 1000); */ diff --git a/test/sequential/test-regress-GH-1899.js b/test/sequential/test-regress-GH-1899.js index 8663eb5a4dd1ea..98396aae13b8f9 100644 --- a/test/sequential/test-regress-GH-1899.js +++ b/test/sequential/test-regress-GH-1899.js @@ -1,3 +1,4 @@ +'use strict'; var path = require('path'); var assert = require('assert'); var spawn = require('child_process').spawn; diff --git a/test/sequential/test-regress-GH-3542.js b/test/sequential/test-regress-GH-3542.js index 32b3433318855b..80f2a4c9c3e4a2 100644 --- a/test/sequential/test-regress-GH-3542.js +++ b/test/sequential/test-regress-GH-3542.js @@ -1,3 +1,4 @@ +'use strict'; // This test is only relevant on Windows. if (process.platform !== 'win32') { return process.exit(0); @@ -22,8 +23,8 @@ function test(p) { test('//localhost/c$/windows/system32'); test('//localhost/c$/windows'); -test('//localhost/c$/') -test('\\\\localhost\\c$') +test('//localhost/c$/'); +test('\\\\localhost\\c$'); test('c:\\'); test('c:'); test(process.env.windir); diff --git a/test/sequential/test-regress-GH-3739.js b/test/sequential/test-regress-GH-3739.js index d08cfce60226ba..cc16b22dc44c46 100644 --- a/test/sequential/test-regress-GH-3739.js +++ b/test/sequential/test-regress-GH-3739.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'), assert = require('assert'), fs = require('fs'), diff --git a/test/sequential/test-regress-GH-4015.js b/test/sequential/test-regress-GH-4015.js index 38a77c82086b1c..7f0e03f9ac08e1 100644 --- a/test/sequential/test-regress-GH-4015.js +++ b/test/sequential/test-regress-GH-4015.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; diff --git a/test/sequential/test-regress-GH-4027.js b/test/sequential/test-regress-GH-4027.js index de2dff180db5c0..da91be95b849a8 100644 --- a/test/sequential/test-regress-GH-4027.js +++ b/test/sequential/test-regress-GH-4027.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/sequential/test-regress-GH-4948.js b/test/sequential/test-regress-GH-4948.js index e78870b704c917..c87ade9850ccf4 100644 --- a/test/sequential/test-regress-GH-4948.js +++ b/test/sequential/test-regress-GH-4948.js @@ -1,10 +1,11 @@ +'use strict'; // https://github.com/joyent/node/issues/4948 var common = require('../common'); var http = require('http'); var reqCount = 0; -var server = http.createServer(function(serverReq, serverRes){ +var server = http.createServer(function(serverReq, serverRes) { if (reqCount) { serverRes.end(); server.close(); @@ -15,9 +16,10 @@ var server = http.createServer(function(serverReq, serverRes){ // normally the use case would be to call an external site // does not require connecting locally or to itself to fail - var r = http.request({hostname: 'localhost', port: common.PORT}, function(res) { + var r = http.request({hostname: 'localhost', + port: common.PORT}, function(res) { // required, just needs to be in the client response somewhere - serverRes.end(); + serverRes.end(); // required for test to fail res.on('data', function(data) { }); diff --git a/test/sequential/test-regress-GH-746.js b/test/sequential/test-regress-GH-746.js index 93346c43f1d9e2..4b79f3c4e355d1 100644 --- a/test/sequential/test-regress-GH-746.js +++ b/test/sequential/test-regress-GH-746.js @@ -1,3 +1,4 @@ +'use strict'; // Just test that destroying stdin doesn't mess up listening on a server. // This is a regression test for GH-746. diff --git a/test/sequential/test-regress-GH-784.js b/test/sequential/test-regress-GH-784.js index a33b6f23c479bf..08f660add31048 100644 --- a/test/sequential/test-regress-GH-784.js +++ b/test/sequential/test-regress-GH-784.js @@ -1,3 +1,4 @@ +'use strict'; // Regression test for GH-784 // https://github.com/joyent/node/issues/784 // diff --git a/test/sequential/test-regress-GH-819.js b/test/sequential/test-regress-GH-819.js index 16d0f3bc54e4f3..e459587d97cba9 100644 --- a/test/sequential/test-regress-GH-819.js +++ b/test/sequential/test-regress-GH-819.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var net = require('net'); var assert = require('assert'); diff --git a/test/sequential/test-regress-GH-877.js b/test/sequential/test-regress-GH-877.js index 80c8456742d5af..69671b9dc4a143 100644 --- a/test/sequential/test-regress-GH-877.js +++ b/test/sequential/test-regress-GH-877.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var http = require('http'); var assert = require('assert'); diff --git a/test/sequential/test-require-cache-without-stat.js b/test/sequential/test-require-cache-without-stat.js index 701d47bfc91800..c602ab82b11f4d 100644 --- a/test/sequential/test-require-cache-without-stat.js +++ b/test/sequential/test-require-cache-without-stat.js @@ -1,3 +1,4 @@ +'use strict'; // We've experienced a regression where the module loader stats a bunch of // directories on require() even if it's been called before. The require() // should caching the request. diff --git a/test/sequential/test-setproctitle.js b/test/sequential/test-setproctitle.js index b7e6dd8b552a5d..a0b15e2b85d8c3 100644 --- a/test/sequential/test-setproctitle.js +++ b/test/sequential/test-setproctitle.js @@ -1,3 +1,4 @@ +'use strict'; // Original test written by Jakub Lekstan // FIXME add sunos support diff --git a/test/sequential/test-sigint-infinite-loop.js b/test/sequential/test-sigint-infinite-loop.js index c444caf419188e..8211aeb69ec5db 100644 --- a/test/sequential/test-sigint-infinite-loop.js +++ b/test/sequential/test-sigint-infinite-loop.js @@ -1,3 +1,4 @@ +'use strict'; // This test is to assert that we can SIGINT a script which loops forever. // Ref(http): // groups.google.com/group/nodejs-dev/browse_thread/thread/e20f2f8df0296d3f diff --git a/test/sequential/test-socket-write-after-fin-error.js b/test/sequential/test-socket-write-after-fin-error.js index 5274d6e3dabe43..226440ec502670 100644 --- a/test/sequential/test-socket-write-after-fin-error.js +++ b/test/sequential/test-socket-write-after-fin-error.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); @@ -24,7 +25,7 @@ var server = net.createServer(function(sock) { serverData += c; }); sock.on('end', function() { - gotServerEnd = true + gotServerEnd = true; sock.write(serverData); sock.end(); }); diff --git a/test/sequential/test-socket-write-after-fin.js b/test/sequential/test-socket-write-after-fin.js index 44d98ba512e1ca..ea8ac27b597ec4 100644 --- a/test/sequential/test-socket-write-after-fin.js +++ b/test/sequential/test-socket-write-after-fin.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var net = require('net'); @@ -12,7 +13,7 @@ var server = net.createServer({ allowHalfOpen: true }, function(sock) { serverData += c; }); sock.on('end', function() { - gotServerEnd = true + gotServerEnd = true; sock.end(serverData); server.close(); }); diff --git a/test/sequential/test-stdin-child-proc.js b/test/sequential/test-stdin-child-proc.js index 4d3ead73ceac6c..93bf265b8b0020 100644 --- a/test/sequential/test-stdin-child-proc.js +++ b/test/sequential/test-stdin-child-proc.js @@ -1,3 +1,4 @@ +'use strict'; // This tests that pausing and resuming stdin does not hang and timeout // when done in a child process. See test/simple/test-stdin-pause-resume.js var common = require('../common'); diff --git a/test/sequential/test-stdin-from-file.js b/test/sequential/test-stdin-from-file.js index bde2a8559c3db3..35aa5b1a89ac38 100644 --- a/test/sequential/test-stdin-from-file.js +++ b/test/sequential/test-stdin-from-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var join = require('path').join; diff --git a/test/sequential/test-stdin-pipe-resume.js b/test/sequential/test-stdin-pipe-resume.js index a326e380a73654..dbac78d78c5e12 100644 --- a/test/sequential/test-stdin-pipe-resume.js +++ b/test/sequential/test-stdin-pipe-resume.js @@ -1,3 +1,4 @@ +'use strict'; // This tests that piping stdin will cause it to resume() as well. var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-stdin-script-child.js b/test/sequential/test-stdin-script-child.js index dcccff1ff5d47c..8590df02d8efe9 100644 --- a/test/sequential/test-stdin-script-child.js +++ b/test/sequential/test-stdin-script-child.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-stdout-cannot-be-closed-child-process-pipe.js b/test/sequential/test-stdout-cannot-be-closed-child-process-pipe.js index 519dce059b2f25..c6f5aecd40e262 100644 --- a/test/sequential/test-stdout-cannot-be-closed-child-process-pipe.js +++ b/test/sequential/test-stdout-cannot-be-closed-child-process-pipe.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-stdout-close-catch.js b/test/sequential/test-stdout-close-catch.js index c1165350aec0ba..f0ecf9a7c4b725 100644 --- a/test/sequential/test-stdout-close-catch.js +++ b/test/sequential/test-stdout-close-catch.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/sequential/test-stdout-stderr-reading.js b/test/sequential/test-stdout-stderr-reading.js index 3fe0db0ce3abbd..82fd51cedda1de 100644 --- a/test/sequential/test-stdout-stderr-reading.js +++ b/test/sequential/test-stdout-stderr-reading.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-stdout-to-file.js b/test/sequential/test-stdout-to-file.js index 8a9d0476911c76..4ef473e57ada08 100644 --- a/test/sequential/test-stdout-to-file.js +++ b/test/sequential/test-stdout-to-file.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/sequential/test-stream2-fs.js b/test/sequential/test-stream2-fs.js index 552d686af02314..96ab97174b2478 100644 --- a/test/sequential/test-stream2-fs.js +++ b/test/sequential/test-stream2-fs.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var R = require('_stream_readable'); var assert = require('assert'); @@ -32,7 +33,7 @@ TestWriter.prototype.write = function(c) { TestWriter.prototype.end = function(c) { if (c) this.buffer.push(c.toString()); this.emit('results', this.buffer); -} +}; var r = new FSReadable(file); var w = new TestWriter(); @@ -41,7 +42,7 @@ w.on('results', function(res) { console.error(res, w.length); assert.equal(w.length, size); var l = 0; - assert.deepEqual(res.map(function (c) { + assert.deepEqual(res.map(function(c) { return c.length; }), expectLengths); console.log('ok'); diff --git a/test/sequential/test-stream2-httpclient-response-end.js b/test/sequential/test-stream2-httpclient-response-end.js index 627960888a7fac..15d7fba27f63af 100644 --- a/test/sequential/test-stream2-httpclient-response-end.js +++ b/test/sequential/test-stream2-httpclient-response-end.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var http = require('http'); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index 9b634116db7fa8..ccbdc55e4feaf9 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -1,3 +1,4 @@ +'use strict'; // Make sure that sync writes to stderr get processed before exiting. var common = require('../common'); diff --git a/test/sequential/test-sync-fileread.js b/test/sequential/test-sync-fileread.js index 3f5f6debd55fea..24a80d96c2601b 100644 --- a/test/sequential/test-sync-fileread.js +++ b/test/sequential/test-sync-fileread.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/sequential/test-tcp-wrap-connect.js b/test/sequential/test-tcp-wrap-connect.js index 2dc9f0cb93a185..9373906c6f612a 100644 --- a/test/sequential/test-tcp-wrap-connect.js +++ b/test/sequential/test-tcp-wrap-connect.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var TCP = process.binding('tcp_wrap').TCP; diff --git a/test/sequential/test-tcp-wrap-listen.js b/test/sequential/test-tcp-wrap-listen.js index 2c0856bd951788..a2c07a7a9ce2a2 100644 --- a/test/sequential/test-tcp-wrap-listen.js +++ b/test/sequential/test-tcp-wrap-listen.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-tls-honorcipherorder.js b/test/sequential/test-tls-honorcipherorder.js index cad1a83a30e856..c33cd9eea63465 100644 --- a/test/sequential/test-tls-honorcipherorder.js +++ b/test/sequential/test-tls-honorcipherorder.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-util-debug.js b/test/sequential/test-util-debug.js index 1af9a7705a104a..834c21ec0e50b4 100644 --- a/test/sequential/test-util-debug.js +++ b/test/sequential/test-util-debug.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); diff --git a/test/sequential/test-vm-syntax-error-stderr.js b/test/sequential/test-vm-syntax-error-stderr.js index b3f76e5e30c5e2..f7b1bef9e309dc 100644 --- a/test/sequential/test-vm-syntax-error-stderr.js +++ b/test/sequential/test-vm-syntax-error-stderr.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); diff --git a/test/sequential/test-vm-timeout-rethrow.js b/test/sequential/test-vm-timeout-rethrow.js index 547ed2f8d6205b..4f3af900ee0ae2 100644 --- a/test/sequential/test-vm-timeout-rethrow.js +++ b/test/sequential/test-vm-timeout-rethrow.js @@ -1,10 +1,11 @@ +'use strict'; var assert = require('assert'); var vm = require('vm'); var spawn = require('child_process').spawn; if (process.argv[2] === 'child') { var code = 'var j = 0;\n' + - 'for (var i = 0; i < 1000000; i++) j += add(i, i + 1);\n' + 'for (var i = 0; i < 1000000; i++) j += add(i, i + 1);\n' + 'j;'; var ctx = vm.createContext({ diff --git a/test/sequential/test-zerolengthbufferbug.js b/test/sequential/test-zerolengthbufferbug.js index dde08c63914b38..de36444180b1ec 100644 --- a/test/sequential/test-zerolengthbufferbug.js +++ b/test/sequential/test-zerolengthbufferbug.js @@ -1,3 +1,4 @@ +'use strict'; // Serving up a zero-length buffer should work. var common = require('../common'); diff --git a/test/timers/test-timers-reliability.js b/test/timers/test-timers-reliability.js index c240a44685ac50..b4332468bc2ec3 100644 --- a/test/timers/test-timers-reliability.js +++ b/test/timers/test-timers-reliability.js @@ -1,3 +1,4 @@ +'use strict'; // FaketimeFlags: --exclude-monotonic -f '2014-07-21 09:00:00' var common = require('../common'); @@ -31,23 +32,23 @@ var intervalFired = false; */ var monoTimer = new Timer(); -monoTimer.ontimeout = function () { +monoTimer.ontimeout = function() { /* * Make sure that setTimeout's and setInterval's callbacks have * already fired, otherwise it means that they are vulnerable to * time drifting or inconsistent time changes. */ - assert(timerFired); - assert(intervalFired); + assert(timerFired); + assert(intervalFired); }; monoTimer.start(300, 0); -var timer = setTimeout(function () { - timerFired = true; +var timer = setTimeout(function() { + timerFired = true; }, 200); -var interval = setInterval(function () { - intervalFired = true; - clearInterval(interval); +var interval = setInterval(function() { + intervalFired = true; + clearInterval(interval); }, 200); diff --git a/vcbuild.bat b/vcbuild.bat index afb19cbad00208..21e8d5411a7f4e 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -181,7 +181,7 @@ goto jslint :jslint if not defined jslint goto exit echo running jslint -%config%\iojs tools\eslint\bin\eslint.js src lib --reset --quiet +%config%\iojs tools\eslint\bin\eslint.js src lib test --reset --quiet goto exit :create-msvs-files-failed