diff --git a/.eslintignore b/.eslintignore index 9a143fda7d..c29ea07ce6 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 8c7ffdc27b..e023327fbb 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 451f81dde5..94f130f5fb 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 0000000000..d5d95584ea --- /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 83f5e7206e..a284a019f0 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 4466b898af..c36f59b976 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 238e105381..1056386583 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 18008db581..c0492292fd 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 f0d968d173..a520df0380 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 47197be631..76648e04c4 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 ec0b387328..94d6f21095 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 c3f219874e..714a22c2a2 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 57095d93ab..397c4225d2 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 4bb27c277e..972c94707e 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 7bf7d639f5..3b54f853bc 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 641199a171..abb67c19cb 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 8d33d12643..995f6fe0db 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 9d83d67188..d3b2c169de 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 a42a253c5a..741adf682a 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 0fccf2477b..c32216e5d6 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 788ea9cb6a..2e44da55d7 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 af65bbdc0f..28f90a72ad 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 02d2d41a66..e37820ba4b 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 d64586c508..1208768472 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 203e6acaf3..98da4ef4d1 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 5ab570b813..90708bc2ca 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 ca2af1b712..4b5823f56a 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 547cd1b287..7e678a76df 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 d66bd63e50..f2668d24c9 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 00901dd563..1ed594a389 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 1a8b5e3a57..417ff8c291 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 f2a24a9c36..d8ebd81a92 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 b9e14f76b2..32585894d0 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 487486a15d..16c0468775 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 820128ae46..872a105dd5 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 e8a2e59136..d22c4225b1 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 21406e3aad..498bfa45a0 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 b0a23d92de..cfa531cedf 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 c1ccd70a1e..928194757b 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 fe70473f58..9727edbb80 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 2dfe20bc3d..c6fa78fe2b 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 09a0b7e48a..e4b51e07ca 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 384849d00d..867c3a076a 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 cb29f2c226..e498895ed2 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 b1038d56fd..6cf78ad174 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 7b73056393..380032a2e6 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 0312d70ea7..0fb63d33f4 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 9783b7ee3c..01797fc689 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 1cd361dd87..629d78d723 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 1572036a87..9bb9943bd2 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 c4d90fb80d..d589ecf35b 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 0e1dd6f1bf..4eefbeab54 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 90923b922d..bf3726ab00 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 a5e206e477..80a3cf5220 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 20cc3f9fc7..c1e62bf01c 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 0d963958ab..57d7ee6775 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 48c715b29b..b47b681f95 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 65d18dd7f2..425cb54a59 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 1174b8f6d0..b3f43b564d 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 226ab3329d..45a50f5a26 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 8081a76c45..535caf615c 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 c58b4d5f75..20a4b38481 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 bf9fb7c1fb..98d046e180 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 727d133f71..5bb2d2b05b 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 6aedda7ede..7c3259d38b 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 2ef03b2632..6c3b4f245b 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 d60fb0bd34..4cf5d7226f 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 66c92b285c..05acb844e5 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 75d34c21c0..eba5c66c46 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 b980b822c1..eb7bab8547 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 7d1cfbf630..151597de14 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 26732ee086..1133221e6b 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 a55cf5e4bb..d122229397 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 dc0462ffd0..a712490d31 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 61239c89c8..96ff41af30 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 2f6392ce83..f386490815 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 59fe3c1523..b05f5e9e1d 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 51c2569749..7805fd2193 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 157cf881f6..603acafe09 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 996e08d51a..1e6b030393 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 1e43cae1c1..cacd795810 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 21361edf33..3c0e2d8e37 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 f822afd22c..7d1033c3ab 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 8c4e47d000..eefa9e756d 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 34a007920d..270b37d14d 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 f003972940..bfb928d48d 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 dc035c42ca..50c69ca681 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 11eadab34b..e83b057684 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 817b557906..33e0a051d6 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 4b39de5acf..c859d5f16a 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 27e86a8ff0..ab8fb565a6 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 be5cb3f7b8..eb3eeb1294 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 dcc54d74d2..f855cdd2f7 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 1aa6e15b37..27aedd9ee4 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 4ccf0bdd27..aaf3fbc8d2 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 01d9698f22..7256c0d8e3 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 22c10d6022..d01ab0b540 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 b0172264e7..179263478b 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 7aa81844b8..6b4c824cbe 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 724bea2214..42b1ab14cb 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 e81766a1d8..160b7b5dcc 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 1e2e8e6d55..ce84eabc34 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 ba31ba3e23..6dcabc8fd4 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 8d0d43d45b..43d213a8f9 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 8bfdbe108e..f3bd127b40 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 e7625f3a0c..efc3a72c66 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 54c4b13cb9..b023dba4cd 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 32748dcaaa..7ffbae525f 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 f663d23edc..707f778255 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 ab02934bf9..05371d6d79 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 3d8f9c62d2..53434eab8e 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 abfbff4f80..53411933a0 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 2c74a47044..739c3256fb 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 997e64248a..a37e1dbbbd 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 2ff459e9a3..5d3f0d9496 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 ee0cb59842..93165ded6d 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 1cc2a5022e..25b811a8ca 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 95b26a7c4a..fd5153f396 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 cf40dedd8a..17b0579131 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 a6a164a66c..6f2051f128 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 b680e3b3c1..0ab05080a2 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 c91a35de0b..9e7039990e 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 6c8410b9a6..eb554b459c 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 7605af9854..b141fc3f2c 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 61f298633f..feb2fe2175 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 68e8af0fc3..d5255bf83c 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 eddfec5d52..12b64cc4ff 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 bd21f3f748..8858966fde 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 34292c5511..94703a736a 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 72bb693168..cffb5ca05a 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 a16fb85041..09ec8e24b9 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 150e9cfc45..95ec26a88d 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 aa38ad7a21..b4066641ba 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 3ccdfc1887..8bc7e4c355 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 2ec9f402dd..c35510e60c 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 8527257bc5..fe0e68b6a6 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 a1bb52f4b7..c39dc93293 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 712b1ee0a5..7d0447569f 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 7e46aada8b..948348add4 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 7f2f04f831..b992445f18 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 825913dc2a..7ba76e9bd1 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 af831b720b..3f09388265 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 e1e03d0973..3714d3758d 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 fe279dc6e5..1398dac165 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 b95b208eb0..35c190353b 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 0ebc66a745..bc7c5aa3dd 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 e85e9da1fb..4118b74dc3 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 f5b5987e4d..34c69a1fc5 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 67b07ed481..b6f4d31b5c 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 2758087dea..d2347849dd 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 f2a5e1836a..ba3ef0e0c1 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 631cecc33d..5ae85acc54 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 15a5040992..8cf08a7bd5 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 7292007f1a..1ff6e4d914 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 eba8927204..0d4e3538ce 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 58d6a8f46a..8300f4bbc7 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 fd9cd410d5..10a77c4a67 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 75ed9d3a15..60bd27b24e 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 3a75250c53..b51367aa42 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 db1ea8874f..ec6faa83c1 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 dada58017f..bccc39637b 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 68de38e7c3..db4f986f2d 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 d249296bab..8f63bcd113 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 28cdd2de4e..e18c050044 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 6fccc58c09..a927b5da9f 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 a40c386918..f90152cf68 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 e07f5af99d..1c99461bfa 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 c557256dcb..0f19d534aa 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 1be28a3855..ad4de97e38 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 c43259c563..509dbb664e 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 ddcf7d236c..7749e42f60 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 b970669961..42ed3bee1e 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 e0e92e7cf9..e729963d7d 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 a5c2285560..89694ffd11 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 29c9e31159..a72d1f079e 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 1d8e08c877..741cacc758 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 17d77171c5..6190fb517e 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 fc26c93685..1328483abb 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 7fd465db5f..90b8c91695 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 2d2c2cc588..f1552d7926 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 a8274be2e9..b406c76cbb 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 cf2d8e90da..0376546d28 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 bef10d8cb8..8b463ec97b 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 da0c03c732..8ee6d091cd 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 7cf9631146..c32b3ea6d3 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 f327de994a..a93b07ba30 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 3bbe9fbf2f..4fc4b078ad 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 9f98d626c8..ec42773ef5 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 331ab77748..e29dc01561 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 d19704c58b..88a0f887cc 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 55ae0fc8c0..8e5ca63e13 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 e7a0960cb1..7f4038149c 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 fb3b8797e0..eb986556b6 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 1342a70d6f..982b099cd1 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 144eb0dd3a..54d2ce8a47 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 87e0ce040a..38886af527 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 ed839d4963..4477278e31 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 11766c597f..045a620a9e 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 01da15fdca..c73cf2dbd5 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 034a4952e8..b44831694c 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 d15448bd36..7cbaf305d6 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 a91410b409..a80c6e57e4 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 9612a0f6ec..7846dbf277 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 2e5060f383..982c83851f 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 0336871a56..75d733ff98 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 dced723093..8623ff4774 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 9c98fda2bd..ab0d4ca9df 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 e82a08d703..931cf339bb 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 46b3c3d8c6..1c7f4f69bb 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 9eccc2f357..4978ab2ebb 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 910e026d20..fe5e72982d 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 eb5c77e12c..55c67b490d 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 f924dfd29b..f1541ddeb4 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 ae450645dd..4c8d7338dd 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 795abd49a0..23feccea38 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 af323ac4f6..5c542406cb 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 1a90811fe8..e234bd9160 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 de5fb7ca87..db75a07c9e 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 2cf78588f9..11b1729fde 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 440c6162e3..88be15b68c 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 de1bfccf90..cac0c9b86c 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 65986b49c9..127bbfb26d 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 5cac8948db..fb811e7f12 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 75ea5b13a4..fd970e061b 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 6190ae247d..a4a9ec6981 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 d8a5099bbd..e3557943c6 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 64538f80b9..5f47b84be5 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 6e7b02c85d..0d0fde2481 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 96a6f6e7f4..5bec9dc720 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 4ed2e84918..deb7ae241a 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 772ee6f1e6..6572ef50af 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 161f3d2ffa..5fa82f236c 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 6da1c6cda4..f128ce5110 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 28db7d9fa6..03e8afb991 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 4cfe4b5f9a..91a48a260f 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 72f2f2c2b0..6d35534cb5 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 9698a0b465..9f8c39eb04 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 94035af970..6fc4901fa1 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 bd4af66323..7e9dd4ef52 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 a629df8e1b..797012b883 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 95b1e062e3..eca2ccce4f 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 057b891eb6..077e1812b9 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 adf6f52b49..8b78bd66c6 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 c5f09b8467..2aac7ae9cf 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 474ab82f44..6330e2a82b 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 d849945fab..f48fc7118e 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 bbbdc4dafe..b64c7236af 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 b7d7a0067e..29ab92757b 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 8d100eb078..d689a45e36 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 a200716c0f..fcb8d026bc 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 ab18784ccc..ccd10e0055 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 5596a7242f..a34c5e2eb6 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 e2ca937d6a..ab66e0545e 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 cde49c1b1b..f81dec398f 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 94f7ba739c..2add3d28c4 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 3e30fd34e7..8726537632 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 5c6d07cfe5..cb651c5f5a 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 2aa9ffe7d6..330dfb5d57 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 8bed54f1b2..7ed7a89206 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 79f0d7d9e0..1fbd7f07a9 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 1de9bbfdf7..abc7edbf59 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 e11bbcc6bc..f4884aa8f3 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 dc183b7bda..9604747495 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 32ec0ca247..5cf0d9c54a 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 c651181092..d7046481d1 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 a01cee5c73..90e7210ce2 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 91dff3875c..93661b419b 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 77e1091171..7cabf205e8 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 4a00b9a17a..fd21dcafe0 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 270ecde496..e5f9f6748b 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 87039bb3f9..0fba3001b5 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 9334c287ba..d0ef072339 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 029687411a..6661c577b3 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 be611a8721..f9b5648a66 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 5a34bc7449..7530c9edba 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 a3f7b76848..9cca05178e 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 9caabe0d61..0b5c765287 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 eeaa624b39..f966b5a98c 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 e504ceca12..d3a83fbd5a 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 7cc302e0b8..cc30fd24ad 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 25e53d2c6a..90f686b542 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 5ee2c87052..49203961ac 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 f221fa86fb..ba584c9dde 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 46eedf812d..de541c535e 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 6baad62968..be6b838562 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 cea5fbf022..5e754698d0 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 27061df4e4..a260aa7798 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 3b05a88a3e..85845cc444 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 5c50c32d48..e85361475f 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 20c003f330..522fb2e217 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 c5cd007ea2..1085e7942a 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 8c6d68ec5f..54dedfa136 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 5d8acafc06..409ccbebe2 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 d4842c395e..f09f130ab4 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 d4be784812..3277382711 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 4a781a0a9c..9cc8106ea6 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 77f3eb1d5c..58e84ad21b 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 a5a24eabea..5cae35b69f 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 ad8dd5dc66..47c8d256e3 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 9f0d66a84f..7882d2370d 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 049d7d25e1..2563b1a300 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 2acb705304..7223bd43f5 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 1c9773867c..6ad28612e9 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 72cfdf75e2..5a38014399 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 ba2d34e5a1..4cd75ccacc 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 55056125da..a9d694adec 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 0c470076da..0863e0cdba 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 e174e1c023..ca0684c1d7 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 4eb14e1e3b..fcbd729a5e 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 50c010a49a..661a73baef 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 ae8a5669f8..158ba04f49 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 91990015b8..a15a16404d 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 b8a688adc4..b5451d2057 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 4d1dcb3972..77228521e6 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 bf4619d19d..c7d53117d5 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 ea099d2e14..59b605841b 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 0dc7a851da..57a28d477c 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 a2c8ac5da7..c5c5264c0d 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 cf6ab72dbf..d34bf7748c 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 a3d1457e61..1eb6aa5790 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 abd954506b..ddbccda1b8 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 f57499ca39..450c56eb8a 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 c8da148e04..3b53578397 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 c3c61c88cb..9a2e2ee76f 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 85032d4964..490ae0866d 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 3182733d11..8b0b6fe0a3 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 bf7da45fca..2669ce1ad6 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 bfe79ab80e..6d86ba1a7e 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 3502cdd5f4..b250730610 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 da0cd2952f..b55bfb6a22 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 bdcf23380e..15491b71c4 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 532459305c..2c9c6e3db9 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 e62d541a68..78dbc31bea 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 f8299d8d05..f0f6d4499c 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 9df95a77bd..537e94b0ac 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 88a965974d..123d6608b4 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 5d772da4aa..47d129c042 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 5e4ce38b91..6bf9e3f5b2 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 27d3e5103d..84d6c06621 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 533f22672d..e7faef930e 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 ab851b1a16..5f2b63125a 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 72dfa13691..866315434a 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 6e9628db86..ed3aedaee8 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 7f1dcd0661..df353f630e 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 e877b3dfdc..863d66d89e 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 7dfcc6cd35..edf33552cb 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 bdddba9524..c1c263d409 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 343d179f2a..579ccd907c 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 4f43197fd6..b0c52f7a0e 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 143928e783..5b38ce6ba8 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 ca02e3959c..43b57f5c72 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 886df63660..1a4c0a89d6 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 61d6df5d5f..f3a608b62d 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 ef7822af48..bf78b1ee52 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 1320acca2c..32f73172b7 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 59e2f90f92..2cdce58d87 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 49b4ec5316..a3d4cf83f8 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 a1ddc72f62..82d8ee054c 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 c1179f72a1..8e2388fa84 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 b67b48969c..eac0fe51e2 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 f1408d2f53..bf55c616d9 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 a2cc95e57d..e206f5bb70 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 351ec86c2b..c0cee3886f 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 40cf64c2cb..e24ded11d1 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 1ef24acd50..f2b0120366 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 bff9170a21..19011fcbcb 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 a2fe54d1dc..954acc998c 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 95c375ac37..ad8de89f20 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 7dfd6f789e..f82af380bc 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 0f349eac54..e11aa2adda 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 1f910c33e5..d5b7e5e194 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 397a5e0f4b..e118738f66 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 a485bc996a..09ba9c34e2 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 e671bec029..ba98138bdc 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 76e5a61318..8c45451702 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 187f35ab87..4dde7c6d25 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 1fb1e0af96..00a94d0b83 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 f55d36c770..4b120311d7 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 00ba09143e..974f446dd4 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 86e0b0d11d..0f97942048 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 b666e051cc..74b6943ab4 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 1549d06101..b428038028 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 1359df5a6c..c3353bb722 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 c7c19acccf..3f7ae98fa2 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 e97a14720f..afe98902e5 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 0217538497..94106285be 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 a93b33620f..dd696f4dff 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 03fa3331e9..1dd23143e4 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 38f2628741..43f85853b3 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 6f05d30931..d794aae446 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 fabb2c50a8..0a98e06c7b 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 c284fbae77..11dcb7ae4c 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 6568d7e28d..8d74aecb51 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 e690ba7ba5..ba9fdd658c 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 1c38a1a254..1637882a3c 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 a928b12090..809742f562 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 c975d69d39..c9d6594192 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 accf8c1341..0aefe62ef4 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 a9b093eb0c..1b09254d39 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 51e1fc7828..1536916ae9 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 5e544ccf51..760f9c9562 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 44fd5eabf2..48ebfcc74d 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 d340aa744c..2f047a2de4 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 5ba24df5c1..92fed5a725 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 07180f26ad..6c9576cdab 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 9b565c5470..9004649d1d 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 1da2d18f41..48a7d7dbe6 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 fcb186153d..55fce4ad5e 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 293a9b9929..4c73800a8e 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 6a2ac36ebd..a40c8841ec 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 5f70207312..457424ecfa 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 e7a47ca9cf..5bbb3bbc94 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 15547cd394..55195e45b7 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 92a5ae6a38..204c0f7333 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 a08ac9c7b0..e676643bab 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 6e0b5b9a6b..dc2d5583dd 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 191b96d28b..b06b33b594 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 ed6de31095..aef4a98d84 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 ac2d9b6157..bfd9b59462 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 ede0fa5202..da1bd24c54 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 8d5a593cd9..cac1caf752 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 4f3ce63dd8..da1b6d7f22 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 4d36cd3f7e..9c51bd1191 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 2310a6f831..5a6f90507c 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 4f0fb5341e..e0fdb131ed 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 73fcf0b31f..ef1fc530db 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 0cba3d3741..6266f8b11f 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 148de1d245..b499ae33d1 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 acce151b20..371bbe7a43 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 10e5030660..b5c083dfdf 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 26b704e6d5..21cd3e69df 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 200f017a80..9ed6077b94 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 58c7061059..f89f7698c4 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 6bc459e3b9..c573ac82d6 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 e0e27f5e24..a5382b6e32 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 51e9d66b1f..8736c9cd4f 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 7a3ae35725..039037114d 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 9ee8c1d74f..80c7cab7c8 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 3cd8213152..9cc6a80d0b 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 26a0f34079..5f65113afd 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 6824627151..4e0bc7e8ff 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 ed9b34297b..18b160d0b6 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 620db49434..348fd2e519 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 44d696a5a0..0c36b7cbf3 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 296b1622a0..2a60117328 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 527ffb7d37..5752e5e924 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 e25f8ab743..2140759139 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 0e2a77bb3a..d409dc62d0 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 52df3836d7..af94d0c89c 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 d8c181bf60..bb004f864c 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 cc3e41f3e9..2a10aeb3be 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 cf318d024f..70a04657b8 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 76882d6565..bfee9ce23f 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 8d27728a92..fc8a753f24 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 b4c1401872..7ecaaa93cf 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 e963989385..904b821010 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 5518a8140c..871880e514 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 d06c96d877..43d023028a 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 d0b474d712..b29a6663ff 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 295d38aacb..c8b3bf26e0 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 a4dcfcac0f..0befd951f0 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 1b3433d79e..82fd782717 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 5d18b6182c..888eb9ac4b 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 0774b8ed9c..1f50137d71 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 abbae8818b..a1e1f15697 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 ac5849d075..440e105337 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 5a3b80c5cd..438e8ba759 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 aa834b1fae..a866d39c2c 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 b96b57998a..9ba13ddf96 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 1c03db01db..9a43f82a39 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 caefc03832..67db16d2a2 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 5bb34ad4ff..b3ca90a67b 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 98001afb66..6f5c02f560 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 3c2d253083..870223a37b 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 e862ed6076..19c36b0b2f 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 8d79d1a5af..e579b8e995 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 b4d64e459b..0df485edc9 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 80393837f3..aab903420f 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 1c13dafd3b..9ec8c8a157 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 b1655b7d0b..84cfee90d5 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 14e0b9ca6a..b8ba033f2e 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 d2b0f9c215..424d7c811c 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 84a8de9fed..9b34fe42eb 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 7af34c5271..9a22df52c2 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 9df0f5f6cd..bb5de74ff9 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 7038efb552..d06c79a9e7 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 234082ad18..efc375e97c 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 44287bc6b9..7fb749b069 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 c8ae4ffeae..5e49193181 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 2ff78755c1..087f535fa9 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 ae6a85da0e..b6a0fdeb25 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 16b65d2f94..04e5a72e8f 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 b79cf84078..78144ac6fb 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 a666e7ffe1..404396723e 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 e0ddbe3c22..50a9f5d509 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 acd2a6058d..79a8502c4f 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 583b081a52..1ba29ca1c4 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 c1c55d2d52..daa746cdbe 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 1647b0ee9a..5af9af9818 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 15604f74e5..a26882844e 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 5c657b2607..3e50b6f84d 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 c7bffc9000..8f4aad7f5e 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 01cea20242..66c11cd2db 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 d3fcae7bef..55c335289d 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 974db0f597..024c5fa17f 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 eb0ea40dc9..64adb77603 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 f2ea3fb4e4..0ce55b0849 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 14e087874e..78a2f3828c 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 9d8d34dd79..f9b382ad83 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 b8bcb407f1..6a828d4aab 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 153233f1a6..21e630dee4 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 b3b1d2cb94..0f3241c70b 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 30dbea6ad0..f396858833 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 210363e430..4fd48eb161 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 a78725eefa..c10878110c 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 840838b83e..c2b93fdef8 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 eef94765a5..52e46bd20b 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 b2620fa88b..7ab5c3ee82 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 0a074da074..5da7c83326 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 a24779ac76..2707c30d18 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 c03cb013d5..f6f1375180 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 6a58bfe771..aba1be809a 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 4ea79dbbf7..4ece1d0c7b 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 ebba2500d5..011b6f7132 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 390155fc26..8701d90f7c 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 4b60a18161..c3ba42f315 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 329eee5f81..7e8f7fbaf8 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 a014fa1ee4..fceedfd252 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 628ece68a3..db905dfa35 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 39f15014a1..b922c25ee1 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 4c1b67c83a..09dc4f820a 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 7e8b9a1250..7a4ad77cd3 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 3f68d73675..37de5ee33b 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 8627e90eff..77534920ff 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 aa58b7fcb1..2dea0a76cc 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 fbce91e517..cfd9cd3659 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 73ba76efc4..ca758546c2 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 6cfa17933c..d81f5994f2 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 23eac7da6f..f33605d44e 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 e5e07dd40e..b1f04d41d0 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 99b213e087..2234171116 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 fcc3062a81..8a7e0220b3 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 9c7766bd4f..7e5fad925a 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 dea4a10459..06cfecbd7c 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 3817dbb92f..9335f6b07a 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 a8c16a7038..0f90089c05 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 ae1a82ae89..cf29cfe63b 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 ca75fb16fe..ca4f554d30 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 e8618beb7a..fcf0331c4e 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 562e9b422c..4e0a2e4001 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 3febac8a30..9fd7da4bb4 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 74697932b0..304401f56e 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 77849b9b57..0a8ce08168 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 1fc908be1f..086cf91042 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 35af5124a4..0ac1367ede 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 fba35eab1c..ac8bbcefc0 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 06e51f843f..60af9e44fb 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 9f468763c0..c245ddc2ae 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 05ca09cc66..008e831c61 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 18f6fe259b..17f251cec3 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 7a129b9795..1083ed9fc0 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 92ba794d74..2bcff9143c 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 b2f139cfa0..a2fd424e0e 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 209e4909c4..c1797b7369 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 6ccf2b0280..2911591f9f 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 1620bb8ee5..af92ca9320 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 1947810b82..96177122b7 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 f5299c9eb3..3c339f7aba 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 318f25a1c9..387f3f4f8c 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 f4eff77940..7450cb16fc 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 e3a73e6ae5..9c4dbcfe2e 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 0ed2421fdf..b0d8aac8f8 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 7cfd49dbdd..bf437268c9 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 1b9938f7c7..d1eddb6707 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 3139dc7ac2..2062dd0ce1 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 0bbfee8021..aa28d180da 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 c2ef96165a..45ec1fc909 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 b692f35085..fb3b66c8cf 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 7a05591caf..9a0c8af5b0 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 5150c6de81..a831b10712 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 541a481fe1..ed889829ec 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 d65efac998..b2e8f6ea8b 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 2f8c673b57..11d753ea46 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 4101baf166..446b835a4c 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 76e9c2af1c..138a78defb 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 d9a5a8bdec..a7d54081a6 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 ea89bd9d9b..3b425ba335 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 0f47565f00..db57114302 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 698cbcfa23..65cd5887a1 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 3a5092b92e..a071b625ef 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 2365864d6b..98e95d6f10 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 a11c4a12ed..a1172b92e1 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 2782048bd5..f23a70abb2 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 16bdcecaf1..c7e651afef 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 f403829876..5ab11909b4 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 8f7efd45f6..151b1b178f 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 aaec898746..b9516b8392 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 fbf6b51e6a..17b1b576d1 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 0b1cf4f5b2..4b8163984f 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 7364b2f974..5e63463d4d 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 b07d741f65..4d53bba6c4 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 c2e635d5c5..eccd7a43a0 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 5c8b414dcf..d4a8a1b748 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 4340736aef..c2b936a106 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 69d4897fdb..4252d62367 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 1081a96fa2..54e7b88cf0 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 dd1a1ae339..31b92f7280 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 51d6404c4d..b9cc116a5e 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 d31dc99572..37f37fc9b5 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 e0e9c5d567..b1209d762a 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 01c23cb418..12ce742c90 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 6a333584f8..718d052cd2 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 3f986d638f..e6bbfda1dc 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 daf8cb60eb..4bdb7ac3e7 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 48639c249d..eff96da98e 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 c803a8083f..dad2816d40 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 d9260ca94d..4fc3bcaa98 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 f3e2957ba6..7e927d09ba 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 7344000739..59c4264ee3 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 610cf66298..fea8c2d4fc 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 e222f35245..30d358cb76 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 a326ec7f63..c1ee13370b 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 58d7a27699..999eefc1ef 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 f7c80ca6e0..1cb5f38c1d 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 c845f919bb..0e2c5b110e 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 77e2a8bb5e..65dab752f1 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 22ec5a6814..f193e97916 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 3b2d37ef68..e7b5f8f3fe 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 2264e59937..f849457d64 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 e5dd5a13a1..408f6596c4 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 c3159789ce..637ada7fa8 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 f3d903adb1..bf3dfe4e8b 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 997d147a6d..9a186de8df 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 4ac953849c..179bca51ec 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 17fa6df924..66497ac2d3 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 6dfc401549..c0dab89565 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 9b2fc612c7..5572bbf18e 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 208907d03e..233128d792 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 0edee3190c..6ee9ad2278 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 0bf2673435..150273f799 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 622d64181f..f9d5111581 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 293cb554ce..b984541bfe 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 ead32446b7..f512e61316 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 dee33d854a..541820c7a2 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 f929282b16..2f2f17d969 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 aa7a10c047..0e5c4ded01 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 fae1bd4b5d..4b7ba61f9c 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 e769e6b81a..cc91fe28df 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 15a2abbdc5..5dc73e044e 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 17fe1727d3..040e718948 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 d1c0f13e92..cf3224ecaf 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 c7727f574a..4103a19243 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 45dad0f390..e66fcb1621 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 929cb0ffd1..7528f50287 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 bcb13a14af..e4bc4da78c 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 420b3163cc..446aebe2d5 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 b71e213647..ba7d983bad 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 31ea215054..5bc37d2d71 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 3ab3b7062c..d9b4d71d48 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 eee31e24be..e6157956d4 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 56de10023f..b89dd6c928 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 79489628b5..66e8fb6b35 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 c6a07f4017..659c8046a9 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 79d3c63220..badab2133b 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 eea2bea3ac..6c540c9e31 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 ecee764b4d..6911c59150 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 a069d0a799..f2245345e3 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 2551d88d22..aab466e3eb 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 16c63a90aa..e7a191b47a 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 06d28ab30b..6e67d3ae04 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 cc2cd94ea6..1837a17bab 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 387620afa7..41051dad45 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 dbf8c8f866..4c17fc8d02 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 4693b4984e..fdd921a611 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 c11ff65ac4..13897c74da 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 30cad31eef..f186287b0c 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 b037232a6b..549c26662f 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 c3ab108dff..b65ade73db 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 ef1aa60bad..ce4e4f43cd 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 c22a097925..4818a9ee95 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 fdb8e030b7..4fe4d445a2 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 a9282d5aa0..2685deb0e9 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 6290ff7999..963fd989f0 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 2543d8b021..2101f85ac0 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 95ae679bca..f8a8923498 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 0b03e7142a..12a031562b 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 cfde7e47fb..a9f6064c7e 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 b4ed8f8a52..e02ff98d3c 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 8efc9d4b5f..0e8789d6bf 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 72825dc440..585d6c327f 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 fe895ce7c3..8112dc733a 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 a2fece3f7f..4bead73f68 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 b2963c4f56..08da96f92c 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 18ce5a1ede..031a0da7e3 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 bcae20c581..0d10533b0c 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 5e403c7824..d67233aff7 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 f673173de5..0d9c0653c0 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 a88ffcd67a..928ce31a8e 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 2d7d1cc4f9..965fc82c05 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 c3dfbef53b..07edd579f1 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 55e64ed9b2..c24c273b6f 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 89feabef11..762f0500ad 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 df10ed1b65..24833ece05 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 c985d4bc37..e6c4272212 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 dd7c6dfb37..90f519b5b5 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 3e2277ad98..a6fcda3e62 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 496ce66975..47fc458ce9 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 fb530d0830..b637838c0c 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 2a2ed3cdae..f73270f2ff 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 2082c714cc..37a97cd817 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 72b1e42850..9eab7b713b 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 beabea0f0e..913bb7b0b4 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 55d25a9b73..4cd89599fe 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 d7c5329179..a2f554a0b8 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 c7303accea..9eddbdd90d 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 0dbe8782e9..f2ecb87ce9 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 9268f052a2..b58bce1435 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 48b605e46a..e912e1039f 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 e71c37e36a..8e4001f802 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 3604ae3ec3..f142c49f14 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 7e8eb6b1ef..4218bace2b 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 d77564cacb..46d6f92f2b 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 c1bc3361f2..60417ca893 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 71f8a28265..8e3e04b966 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 47f078935b..ea9a315cb1 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 3bdef8fbf6..e45c913c94 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 12d1c0648d..a430e4a58d 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 fae2b73ac4..15b510e7f6 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 d90a2b6f75..1d87d7f920 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 737a2f30a1..135629a243 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 0bac7a5f28..f931c6abb9 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 dd28ba748b..c540ecfacd 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 ab8eb68d34..4453580bd9 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 8b3ea082b6..a5631a5cb1 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 6ed8fb44ca..93da3e5b3b 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 b374fe162c..79f06dffa9 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 599037b95b..abb785ea0f 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 385724b0b0..88460e1e3a 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 1c0b095f18..a71472d464 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 00652d0406..bcfc4616ac 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 79a9839627..00b2129d12 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 229db3892d..a3e5420a5e 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 9f40288ec5..730a78a072 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 cacb3f247c..df710b9cb8 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 4e13742793..794b3b923b 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 4f7865b845..b348330d20 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 c8f958a47c..55907d9bc4 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 2f750228a4..ab2e33acd2 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 3ea94454cf..50a473b9c8 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 939b8db1bb..1c84814363 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 dad1bcc693..e784e26295 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 0d01805154..fd10206a12 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 045e69b949..ed8999b6b7 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 a96a104f24..97087d0b3b 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 c7b1742856..24bc424274 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 85413b62e3..e40cbb0f9d 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 a2a4bba5bb..25e44716c1 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 7874d3d25a..b64482b58d 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 e1422bac6f..5da5717331 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 08b261a722..6a1a899103 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 887ff283ad..9e09493c6a 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 75d96b6933..8b36224a7f 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 bdbde6f993..f206929f59 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 3960a62694..cfb9aab0d9 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 e309d824ab..9e8170b13a 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 2faf97867c..6d04890d4d 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 70daa0d75a..bded532720 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 04eb5f408a..feaa7c887b 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 0bf1db12b7..4187c9b439 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 f74dc08953..160d874bed 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 fba10ceffd..0073159244 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 eb59c84957..5c9eb87b2e 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 1799ec454c..1ed4ea3573 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 042491672f..cd144d79e0 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 c339fc5be6..f451df6847 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 e9245aa0d5..24e8bfc688 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 efff0c66a3..b2f2de137d 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 414010c033..12e3b8f9c6 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 73869892fb..181d6408e0 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 463fdaa44b..3ed82c536a 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 7fd0b813d6..76e6fe077f 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 96a7a60038..e726e16998 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 c6e9415882..f9607e1f4f 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 12c3381cb4..e156f446f5 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 3fd129cbf6..01a83ef214 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 cd7ad605a8..35da468749 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 4033b308ac..3e41cfa45c 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 85ff5e808c..76aa97d1ff 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 75afc11099..02bbb6b664 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 389cd329c6..fd64438ead 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 56fd89f76a..931bf5dba0 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 0fc0dcc3ae..4e1975a1e0 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 406751b028..bebb6799b9 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 a9ac6ffa17..73f1c5772a 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 f4866701e2..8d95a99720 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 c851f02a57..cf7ab78685 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 f1253ee51b..ce68fce5f0 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 95f293d234..f9d68f1395 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 536bfae203..533b9126cd 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 3488600e27..fde55af50b 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 afd88531ea..8164154779 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 a5dcdd37e4..8915dee1f1 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 99bd4dd6f9..7ddba939ba 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 0204bc5d1f..f30134f04a 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 8ba2deec2e..7ba063a3a0 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 ba4341633b..f5284c1b58 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 d73572c93b..fa0d72b5ad 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 3768c7eaac..68ef2caa98 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 a1d867233b..dec829face 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 1b20e5ac8e..a9798df059 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 cf5cae9c8a..450f6b54a5 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 dc3d52da01..f2dca0b9ab 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 47845fae39..4a9265079b 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 75952da6a3..af1d843178 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 38b21f401e..6eeba92585 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 a2f3ad12f4..190acae428 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 1cd014992d..370c959ea2 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 84c3441218..94d3a1d06f 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 9b5211d29b..4e3251a9da 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 b9bef97a5e..3a89128350 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 7155094198..6761671e19 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 ac4bb0e847..f583005ce9 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 f157c80bec..fbe3963348 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 03456d6439..2795d3ecd6 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 1bb501df43..68bf30dba3 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 886583e4c5..d21cbc6c26 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 7acb9db1e0..e48c1d7036 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 092aa1a636..96c615c44a 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 979fc24a16..e146d48343 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 b1012f5dee..5fcd64b8ba 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 cdf76529ef..45e19e6638 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 cf6a4875d5..01df6ad453 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 23fc935389..678cf3fbd2 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 65dcf05e2b..d44eeec18d 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 ae23eba167..cb6a90dcae 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 56c6040be7..20a3792b28 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 0d6f4d0ac4..2f74f3ed8e 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 c9a4fbb03e..5ff194e12d 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 ea30a4f315..f7f3e4f3df 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 bc3d9653a7..647edb22b4 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 859d77cd62..2f008615eb 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 127e3c4a2b..86fde1b978 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 7b3d6616ee..5a46a452b9 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 742f247a11..4619c9345c 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 99d40bea2e..16d8acd1ca 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 4772c3b99d..da14a041fa 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 b7b013396b..fb9cb764f8 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 9925e03ad6..e9511e5923 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 24ceb885f5..2a9ab11107 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 5d5be20354..948bf49102 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 064716ad0c..ee981a157a 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 ec2efa12fb..22579ceeca 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 cbb1ac1fe1..c02ff33fb5 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 df9ca3d500..511eca613a 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 a32d5d1d4c..5808bdf04a 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 ea50bf4098..ced829f8d4 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 3a159e6090..109f4273f7 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 cfebda7bd2..6281b8eb21 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 b218b4edfc..6076a6f09b 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 4ce77a8b52..49f4d139c1 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 948ea22448..e1e81bacc1 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 6f19209561..f349c8dbd0 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 4044cbd211..fcdc81443c 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 54b316631f..a1d9adb6d9 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 c0dbee7774..4c53ca49eb 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 e7c8ddc954..9aa260a7f3 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 bb9ba53d5d..aaa965c424 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 045ff6da7f..9f012c9dfb 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 9caa928766..b36b992214 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 a6129dd0bb..defed7d5f6 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 0f3a5407dc..5588cdb708 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 5c40173b12..a6270bd241 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 e86a497f69..831402fc87 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 bbedc3a572..41d81426e6 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 d8c6634fb8..b6afbc254d 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 df8763a4e2..cd4b16bf31 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 199bf5242e..7b57803dd4 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 60d2c6b6a8..6adb193928 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 00a3860812..bd852e45f1 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 fdd7a06810..d90d4d9753 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 f889c60f17..08132e3c75 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 1ca965e99e..fa38bea001 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 5ad5da480c..1aa36464a1 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 798a4f70b6..8f407e2d7d 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 58af58a253..d03cb1d74f 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 be3db49aa4..113b04e31f 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 66b7e926d8..855bf1f070 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 fce7f33e66..b70efbda58 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 26eec2cfd0..6386d29835 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 8a30e7bae7..e459c71a71 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 d38064e64a..a7ede0b056 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 45c0a6fb6d..d556d8aaa8 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 47214fc98f..347e3a4344 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 2eb97a6e7e..c7b445f96c 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 b43729d0c1..21eae0f5ab 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 5177135a34..d4fdb34964 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 faf97d8a8d..4fd66c0390 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 b105edebbd..a80806c209 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 20183960e0..0059af1037 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 7443e4f57e..6dd2f2d32e 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 af314349ff..d84170d764 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 3e89f726ce..d41ccaee09 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 e94d9d5ba1..9364cca344 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 ed43828a53..e9e00979ff 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 00d17f1742..807e3c1415 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 543acd61c1..c83d80c502 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 fdfb855a75..62ba69d3fd 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 8a7502888b..b289a85644 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 f676b98438..2225da91ed 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 22c48699d0..49b9a87a7d 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 53275da60e..0345f9a6f6 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 cbff5feac8..7542ce62bc 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 c5eebb01a1..e6ef89c72e 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 74a1abc990..962b1206b6 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 a8a83a2a3a..3eb1af6da7 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 916b65d6da..f93f34127f 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 3e92efc26c..1d0ef77d54 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 a24753de2d..0fab45cb0c 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 66be12749c..964b63a2b4 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 5cd9ee433d..13982e00a6 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 6848b2ffa0..a587713b61 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 5d68b066cf..eb8a974d04 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 7aaef76a64..eb1533d441 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 2af60a1736..e8565a3363 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 c0ad1484ff..5907dc2019 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 a789dcb306..f77b86e436 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 d92a10cd80..1cfaad9b3e 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 6eeb785f9c..cb9fc97a86 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 abc6378a63..f68c001f64 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 e95fe429c3..e4f85488f4 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 63dc78df38..7bd156419e 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 c1d8df4553..dfca2e4202 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 2ee0a1d86d..0478de55d6 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 2922a2b06e..c32273a59b 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 239196813a..09b6627c79 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 717d46f1bb..1e91c348ef 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 3a7cd0e15b..c77341418c 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 a150ea7a58..7a76ab1e12 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 6497eb7f12..b9e544e974 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 4fa3eaa4da..ac8b165151 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 5e5837b298..ba4005e9e0 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 53853b9bdc..4580f2a66e 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 11ea83b884..2ef19c37ea 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 8b2057e533..1ffdb5d461 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 50b576771f..86effb7c6c 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 bba28d0d7a..4987dc1848 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 9e1b8e3077..0d06cc3485 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 18d1829174..ff5754f357 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 74578ab4e0..859ab6cc5e 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 8663eb5a4d..98396aae13 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 32b3433318..80f2a4c9c3 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 d08cfce602..cc16b22dc4 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 38a77c8208..7f0e03f9ac 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 de2dff180d..da91be95b8 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 e78870b704..c87ade9850 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 93346c43f1..4b79f3c4e3 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 a33b6f23c4..08f660add3 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 16d0f3bc54..e459587d97 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 80c8456742..69671b9dc4 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 701d47bfc9..c602ab82b1 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 b7e6dd8b55..a0b15e2b85 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 c444caf419..8211aeb69e 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 5274d6e3da..226440ec50 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 44d98ba512..ea8ac27b59 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 4d3ead73ce..93bf265b8b 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 bde2a8559c..35aa5b1a89 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 a326e380a7..dbac78d78c 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 dcccff1ff5..8590df02d8 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 519dce059b..c6f5aecd40 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 c1165350ae..f0ecf9a7c4 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 3fe0db0ce3..82fd51cedd 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 8a9d047691..4ef473e57a 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 552d686af0..96ab97174b 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 627960888a..15d7fba27f 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 9b634116db..ccbdc55e4f 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 3f5f6debd5..24a80d96c2 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 2dc9f0cb93..9373906c6f 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 2c0856bd95..a2c07a7a9c 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 cad1a83a30..c33cd9eea6 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 1af9a7705a..834c21ec0e 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 b3f76e5e30..f7b1bef9e3 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 547ed2f8d6..4f3af900ee 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 dde08c6391..de36444180 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 c240a44685..b4332468bc 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 afb19cbad0..21e8d5411a 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