summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichaƫl Zasso <mic.besace@gmail.com>2016-01-13 21:42:45 +0100
committerRoman Reiss <me@silverwind.io>2016-01-13 23:16:17 +0100
commitd1aabd626428cec65e5f54c04d9e3446d1e4d3b7 (patch)
tree9a4d4de19204b8b50d496dd6046a897f107bcf4d /test
parentec8e0ae697d96c417bda0bbe5be9712cf5923b1f (diff)
downloadandroid-node-v8-d1aabd626428cec65e5f54c04d9e3446d1e4d3b7.tar.gz
android-node-v8-d1aabd626428cec65e5f54c04d9e3446d1e4d3b7.tar.bz2
android-node-v8-d1aabd626428cec65e5f54c04d9e3446d1e4d3b7.zip
test: fix style issues after eslint update
Replace var keyword with const or let. PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'test')
-rw-r--r--test/common.js2
-rw-r--r--test/debugger/test-debugger-repl-break-in-module.js4
-rw-r--r--test/debugger/test-debugger-repl-restart.js2
-rw-r--r--test/gc/test-http-client-connaborted.js18
-rw-r--r--test/gc/test-http-client-onerror.js18
-rw-r--r--test/gc/test-http-client-timeout.js18
-rw-r--r--test/gc/test-http-client.js18
-rw-r--r--test/gc/test-net-timeout.js18
-rw-r--r--test/internet/test-dgram-broadcast-multi-process.js68
-rw-r--r--test/internet/test-dgram-multicast-multi-process.js22
-rw-r--r--test/internet/test-dns-ipv4.js47
-rw-r--r--test/internet/test-dns-ipv6.js49
-rw-r--r--test/internet/test-dns.js22
-rw-r--r--test/parallel/test-bad-unicode.js4
-rw-r--r--test/parallel/test-buffer.js4
-rw-r--r--test/parallel/test-child-process-double-pipe.js10
-rw-r--r--test/parallel/test-child-process-fork-and-spawn.js24
-rw-r--r--test/parallel/test-child-process-fork-close.js12
-rw-r--r--test/parallel/test-child-process-fork-dgram.js8
-rw-r--r--test/parallel/test-child-process-fork-net2.js4
-rw-r--r--test/parallel/test-cli-eval.js10
-rw-r--r--test/parallel/test-cluster-worker-exit.js34
-rw-r--r--test/parallel/test-cluster-worker-kill.js4
-rw-r--r--test/parallel/test-crypto-padding.js8
-rw-r--r--test/parallel/test-crypto-stream.js10
-rw-r--r--test/parallel/test-dgram-bytes-length.js16
-rw-r--r--test/parallel/test-dgram-close.js6
-rw-r--r--test/parallel/test-dgram-multicast-setTTL.js10
-rw-r--r--test/parallel/test-dgram-udp4.js34
-rw-r--r--test/parallel/test-domain-with-abort-on-uncaught-exception.js24
-rw-r--r--test/parallel/test-event-emitter-num-args.js4
-rw-r--r--test/parallel/test-file-write-stream.js62
-rw-r--r--test/parallel/test-file-write-stream3.js17
-rw-r--r--test/parallel/test-fs-chmod.js4
-rw-r--r--test/parallel/test-fs-error-messages.js23
-rw-r--r--test/parallel/test-fs-open-flags.js9
-rw-r--r--test/parallel/test-fs-read-buffer.js22
-rw-r--r--test/parallel/test-fs-read.js16
-rw-r--r--test/parallel/test-fs-readfile-empty.js11
-rw-r--r--test/parallel/test-fs-readfile-fd.js11
-rw-r--r--test/parallel/test-fs-readfile-unlink.js12
-rw-r--r--test/parallel/test-fs-realpath.js12
-rw-r--r--test/parallel/test-fs-write-buffer.js18
-rw-r--r--test/parallel/test-fs-write-stream-change-open.js15
-rw-r--r--test/parallel/test-fs-write-stream.js13
-rw-r--r--test/parallel/test-global.js4
-rw-r--r--test/parallel/test-http-abort-queued.js6
-rw-r--r--test/parallel/test-http-client-response-domain.js8
-rw-r--r--test/parallel/test-http-client-timeout-agent.js4
-rw-r--r--test/parallel/test-http-default-port.js30
-rw-r--r--test/parallel/test-http-header-response-splitting.js42
-rw-r--r--test/parallel/test-http-host-headers.js8
-rw-r--r--test/parallel/test-http-localaddress.js6
-rw-r--r--test/parallel/test-http-parser.js8
-rw-r--r--test/parallel/test-http-timeout.js30
-rw-r--r--test/parallel/test-https-host-headers.js12
-rw-r--r--test/parallel/test-https-localaddress.js6
-rw-r--r--test/parallel/test-net-listen-port-option.js3
-rw-r--r--test/parallel/test-net-pause-resume-connecting.js12
-rw-r--r--test/parallel/test-net-stream.js14
-rw-r--r--test/parallel/test-next-tick-errors.js4
-rw-r--r--test/parallel/test-path-parse-format.js2
-rw-r--r--test/parallel/test-preload.js6
-rw-r--r--test/parallel/test-promises-unhandled-rejections.js168
-rw-r--r--test/parallel/test-querystring.js5
-rw-r--r--test/parallel/test-readline-interface.js2
-rw-r--r--test/parallel/test-regress-GH-7511.js4
-rw-r--r--test/parallel/test-repl-console.js6
-rw-r--r--test/parallel/test-repl-definecommand.js6
-rw-r--r--test/parallel/test-repl-end-emits-exit.js10
-rw-r--r--test/parallel/test-repl-envvars.js50
-rw-r--r--test/parallel/test-repl-options.js6
-rw-r--r--test/parallel/test-repl-persistent-history.js202
-rw-r--r--test/parallel/test-repl-require-cache.js4
-rw-r--r--test/parallel/test-repl.js22
-rw-r--r--test/parallel/test-signal-handler.js4
-rw-r--r--test/parallel/test-stream-writev.js36
-rw-r--r--test/parallel/test-stringbytes-external-at-max.js2
-rw-r--r--test/parallel/test-timers-immediate.js10
-rw-r--r--test/parallel/test-timers-this.js4
-rw-r--r--test/parallel/test-timers-unref.js12
-rw-r--r--test/parallel/test-tls-connect-no-host.js12
-rw-r--r--test/parallel/test-tls-connect-stream-writes.js19
-rw-r--r--test/parallel/test-tls-npn-server-client.js10
-rw-r--r--test/parallel/test-tls-server-verify.js5
-rw-r--r--test/parallel/test-tls-sni-option.js18
-rw-r--r--test/parallel/test-tls-sni-server-client.js10
-rw-r--r--test/parallel/test-url.js50
-rw-r--r--test/parallel/test-util-log.js6
-rw-r--r--test/parallel/test-zlib-flush.js22
-rw-r--r--test/parallel/test-zlib-invalid-input.js4
-rw-r--r--test/parallel/test-zlib-params.js18
-rw-r--r--test/pummel/test-dh-regr.js4
-rw-r--r--test/pummel/test-exec.js26
-rw-r--r--test/pummel/test-fs-watch-file-slow.js26
-rw-r--r--test/pummel/test-http-client-reconnect-bug.js9
-rw-r--r--test/pummel/test-http-upload-timeout.js8
-rw-r--r--test/sequential/test-child-process-execsync.js3
-rw-r--r--test/sequential/test-dgram-pingpong.js4
-rw-r--r--test/sequential/test-init.js8
-rw-r--r--test/sequential/test-module-loading.js18
-rw-r--r--test/sequential/test-regress-GH-1697.js10
-rw-r--r--test/sequential/test-regress-GH-3542.js10
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max-by-1-ascii.js2
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max-by-1-base64.js2
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max-by-1-binary.js2
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max-by-1-hex.js2
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max-by-1-utf8.js2
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max-by-2.js2
-rw-r--r--test/sequential/test-stringbytes-external-exceed-max.js2
110 files changed, 948 insertions, 901 deletions
diff --git a/test/common.js b/test/common.js
index 32200b9e6a..133294d91e 100644
--- a/test/common.js
+++ b/test/common.js
@@ -437,7 +437,7 @@ exports.getServiceName = function getServiceName(port, protocol) {
if (matches && matches.length > 1) {
serviceName = matches[1];
}
- } catch(e) {
+ } catch (e) {
console.error('Cannot read file: ', etcServicesFileName);
return undefined;
}
diff --git a/test/debugger/test-debugger-repl-break-in-module.js b/test/debugger/test-debugger-repl-break-in-module.js
index e3f998eb64..e439e08c24 100644
--- a/test/debugger/test-debugger-repl-break-in-module.js
+++ b/test/debugger/test-debugger-repl-break-in-module.js
@@ -20,8 +20,8 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
// continue - the breakpoint should be triggered
repl.addTest('c', [
- /break in .*[\\\/]mod\.js:23/,
- /21/, /22/, /23/, /24/, /25/
+ /break in .*[\\\/]mod\.js:23/,
+ /21/, /22/, /23/, /24/, /25/
]);
// -- RESTORE BREAKPOINT ON RESTART --
diff --git a/test/debugger/test-debugger-repl-restart.js b/test/debugger/test-debugger-repl-restart.js
index 584cb098bf..206cd2e741 100644
--- a/test/debugger/test-debugger-repl-restart.js
+++ b/test/debugger/test-debugger-repl-restart.js
@@ -4,7 +4,7 @@ var repl = require('./helper-debugger-repl.js');
repl.startDebugger('breakpoints.js');
var linesWithBreakpoint = [
- /1/, /2/, /3/, /4/, /5/, /\* 6/
+ /1/, /2/, /3/, /4/, /5/, /\* 6/
];
// We slice here, because addTest will change the given array.
repl.addTest('sb(6)', linesWithBreakpoint.slice());
diff --git a/test/gc/test-http-client-connaborted.js b/test/gc/test-http-client-connaborted.js
index 6d8dd02a52..5accec4ec6 100644
--- a/test/gc/test-http-client-connaborted.js
+++ b/test/gc/test-http-client-connaborted.js
@@ -6,15 +6,15 @@ function serverHandler(req, res) {
res.connection.destroy();
}
-var http = require('http'),
- weak = require('weak'),
- done = 0,
- count = 0,
- countGC = 0,
- todo = 500,
- common = require('../common'),
- assert = require('assert'),
- PORT = common.PORT;
+const http = require('http');
+const weak = require('weak');
+const common = require('../common');
+const assert = require('assert');
+const PORT = common.PORT;
+const todo = 500;
+let done = 0;
+let count = 0;
+let countGC = 0;
console.log('We should do ' + todo + ' requests');
diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js
index f28ccb2946..e94bde6b5a 100644
--- a/test/gc/test-http-client-onerror.js
+++ b/test/gc/test-http-client-onerror.js
@@ -8,15 +8,15 @@ function serverHandler(req, res) {
res.end('Hello World\n');
}
-var http = require('http'),
- weak = require('weak'),
- done = 0,
- count = 0,
- countGC = 0,
- todo = 500,
- common = require('../common'),
- assert = require('assert'),
- PORT = common.PORT;
+const http = require('http');
+const weak = require('weak');
+const common = require('../common');
+const assert = require('assert');
+const PORT = common.PORT;
+const todo = 500;
+let done = 0;
+let count = 0;
+let countGC = 0;
console.log('We should do ' + todo + ' requests');
diff --git a/test/gc/test-http-client-timeout.js b/test/gc/test-http-client-timeout.js
index 219dc3fa50..1f87bce233 100644
--- a/test/gc/test-http-client-timeout.js
+++ b/test/gc/test-http-client-timeout.js
@@ -10,15 +10,15 @@ function serverHandler(req, res) {
}, 100);
}
-var http = require('http'),
- weak = require('weak'),
- done = 0,
- count = 0,
- countGC = 0,
- todo = 550,
- common = require('../common'),
- assert = require('assert'),
- PORT = common.PORT;
+const http = require('http');
+const weak = require('weak');
+const common = require('../common');
+const assert = require('assert');
+const PORT = common.PORT;
+const todo = 550;
+let done = 0;
+let count = 0;
+let countGC = 0;
console.log('We should do ' + todo + ' requests');
diff --git a/test/gc/test-http-client.js b/test/gc/test-http-client.js
index 06648473c0..0cceb1edb0 100644
--- a/test/gc/test-http-client.js
+++ b/test/gc/test-http-client.js
@@ -6,15 +6,15 @@ function serverHandler(req, res) {
res.end('Hello World\n');
}
-var http = require('http'),
- weak = require('weak'),
- done = 0,
- count = 0,
- countGC = 0,
- todo = 500,
- common = require('../common'),
- assert = require('assert'),
- PORT = common.PORT;
+const http = require('http');
+const weak = require('weak');
+const common = require('../common');
+const assert = require('assert');
+const PORT = common.PORT;
+const todo = 500;
+let done = 0;
+let count = 0;
+let countGC = 0;
console.log('We should do ' + todo + ' requests');
diff --git a/test/gc/test-net-timeout.js b/test/gc/test-net-timeout.js
index 6c3b4f245b..26e03786a6 100644
--- a/test/gc/test-net-timeout.js
+++ b/test/gc/test-net-timeout.js
@@ -17,15 +17,15 @@ function serverHandler(sock) {
}, 100);
}
-var net = require('net'),
- weak = require('weak'),
- done = 0,
- count = 0,
- countGC = 0,
- todo = 500,
- common = require('../common'),
- assert = require('assert'),
- PORT = common.PORT;
+const net = require('net');
+const weak = require('weak');
+const common = require('../common');
+const assert = require('assert');
+const PORT = common.PORT;
+const todo = 500;
+let done = 0;
+let count = 0;
+let countGC = 0;
console.log('We should do ' + todo + ' requests');
diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js
index a24aabcf1b..344f6506af 100644
--- a/test/internet/test-dgram-broadcast-multi-process.js
+++ b/test/internet/test-dgram-broadcast-multi-process.js
@@ -1,19 +1,19 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- dgram = require('dgram'),
- util = require('util'),
- networkInterfaces = require('os').networkInterfaces(),
- Buffer = require('buffer').Buffer,
- fork = require('child_process').fork,
- LOCAL_BROADCAST_HOST = '255.255.255.255',
- TIMEOUT = common.platformTimeout(5000),
- messages = [
- new Buffer('First message to send'),
- new Buffer('Second message to send'),
- new Buffer('Third message to send'),
- new Buffer('Fourth message to send')
- ];
+const common = require('../common');
+const assert = require('assert');
+const dgram = require('dgram');
+const util = require('util');
+const networkInterfaces = require('os').networkInterfaces();
+const Buffer = require('buffer').Buffer;
+const fork = require('child_process').fork;
+const LOCAL_BROADCAST_HOST = '255.255.255.255';
+const TIMEOUT = common.platformTimeout(5000);
+const messages = [
+ new Buffer('First message to send'),
+ new Buffer('Second message to send'),
+ new Buffer('Third message to send'),
+ new Buffer('Fourth message to send')
+];
if (common.inFreeBSDJail) {
console.log('1..0 # Skipped: in a FreeBSD jail');
@@ -34,13 +34,13 @@ get_bindAddress: for (var name in networkInterfaces) {
assert.ok(bindAddress);
if (process.argv[2] !== 'child') {
- var workers = {},
- listeners = 3,
- listening = 0,
- dead = 0,
- i = 0,
- done = 0,
- timer = null;
+ const workers = {};
+ const listeners = 3;
+ let listening = 0;
+ let dead = 0;
+ let i = 0;
+ let done = 0;
+ let timer = null;
//exit the test if it doesn't succeed within TIMEOUT
timer = setTimeout(function() {
@@ -166,15 +166,21 @@ if (process.argv[2] !== 'child') {
return;
}
- 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);
-
- process.nextTick(sendSocket.sendNext);
- });
+ 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);
+
+ process.nextTick(sendSocket.sendNext);
+ }
+ );
};
function killChildren(children) {
diff --git a/test/internet/test-dgram-multicast-multi-process.js b/test/internet/test-dgram-multicast-multi-process.js
index f72402eef6..5fa897fc6c 100644
--- a/test/internet/test-dgram-multicast-multi-process.js
+++ b/test/internet/test-dgram-multicast-multi-process.js
@@ -157,14 +157,20 @@ if (process.argv[2] !== 'child') {
return;
}
- 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',
- buf.toString(),
- LOCAL_BROADCAST_HOST, common.PORT);
- process.nextTick(sendSocket.sendNext);
- });
+ 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',
+ buf.toString(),
+ LOCAL_BROADCAST_HOST, common.PORT);
+ process.nextTick(sendSocket.sendNext);
+ }
+ );
};
}
diff --git a/test/internet/test-dns-ipv4.js b/test/internet/test-dns-ipv4.js
index bdca60d1b4..0781496392 100644
--- a/test/internet/test-dns-ipv4.js
+++ b/test/internet/test-dns-ipv4.js
@@ -1,14 +1,14 @@
'use strict';
-var common = require('../common');
-var assert = require('assert'),
- dns = require('dns'),
- net = require('net'),
- isIPv4 = net.isIPv4;
+const common = require('../common');
+const assert = require('assert');
+const dns = require('dns');
+const net = require('net');
+const isIPv4 = net.isIPv4;
-var expected = 0,
- completed = 0,
- running = false,
- queue = [];
+let expected = 0;
+let completed = 0;
+let running = false;
+const queue = [];
function TEST(f) {
function next() {
@@ -148,19 +148,22 @@ TEST(function test_lookup_localhost_ipv4(done) {
});
TEST(function test_lookup_all_ipv4(done) {
- 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);
-
- ips.forEach(function(ip) {
- assert.ok(isIPv4(ip.address));
- assert.strictEqual(ip.family, 4);
- });
-
- done();
- });
+ 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);
+
+ ips.forEach(function(ip) {
+ assert.ok(isIPv4(ip.address));
+ assert.strictEqual(ip.family, 4);
+ });
+
+ done();
+ }
+ );
checkWrap(req);
});
diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js
index d7c50a1e86..38a5c3bf73 100644
--- a/test/internet/test-dns-ipv6.js
+++ b/test/internet/test-dns-ipv6.js
@@ -1,14 +1,14 @@
'use strict';
-var common = require('../common');
-var assert = require('assert'),
- dns = require('dns'),
- net = require('net'),
- isIPv6 = net.isIPv6;
+const common = require('../common');
+const assert = require('assert');
+const dns = require('dns');
+const net = require('net');
+const isIPv6 = net.isIPv6;
-var expected = 0,
- completed = 0,
- running = false,
- queue = [];
+let expected = 0;
+let completed = 0;
+let running = false;
+const queue = [];
if (!common.hasIPv6) {
console.log('1..0 # Skipped: this test, no IPv6 support');
@@ -156,20 +156,23 @@ TEST(function test_lookup_ip_ipv6(done) {
});
TEST(function test_lookup_all_ipv6(done) {
- 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);
-
- ips.forEach(function(ip) {
- assert.ok(isIPv6(ip.address),
- 'Invalid IPv6: ' + ip.address.toString());
- assert.strictEqual(ip.family, 6);
- });
-
- done();
- });
+ 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);
+
+ ips.forEach(function(ip) {
+ assert.ok(isIPv6(ip.address),
+ 'Invalid IPv6: ' + ip.address.toString());
+ assert.strictEqual(ip.family, 6);
+ });
+
+ done();
+ }
+ );
checkWrap(req);
});
diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js
index 6448ad7c76..2ac6d1a3db 100644
--- a/test/internet/test-dns.js
+++ b/test/internet/test-dns.js
@@ -1,16 +1,16 @@
'use strict';
require('../common');
-var assert = require('assert'),
- dns = require('dns'),
- net = require('net'),
- isIPv4 = net.isIPv4,
- isIPv6 = net.isIPv6;
-var util = require('util');
-
-var expected = 0,
- completed = 0,
- running = false,
- queue = [];
+const assert = require('assert');
+const dns = require('dns');
+const net = require('net');
+const isIPv4 = net.isIPv4;
+const isIPv6 = net.isIPv6;
+const util = require('util');
+
+let expected = 0;
+let completed = 0;
+let running = false;
+const queue = [];
function TEST(f) {
diff --git a/test/parallel/test-bad-unicode.js b/test/parallel/test-bad-unicode.js
index d2ce9ef010..a4df4ed9ed 100644
--- a/test/parallel/test-bad-unicode.js
+++ b/test/parallel/test-bad-unicode.js
@@ -1,7 +1,7 @@
'use strict';
require('../common');
-var assert = require('assert'),
- exception = null;
+const assert = require('assert');
+let exception = null;
try {
eval('"\\uc/ef"');
diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js
index 1ca159b092..bb14f18a17 100644
--- a/test/parallel/test-buffer.js
+++ b/test/parallel/test-buffer.js
@@ -921,8 +921,8 @@ Buffer(Buffer(0), 0, 0);
// GH-5110
(function() {
- var buffer = new Buffer('test'),
- string = JSON.stringify(buffer);
+ const buffer = new Buffer('test');
+ const string = JSON.stringify(buffer);
assert.equal(string, '{"type":"Buffer","data":[116,101,115,116]}');
diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js
index b791d4164d..2d9805d687 100644
--- a/test/parallel/test-child-process-double-pipe.js
+++ b/test/parallel/test-child-process-double-pipe.js
@@ -1,9 +1,9 @@
'use strict';
-var common = require('../common');
-var assert = require('assert'),
- os = require('os'),
- util = require('util'),
- spawn = require('child_process').spawn;
+const common = require('../common');
+const assert = require('assert');
+const os = require('os');
+const util = require('util');
+const spawn = require('child_process').spawn;
// We're trying to reproduce:
// $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/
diff --git a/test/parallel/test-child-process-fork-and-spawn.js b/test/parallel/test-child-process-fork-and-spawn.js
index 5766dc865b..eb0e178575 100644
--- a/test/parallel/test-child-process-fork-and-spawn.js
+++ b/test/parallel/test-child-process-fork-and-spawn.js
@@ -6,18 +6,18 @@ var fork = require('child_process').fork;
// Fork, then spawn. The spawned process should not hang.
switch (process.argv[2] || '') {
-case '':
- fork(__filename, ['fork']).on('exit', checkExit);
- process.on('exit', haveExit);
- break;
-case 'fork':
- spawn(process.execPath, [__filename, 'spawn']).on('exit', checkExit);
- process.on('exit', haveExit);
- break;
-case 'spawn':
- break;
-default:
- assert(0);
+ case '':
+ fork(__filename, ['fork']).on('exit', checkExit);
+ process.on('exit', haveExit);
+ break;
+ case 'fork':
+ spawn(process.execPath, [__filename, 'spawn']).on('exit', checkExit);
+ process.on('exit', haveExit);
+ break;
+ case 'spawn':
+ break;
+ default:
+ assert(0);
}
var seenExit = false;
diff --git a/test/parallel/test-child-process-fork-close.js b/test/parallel/test-child-process-fork-close.js
index 5970cc4df0..cec3c88f0f 100644
--- a/test/parallel/test-child-process-fork-close.js
+++ b/test/parallel/test-child-process-fork-close.js
@@ -1,13 +1,13 @@
'use strict';
-var assert = require('assert'),
- common = require('../common'),
- fork = require('child_process').fork;
+const assert = require('assert');
+const common = require('../common');
+const fork = require('child_process').fork;
var cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
-var gotMessage = false,
- gotExit = false,
- gotClose = false;
+let gotMessage = false;
+let gotExit = false;
+let gotClose = false;
cp.on('message', function(message) {
assert(!gotMessage);
diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js
index 86cd6576c7..d1e3f3e5d8 100644
--- a/test/parallel/test-child-process-fork-dgram.js
+++ b/test/parallel/test-child-process-fork-dgram.js
@@ -69,7 +69,13 @@ if (process.argv[2] === 'child') {
var sendMessages = function() {
var timer = setInterval(function() {
- client.send(msg, 0, msg.length, common.PORT, '127.0.0.1', function(err) {
+ client.send(
+ msg,
+ 0,
+ msg.length,
+ common.PORT,
+ '127.0.0.1',
+ function(err) {
if (err) throw err;
}
);
diff --git a/test/parallel/test-child-process-fork-net2.js b/test/parallel/test-child-process-fork-net2.js
index dd89557b61..359b88f559 100644
--- a/test/parallel/test-child-process-fork-net2.js
+++ b/test/parallel/test-child-process-fork-net2.js
@@ -66,8 +66,8 @@ if (process.argv[2] === 'child') {
var server = net.createServer();
- var connected = 0,
- closed = 0;
+ let connected = 0;
+ let closed = 0;
server.on('connection', function(socket) {
switch (connected % 6) {
case 0:
diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js
index 15f59c8f37..d1db3a815f 100644
--- a/test/parallel/test-cli-eval.js
+++ b/test/parallel/test-cli-eval.js
@@ -5,11 +5,11 @@ if (module.parent) {
process.exit(42);
}
-var common = require('../common'),
- assert = require('assert'),
- child = require('child_process'),
- path = require('path'),
- nodejs = '"' + process.execPath + '"';
+const common = require('../common');
+const assert = require('assert');
+const child = require('child_process');
+const path = require('path');
+const nodejs = '"' + process.execPath + '"';
// replace \ by / because windows uses backslashes in paths, but they're still
diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js
index eb941e194b..ccb213f0df 100644
--- a/test/parallel/test-cluster-worker-exit.js
+++ b/test/parallel/test-cluster-worker-exit.js
@@ -24,23 +24,23 @@ if (cluster.isWorker) {
} else if (cluster.isMaster) {
var expected_results = {
- cluster_emitDisconnect: [1, "the cluster did not emit 'disconnect'"],
- cluster_emitExit: [1, "the cluster did not emit 'exit'"],
- cluster_exitCode: [EXIT_CODE, 'the cluster exited w/ incorrect exitCode'],
- cluster_signalCode: [null, '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: [EXIT_CODE, 'the worker exited w/ incorrect exitCode'],
- worker_signalCode: [null, 'the worker exited w/ incorrect signalCode']
+ cluster_emitDisconnect: [1, "the cluster did not emit 'disconnect'"],
+ cluster_emitExit: [1, "the cluster did not emit 'exit'"],
+ cluster_exitCode: [EXIT_CODE, 'the cluster exited w/ incorrect exitCode'],
+ cluster_signalCode: [null, '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: [EXIT_CODE, 'the worker exited w/ incorrect exitCode'],
+ worker_signalCode: [null, 'the worker exited w/ incorrect signalCode']
};
var results = {
- cluster_emitDisconnect: 0,
- cluster_emitExit: 0,
- worker_emitDisconnect: 0,
- worker_emitExit: 0
+ cluster_emitDisconnect: 0,
+ cluster_emitExit: 0,
+ worker_emitDisconnect: 0,
+ worker_emitExit: 0
};
@@ -103,8 +103,8 @@ if (cluster.isWorker) {
function checkResults(expected_results, results) {
for (var k in expected_results) {
- var actual = results[k],
- expected = expected_results[k];
+ const actual = results[k];
+ const expected = expected_results[k];
var msg = (expected[1] || '') +
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js
index e12b466610..1ad9433f1a 100644
--- a/test/parallel/test-cluster-worker-kill.js
+++ b/test/parallel/test-cluster-worker-kill.js
@@ -103,8 +103,8 @@ if (cluster.isWorker) {
function checkResults(expected_results, results) {
for (var k in expected_results) {
- var actual = results[k],
- expected = expected_results[k];
+ const actual = results[k];
+ const expected = expected_results[k];
var msg = (expected[1] || '') +
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js
index d4cb7190e2..bc2011d3d8 100644
--- a/test/parallel/test-crypto-padding.js
+++ b/test/parallel/test-crypto-padding.js
@@ -15,11 +15,11 @@ crypto.DEFAULT_ENCODING = 'buffer';
* Input data
*/
-var ODD_LENGTH_PLAIN = 'Hello node world!',
- EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi';
+const ODD_LENGTH_PLAIN = 'Hello node world!';
+const EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi';
-var KEY_PLAIN = 'S3c.r.e.t.K.e.Y!',
- IV_PLAIN = 'blahFizz2011Buzz';
+const KEY_PLAIN = 'S3c.r.e.t.K.e.Y!';
+const IV_PLAIN = 'blahFizz2011Buzz';
var CIPHER_NAME = 'aes-128-cbc';
diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js
index f276e16172..bf0fc2ca1d 100644
--- a/test/parallel/test-crypto-stream.js
+++ b/test/parallel/test-crypto-stream.js
@@ -43,11 +43,11 @@ if (!common.hasFipsCrypto) {
}
// Decipher._flush() should emit an error event, not an exception.
-var key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex'),
- badkey = new Buffer('12341234123412341234123412341234', 'hex'),
- iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex'),
- cipher = crypto.createCipheriv('aes-128-cbc', key, iv),
- decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
+const key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex');
+const badkey = new Buffer('12341234123412341234123412341234', 'hex');
+const iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex');
+const cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
+const decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
cipher.pipe(decipher)
.on('error', common.mustCall(function end(err) {
diff --git a/test/parallel/test-dgram-bytes-length.js b/test/parallel/test-dgram-bytes-length.js
index c68b2fab70..6527f628d0 100644
--- a/test/parallel/test-dgram-bytes-length.js
+++ b/test/parallel/test-dgram-bytes-length.js
@@ -5,8 +5,14 @@ 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) {
- assert.strictEqual(bytes, message.length);
- client.close();
-});
+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.js b/test/parallel/test-dgram-close.js
index 7e9dd4ef52..a84a3bc19e 100644
--- a/test/parallel/test-dgram-close.js
+++ b/test/parallel/test-dgram-close.js
@@ -2,9 +2,9 @@
// Ensure that if a dgram socket is closed before the DNS lookup completes, it
// won't crash.
-var assert = require('assert'),
- common = require('../common'),
- dgram = require('dgram');
+const assert = require('assert');
+const common = require('../common');
+const dgram = require('dgram');
var buf = new Buffer(1024);
buf.fill(42);
diff --git a/test/parallel/test-dgram-multicast-setTTL.js b/test/parallel/test-dgram-multicast-setTTL.js
index f48fc7118e..7f641237c7 100644
--- a/test/parallel/test-dgram-multicast-setTTL.js
+++ b/test/parallel/test-dgram-multicast-setTTL.js
@@ -1,9 +1,9 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- dgram = require('dgram'),
- thrown = false,
- socket = dgram.createSocket('udp4');
+const common = require('../common');
+const assert = require('assert');
+const dgram = require('dgram');
+const socket = dgram.createSocket('udp4');
+let thrown = false;
socket.bind(common.PORT);
socket.on('listening', function() {
diff --git a/test/parallel/test-dgram-udp4.js b/test/parallel/test-dgram-udp4.js
index 58c8b69839..e845c5d845 100644
--- a/test/parallel/test-dgram-udp4.js
+++ b/test/parallel/test-dgram-udp4.js
@@ -1,11 +1,11 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var dgram = require('dgram'), server, client,
- server_port = common.PORT,
- message_to_send = 'A message to send',
- timer;
+const common = require('../common');
+const assert = require('assert');
+const dgram = require('dgram');
+const server_port = common.PORT;
+const message_to_send = 'A message to send';
+let server, client;
+let timer;
server = dgram.createSocket('udp4');
server.on('message', function(msg, rinfo) {
@@ -28,13 +28,19 @@ server.on('listening', function() {
client.close();
server.close();
});
- client.send(message_to_send, 0, message_to_send.length,
- server_port, 'localhost', function(err) {
- if (err) {
- console.log('Caught error in client send.');
- throw err;
- }
- });
+ client.send(
+ message_to_send,
+ 0,
+ message_to_send.length,
+ server_port,
+ 'localhost',
+ function(err) {
+ if (err) {
+ console.log('Caught error in client send.');
+ throw err;
+ }
+ }
+ );
client.on('close',
function() {
if (server.fd === null) {
diff --git a/test/parallel/test-domain-with-abort-on-uncaught-exception.js b/test/parallel/test-domain-with-abort-on-uncaught-exception.js
index 55133ba673..3165663479 100644
--- a/test/parallel/test-domain-with-abort-on-uncaught-exception.js
+++ b/test/parallel/test-domain-with-abort-on-uncaught-exception.js
@@ -140,24 +140,24 @@ if (process.argv[2] === 'child') {
}
testDomainExceptionHandling('--abort_on_uncaught_exception', {
- throwInDomainErrHandler: false,
- useTryCatch: false
- });
+ throwInDomainErrHandler: false,
+ useTryCatch: false
+ });
testDomainExceptionHandling('--abort_on_uncaught_exception', {
- throwInDomainErrHandler: false,
- useTryCatch: true
- });
+ throwInDomainErrHandler: false,
+ useTryCatch: true
+ });
testDomainExceptionHandling('--abort_on_uncaught_exception', {
- throwInDomainErrHandler: true,
- useTryCatch: false
- });
+ throwInDomainErrHandler: true,
+ useTryCatch: false
+ });
testDomainExceptionHandling('--abort_on_uncaught_exception', {
- throwInDomainErrHandler: true,
- useTryCatch: true
- });
+ throwInDomainErrHandler: true,
+ useTryCatch: true
+ });
testDomainExceptionHandling({
throwInDomainErrHandler: false
diff --git a/test/parallel/test-event-emitter-num-args.js b/test/parallel/test-event-emitter-num-args.js
index 51f57e89bc..e405b5b894 100644
--- a/test/parallel/test-event-emitter-num-args.js
+++ b/test/parallel/test-event-emitter-num-args.js
@@ -3,8 +3,8 @@ require('../common');
var assert = require('assert');
var events = require('events');
-var e = new events.EventEmitter(),
- num_args_emited = [];
+const e = new events.EventEmitter();
+const num_args_emited = [];
e.on('numArgs', function() {
var numArgs = arguments.length;
diff --git a/test/parallel/test-file-write-stream.js b/test/parallel/test-file-write-stream.js
index 36ef283528..b9d9fd76b8 100644
--- a/test/parallel/test-file-write-stream.js
+++ b/test/parallel/test-file-write-stream.js
@@ -7,50 +7,50 @@ var fs = require('fs');
var fn = path.join(common.tmpDir, 'write.txt');
common.refreshTmpDir();
var file = fs.createWriteStream(fn, {
- highWaterMark: 10
- });
+ highWaterMark: 10
+});
var EXPECTED = '012345678910';
var callbacks = {
- open: -1,
- drain: -2,
- close: -1
- };
+ open: -1,
+ drain: -2,
+ close: -1
+};
file
.on('open', function(fd) {
- console.error('open!');
- callbacks.open++;
- assert.equal('number', typeof fd);
- })
+ console.error('open!');
+ callbacks.open++;
+ assert.equal('number', typeof fd);
+ })
.on('error', function(err) {
- throw err;
- })
+ throw err;
+ })
.on('drain', function() {
- console.error('drain!', callbacks.drain);
- callbacks.drain++;
- if (callbacks.drain == -1) {
- assert.equal(EXPECTED, fs.readFileSync(fn, 'utf8'));
- file.write(EXPECTED);
- } else if (callbacks.drain == 0) {
- assert.equal(EXPECTED + EXPECTED, fs.readFileSync(fn, 'utf8'));
- file.end();
- }
- })
+ console.error('drain!', callbacks.drain);
+ callbacks.drain++;
+ if (callbacks.drain == -1) {
+ assert.equal(EXPECTED, fs.readFileSync(fn, 'utf8'));
+ file.write(EXPECTED);
+ } else if (callbacks.drain == 0) {
+ assert.equal(EXPECTED + EXPECTED, fs.readFileSync(fn, 'utf8'));
+ file.end();
+ }
+ })
.on('close', function() {
- console.error('close!');
- assert.strictEqual(file.bytesWritten, EXPECTED.length * 2);
+ console.error('close!');
+ assert.strictEqual(file.bytesWritten, EXPECTED.length * 2);
- callbacks.close++;
- assert.throws(function() {
- console.error('write after end should not be allowed');
- file.write('should not work anymore');
- });
-
- fs.unlinkSync(fn);
+ callbacks.close++;
+ assert.throws(function() {
+ console.error('write after end should not be allowed');
+ file.write('should not work anymore');
});
+ fs.unlinkSync(fn);
+ });
+
for (var i = 0; i < 11; i++) {
(function(i) {
file.write('' + i);
diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js
index c9473c26dd..490f258b8e 100644
--- a/test/parallel/test-file-write-stream3.js
+++ b/test/parallel/test-file-write-stream3.js
@@ -1,16 +1,15 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var path = require('path'),
- fs = require('fs');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
var filepath = path.join(common.tmpDir, 'write_pos.txt');
-var cb_expected = 'write open close write open close write open close ',
- cb_occurred = '';
+const cb_expected = 'write open close write open close write open close ';
+let cb_occurred = '';
var fileDataInitial = 'abcdefghijklmnopqrstuvwxyz';
@@ -126,8 +125,8 @@ function run_test_2() {
function run_test_3() {
var file, options;
- var data = '\u2026\u2026', // 3 bytes * 2 = 6 bytes in UTF-8
- fileData;
+ const data = '\u2026\u2026'; // 3 bytes * 2 = 6 bytes in UTF-8
+ let fileData;
options = { start: 10,
flags: 'r+' };
diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js
index 11c8bb6168..954916cbdb 100644
--- a/test/parallel/test-fs-chmod.js
+++ b/test/parallel/test-fs-chmod.js
@@ -51,8 +51,8 @@ if (common.isWindows) {
mode_sync = 0o644;
}
-var file1 = path.join(common.fixturesDir, 'a.js'),
- file2 = path.join(common.fixturesDir, 'a1.js');
+const file1 = path.join(common.fixturesDir, 'a.js');
+const file2 = path.join(common.fixturesDir, 'a1.js');
fs.chmod(file1, mode_async.toString(8), function(err) {
if (err) {
diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js
index ca0684c1d7..1a05ef80a4 100644
--- a/test/parallel/test-fs-error-messages.js
+++ b/test/parallel/test-fs-error-messages.js
@@ -1,14 +1,13 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var path = require('path'),
- fs = require('fs'),
- fn = path.join(common.fixturesDir, 'non-existent'),
- existingFile = path.join(common.fixturesDir, 'exit.js'),
- existingFile2 = path.join(common.fixturesDir, 'create-file.js'),
- existingDir = path.join(common.fixturesDir, 'empty'),
- existingDir2 = path.join(common.fixturesDir, 'keys');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
+const fn = path.join(common.fixturesDir, 'non-existent');
+const existingFile = path.join(common.fixturesDir, 'exit.js');
+const existingFile2 = path.join(common.fixturesDir, 'create-file.js');
+const existingDir = path.join(common.fixturesDir, 'empty');
+const existingDir2 = path.join(common.fixturesDir, 'keys');
// ASYNC_CALL
@@ -78,8 +77,8 @@ fs.readFile(fn, function(err) {
// Sync
-var errors = [],
- expected = 0;
+const errors = [];
+let expected = 0;
try {
++expected;
diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js
index 667abb8176..16b3d35cae 100644
--- a/test/parallel/test-fs-open-flags.js
+++ b/test/parallel/test-fs-open-flags.js
@@ -29,7 +29,8 @@ assert.equal(fs._stringToFlags('xa'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL);
assert.equal(fs._stringToFlags('ax+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
assert.equal(fs._stringToFlags('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
-('+ +a +r +w rw wa war raw r++ a++ w++' +
- 'x +x x+ rx rx+ wxx wax xwx xxx').split(' ').forEach(function(flags) {
- assert.throws(function() { fs._stringToFlags(flags); });
-});
+('+ +a +r +w rw wa war raw r++ a++ w++ x +x x+ rx rx+ wxx wax xwx xxx')
+ .split(' ')
+ .forEach(function(flags) {
+ assert.throws(function() { fs._stringToFlags(flags); });
+ });
diff --git a/test/parallel/test-fs-read-buffer.js b/test/parallel/test-fs-read-buffer.js
index 57a28d477c..6b6f0572da 100644
--- a/test/parallel/test-fs-read-buffer.js
+++ b/test/parallel/test-fs-read-buffer.js
@@ -1,15 +1,15 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-var path = require('path'),
- Buffer = require('buffer').Buffer,
- fs = require('fs'),
- filepath = path.join(common.fixturesDir, 'x.txt'),
- fd = fs.openSync(filepath, 'r'),
- expected = 'xyz\n',
- bufferAsync = new Buffer(expected.length),
- bufferSync = new Buffer(expected.length),
- readCalled = 0;
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const Buffer = require('buffer').Buffer;
+const fs = require('fs');
+const filepath = path.join(common.fixturesDir, 'x.txt');
+const fd = fs.openSync(filepath, 'r');
+const expected = 'xyz\n';
+const bufferAsync = new Buffer(expected.length);
+const bufferSync = new Buffer(expected.length);
+let readCalled = 0;
fs.read(fd, bufferAsync, 0, expected.length, 0, function(err, bytesRead) {
readCalled++;
diff --git a/test/parallel/test-fs-read.js b/test/parallel/test-fs-read.js
index 8b0b6fe0a3..6f20656e28 100644
--- a/test/parallel/test-fs-read.js
+++ b/test/parallel/test-fs-read.js
@@ -1,12 +1,12 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-var path = require('path'),
- fs = require('fs'),
- filepath = path.join(common.fixturesDir, 'x.txt'),
- fd = fs.openSync(filepath, 'r'),
- expected = 'xyz\n',
- readCalled = 0;
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
+const filepath = path.join(common.fixturesDir, 'x.txt');
+const fd = fs.openSync(filepath, 'r');
+const expected = 'xyz\n';
+let readCalled = 0;
fs.read(fd, expected.length, 0, 'utf-8', function(err, str, bytesRead) {
readCalled++;
diff --git a/test/parallel/test-fs-readfile-empty.js b/test/parallel/test-fs-readfile-empty.js
index 2669ce1ad6..afc0863673 100644
--- a/test/parallel/test-fs-readfile-empty.js
+++ b/test/parallel/test-fs-readfile-empty.js
@@ -1,10 +1,9 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var path = require('path'),
- fs = require('fs'),
- fn = path.join(common.fixturesDir, 'empty.txt');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
+const fn = path.join(common.fixturesDir, 'empty.txt');
fs.readFile(fn, function(err, data) {
assert.ok(data);
diff --git a/test/parallel/test-fs-readfile-fd.js b/test/parallel/test-fs-readfile-fd.js
index fc63d480ab..6420dbfdd0 100644
--- a/test/parallel/test-fs-readfile-fd.js
+++ b/test/parallel/test-fs-readfile-fd.js
@@ -1,10 +1,9 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var path = require('path'),
- fs = require('fs'),
- fn = path.join(common.fixturesDir, 'empty.txt');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
+const fn = path.join(common.fixturesDir, 'empty.txt');
tempFd(function(fd, close) {
fs.readFile(fd, function(err, data) {
diff --git a/test/parallel/test-fs-readfile-unlink.js b/test/parallel/test-fs-readfile-unlink.js
index 15491b71c4..dad993aa4f 100644
--- a/test/parallel/test-fs-readfile-unlink.js
+++ b/test/parallel/test-fs-readfile-unlink.js
@@ -1,10 +1,10 @@
'use strict';
-var assert = require('assert'),
- common = require('../common'),
- fs = require('fs'),
- path = require('path'),
- dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink'),
- fileName = path.resolve(dirName, 'test.bin');
+const assert = require('assert');
+const common = require('../common');
+const fs = require('fs');
+const path = require('path');
+const dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink');
+const fileName = path.resolve(dirName, 'test.bin');
var buf = new Buffer(512 * 1024);
buf.fill(42);
diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js
index 53312c6e8d..b18afac12d 100644
--- a/test/parallel/test-fs-realpath.js
+++ b/test/parallel/test-fs-realpath.js
@@ -85,8 +85,8 @@ function test_simple_relative_symlink(callback) {
console.log('1..0 # Skipped: symlink test (no privs)');
return runNextTest();
}
- var entry = common.tmpDir + '/symlink',
- expected = common.tmpDir + '/cycles/root.js';
+ const entry = common.tmpDir + '/symlink';
+ const expected = common.tmpDir + '/cycles/root.js';
[
[entry, '../' + common.tmpDirName + '/cycles/root.js']
].forEach(function(t) {
@@ -111,8 +111,8 @@ function test_simple_absolute_symlink(callback) {
console.log('using type=%s', type);
- var entry = tmpAbsDir + '/symlink',
- expected = common.fixturesDir + '/nested-index/one';
+ const entry = tmpAbsDir + '/symlink';
+ const expected = common.fixturesDir + '/nested-index/one';
[
[entry, expected]
].forEach(function(t) {
@@ -490,8 +490,8 @@ function test_lying_cache_liar(cb) {
});
assert(called === false);
- var test = path.resolve('/a/b/c/d'),
- expect = path.resolve('/a/b/d');
+ const test = path.resolve('/a/b/c/d');
+ const expect = path.resolve('/a/b/d');
var actual = fs.realpathSync(test, cache);
assert.equal(expect, actual);
fs.realpath(test, cache, function(er, actual) {
diff --git a/test/parallel/test-fs-write-buffer.js b/test/parallel/test-fs-write-buffer.js
index dace4a19a1..55ae8e2876 100644
--- a/test/parallel/test-fs-write-buffer.js
+++ b/test/parallel/test-fs-write-buffer.js
@@ -1,13 +1,13 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-var path = require('path'),
- Buffer = require('buffer').Buffer,
- fs = require('fs'),
- filename = path.join(common.tmpDir, 'write.txt'),
- expected = new Buffer('hello'),
- openCalled = 0,
- writeCalled = 0;
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const Buffer = require('buffer').Buffer;
+const fs = require('fs');
+const filename = path.join(common.tmpDir, 'write.txt');
+const expected = new Buffer('hello');
+let openCalled = 0;
+let writeCalled = 0;
common.refreshTmpDir();
diff --git a/test/parallel/test-fs-write-stream-change-open.js b/test/parallel/test-fs-write-stream-change-open.js
index a7503e1a60..a9d31a3074 100644
--- a/test/parallel/test-fs-write-stream-change-open.js
+++ b/test/parallel/test-fs-write-stream-change-open.js
@@ -1,17 +1,16 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var path = require('path'),
- fs = require('fs');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
var file = path.join(common.tmpDir, 'write.txt');
common.refreshTmpDir();
-var stream = fs.WriteStream(file),
- _fs_close = fs.close,
- _fs_open = fs.open;
+const stream = fs.WriteStream(file);
+const _fs_close = fs.close;
+const _fs_open = fs.open;
// change the fs.open with an identical function after the WriteStream
// has pushed it onto its internal action queue, but before it's
diff --git a/test/parallel/test-fs-write-stream.js b/test/parallel/test-fs-write-stream.js
index af3ae17ec7..5d29e60545 100644
--- a/test/parallel/test-fs-write-stream.js
+++ b/test/parallel/test-fs-write-stream.js
@@ -1,17 +1,16 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var path = require('path'),
- fs = require('fs');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const fs = require('fs');
var file = path.join(common.tmpDir, 'write.txt');
common.refreshTmpDir();
(function() {
- var stream = fs.WriteStream(file),
- _fs_close = fs.close;
+ const stream = fs.WriteStream(file);
+ const _fs_close = fs.close;
fs.close = function(fd) {
assert.ok(fd, 'fs.close must not be called without an undefined fd.');
diff --git a/test/parallel/test-global.js b/test/parallel/test-global.js
index 82d8ee054c..4eeecf36e0 100644
--- a/test/parallel/test-global.js
+++ b/test/parallel/test-global.js
@@ -11,8 +11,8 @@ assert.equal('foo', global.baseFoo, 'x -> global.x in base level not working');
assert.equal('bar', baseBar, 'global.x -> x in base level not working');
-var module = require('../fixtures/global/plain'),
- fooBar = module.fooBar;
+var module = require('../fixtures/global/plain');
+const fooBar = module.fooBar;
assert.equal('foo', fooBar.foo, 'x -> global.x in sub level not working');
diff --git a/test/parallel/test-http-abort-queued.js b/test/parallel/test-http-abort-queued.js
index f2b0120366..d28ad01888 100644
--- a/test/parallel/test-http-abort-queued.js
+++ b/test/parallel/test-http-abort-queued.js
@@ -1,7 +1,7 @@
'use strict';
-var assert = require('assert'),
- common = require('../common'),
- http = require('http');
+const assert = require('assert');
+const common = require('../common');
+const http = require('http');
var complete;
diff --git a/test/parallel/test-http-client-response-domain.js b/test/parallel/test-http-client-response-domain.js
index 5809d93aee..59b9514486 100644
--- a/test/parallel/test-http-client-response-domain.js
+++ b/test/parallel/test-http-client-response-domain.js
@@ -1,8 +1,8 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- http = require('http'),
- domain = require('domain');
+const common = require('../common');
+const assert = require('assert');
+const http = require('http');
+const domain = require('domain');
var gotDomainError = false;
var d;
diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js
index 809742f562..51bfb8299b 100644
--- a/test/parallel/test-http-client-timeout-agent.js
+++ b/test/parallel/test-http-client-timeout-agent.js
@@ -15,8 +15,8 @@ var options = {
//http.globalAgent.maxSockets = 15;
var server = http.createServer(function(req, res) {
- var m = /\/(.*)/.exec(req.url),
- reqid = parseInt(m[1], 10);
+ const m = /\/(.*)/.exec(req.url);
+ const reqid = parseInt(m[1], 10);
if ( reqid % 2 ) {
// do not reply the request
} else {
diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js
index e403b401fb..69d81e9b97 100644
--- a/test/parallel/test-http-default-port.js
+++ b/test/parallel/test-http-default-port.js
@@ -1,19 +1,19 @@
'use strict';
-var common = require('../common');
-var http = require('http'),
- PORT = common.PORT,
- SSLPORT = common.PORT + 1,
- assert = require('assert'),
- hostExpect = 'localhost',
- fs = require('fs'),
- path = require('path'),
- fixtures = path.resolve(__dirname, '../fixtures/keys'),
- options = {
- key: fs.readFileSync(fixtures + '/agent1-key.pem'),
- cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
- },
- gotHttpsResp = false,
- gotHttpResp = false;
+const common = require('../common');
+const http = require('http');
+const PORT = common.PORT;
+const SSLPORT = common.PORT + 1;
+const assert = require('assert');
+const hostExpect = 'localhost';
+const fs = require('fs');
+const path = require('path');
+const fixtures = path.resolve(__dirname, '../fixtures/keys');
+const options = {
+ key: fs.readFileSync(fixtures + '/agent1-key.pem'),
+ cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
+};
+let gotHttpsResp = false;
+let gotHttpResp = false;
if (common.hasCrypto) {
var https = require('https');
diff --git a/test/parallel/test-http-header-response-splitting.js b/test/parallel/test-http-header-response-splitting.js
index 437793a524..bb1da8ca7c 100644
--- a/test/parallel/test-http-header-response-splitting.js
+++ b/test/parallel/test-http-header-response-splitting.js
@@ -1,7 +1,7 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- http = require('http');
+const common = require('../common');
+const assert = require('assert');
+const http = require('http');
var testIndex = 0;
const testCount = 2 * 4 * 6;
@@ -10,24 +10,24 @@ const responseBody = 'Hi mars!';
var server = http.createServer(function(req, res) {
function reply(header) {
switch (testIndex % 4) {
- case 0:
- res.writeHead(200, { a: header, b: header });
- break;
- case 1:
- res.setHeader('a', header);
- res.setHeader('b', header);
- res.writeHead(200);
- break;
- case 2:
- res.setHeader('a', header);
- res.writeHead(200, { b: header });
- break;
- case 3:
- res.setHeader('a', [header]);
- res.writeHead(200, { b: header });
- break;
- default:
- assert.fail(null, null, 'unreachable');
+ case 0:
+ res.writeHead(200, { a: header, b: header });
+ break;
+ case 1:
+ res.setHeader('a', header);
+ res.setHeader('b', header);
+ res.writeHead(200);
+ break;
+ case 2:
+ res.setHeader('a', header);
+ res.writeHead(200, { b: header });
+ break;
+ case 3:
+ res.setHeader('a', [header]);
+ res.writeHead(200, { b: header });
+ break;
+ default:
+ assert.fail(null, null, 'unreachable');
}
res.write(responseBody);
if (testIndex % 8 < 4) {
diff --git a/test/parallel/test-http-host-headers.js b/test/parallel/test-http-host-headers.js
index b5c083dfdf..f121216801 100644
--- a/test/parallel/test-http-host-headers.js
+++ b/test/parallel/test-http-host-headers.js
@@ -1,8 +1,8 @@
'use strict';
-var http = require('http'),
- common = require('../common'),
- assert = require('assert'),
- httpServer = http.createServer(reqHandler);
+const http = require('http');
+const common = require('../common');
+const assert = require('assert');
+const httpServer = http.createServer(reqHandler);
function reqHandler(req, res) {
console.log('Got request: ' + req.headers.host + ' ' + req.url);
diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js
index ac5de82026..c7bb9f0301 100644
--- a/test/parallel/test-http-localaddress.js
+++ b/test/parallel/test-http-localaddress.js
@@ -1,7 +1,7 @@
'use strict';
-var common = require('../common');
-var http = require('http'),
- assert = require('assert');
+const common = require('../common');
+const http = require('http');
+const assert = require('assert');
if (!common.hasMultiLocalhost()) {
console.log('1..0 # Skipped: platform-specific test.');
diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js
index f10f3ac26b..17d5aa1d8f 100644
--- a/test/parallel/test-http-parser.js
+++ b/test/parallel/test-http-parser.js
@@ -333,8 +333,8 @@ function expectBody(expected) {
assert.equal(versionMinor, 1);
};
- var body_part = 0,
- body_parts = ['123', '123456', '1234567890'];
+ let body_part = 0;
+ const body_parts = ['123', '123456', '1234567890'];
var onBody = function(buf, start, len) {
var body = '' + buf.slice(start, start + len);
@@ -371,8 +371,8 @@ function expectBody(expected) {
assert.equal(versionMinor, 1);
};
- var body_part = 0,
- body_parts =
+ let body_part = 0;
+ const body_parts =
['123', '123456', '123456789', '123456789ABC', '123456789ABCDEF'];
var onBody = function(buf, start, len) {
diff --git a/test/parallel/test-http-timeout.js b/test/parallel/test-http-timeout.js
index f459961517..abaa368045 100644
--- a/test/parallel/test-http-timeout.js
+++ b/test/parallel/test-http-timeout.js
@@ -23,20 +23,22 @@ server.listen(port, function() {
var count = 0;
function createRequest() {
- var req = http.request({port: port, path: '/', agent: agent},
- function(res) {
- req.clearTimeout(callback);
-
- res.on('end', function() {
- count++;
-
- if (count == 11) {
- server.close();
- }
- });
-
- res.resume();
- });
+ const req = http.request(
+ {port: port, path: '/', agent: agent},
+ function(res) {
+ req.clearTimeout(callback);
+
+ res.on('end', function() {
+ count++;
+
+ if (count == 11) {
+ server.close();
+ }
+ });
+
+ res.resume();
+ }
+ );
req.setTimeout(1000, callback);
return req;
diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js
index 0ea32f320e..1e71fd5b9e 100644
--- a/test/parallel/test-https-host-headers.js
+++ b/test/parallel/test-https-host-headers.js
@@ -8,12 +8,12 @@ if (!common.hasCrypto) {
}
var https = require('https');
-var fs = require('fs'),
- options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
- },
- httpsServer = https.createServer(options, reqHandler);
+const fs = require('fs');
+const options = {
+ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+};
+const httpsServer = https.createServer(options, reqHandler);
function reqHandler(req, res) {
console.log('Got request: ' + req.headers.host + ' ' + req.url);
diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js
index a330c4881a..bce65d58e2 100644
--- a/test/parallel/test-https-localaddress.js
+++ b/test/parallel/test-https-localaddress.js
@@ -1,7 +1,7 @@
'use strict';
-var common = require('../common'),
- fs = require('fs'),
- assert = require('assert');
+const common = require('../common');
+const fs = require('fs');
+const assert = require('assert');
if (!common.hasCrypto) {
console.log('1..0 # Skipped: missing crypto');
diff --git a/test/parallel/test-net-listen-port-option.js b/test/parallel/test-net-listen-port-option.js
index fb568cf520..a2917e9508 100644
--- a/test/parallel/test-net-listen-port-option.js
+++ b/test/parallel/test-net-listen-port-option.js
@@ -14,7 +14,8 @@ net.Server().listen({ port: '' + common.PORT }, close);
1 / 0,
-1 / 0,
'+Infinity',
- '-Infinity' ].forEach(function(port) {
+ '-Infinity'
+].forEach(function(port) {
assert.throws(function() {
net.Server().listen({ port: port }, assert.fail);
}, /"port" option should be >= 0 and < 65536/i);
diff --git a/test/parallel/test-net-pause-resume-connecting.js b/test/parallel/test-net-pause-resume-connecting.js
index fb3b66c8cf..6be20cecb9 100644
--- a/test/parallel/test-net-pause-resume-connecting.js
+++ b/test/parallel/test-net-pause-resume-connecting.js
@@ -1,11 +1,11 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- net = require('net');
+const common = require('../common');
+const assert = require('assert');
+const net = require('net');
-var connections = 0,
- dataEvents = 0,
- conn;
+let connections = 0;
+let dataEvents = 0;
+let conn;
// Server
diff --git a/test/parallel/test-net-stream.js b/test/parallel/test-net-stream.js
index 151b1b178f..f2b795f931 100644
--- a/test/parallel/test-net-stream.js
+++ b/test/parallel/test-net-stream.js
@@ -38,14 +38,14 @@ var server = net.createServer(function(socket) {
socket.end();
}).listen(common.PORT, function() {
- var conn = net.connect(common.PORT);
- conn.on('data', function(buf) {
- conn.pause();
- setTimeout(function() {
- conn.destroy();
- }, 20);
- });
+ var conn = net.connect(common.PORT);
+ conn.on('data', function(buf) {
+ conn.pause();
+ setTimeout(function() {
+ conn.destroy();
+ }, 20);
});
+});
process.on('exit', function() {
assert.equal(server.connections, 0);
diff --git a/test/parallel/test-next-tick-errors.js b/test/parallel/test-next-tick-errors.js
index 6b854e8237..074bdc0f9f 100644
--- a/test/parallel/test-next-tick-errors.js
+++ b/test/parallel/test-next-tick-errors.js
@@ -2,8 +2,8 @@
require('../common');
var assert = require('assert');
-var order = [],
- exceptionHandled = false;
+const order = [];
+let exceptionHandled = false;
// This nextTick function will throw an error. It should only be called once.
// When it throws an error, it should still get removed from the queue.
diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js
index af1d993ffd..a28444cd3b 100644
--- a/test/parallel/test-path-parse-format.js
+++ b/test/parallel/test-path-parse-format.js
@@ -86,7 +86,7 @@ function checkErrors(path) {
errors.forEach(function(errorCase) {
try {
path[errorCase.method].apply(path, errorCase.input);
- } catch(err) {
+ } catch (err) {
assert.ok(err instanceof TypeError);
assert.ok(
errorCase.message.test(err.message),
diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js
index f30ad1d218..f94a7eae94 100644
--- a/test/parallel/test-preload.js
+++ b/test/parallel/test-preload.js
@@ -1,8 +1,8 @@
'use strict';
require('../common');
-var assert = require('assert'),
- path = require('path'),
- child_process = require('child_process');
+const assert = require('assert');
+const path = require('path');
+const child_process = require('child_process');
var nodeBinary = process.argv[0];
diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js
index 5e7739daa5..8345096445 100644
--- a/test/parallel/test-promises-unhandled-rejections.js
+++ b/test/parallel/test-promises-unhandled-rejections.js
@@ -234,23 +234,27 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' +
var promise2;
});
-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(common.fail, function() {});
-});
-
-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(common.fail, function() {});
-});
+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(common.fail, function() {});
+ }
+);
+
+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(common.fail, function() {});
+ }
+);
asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
' prevent unhandledRejection', function(done) {
@@ -360,19 +364,21 @@ asyncTest('A rejected promise derived from throwing in a fulfillment handler' +
});
});
-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) {
- assert.strictEqual(e, reason);
- assert.strictEqual(_promise, promise);
- });
- _promise = Promise.resolve().then(function() {
- return Promise.reject(e);
- });
-});
+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) {
+ assert.strictEqual(e, reason);
+ assert.strictEqual(_promise, promise);
+ });
+ _promise = Promise.resolve().then(function() {
+ return Promise.reject(e);
+ });
+ }
+);
// Combinations with Promise.all
asyncTest('Catching the Promise.all() of a collection that includes a' +
@@ -382,21 +388,23 @@ asyncTest('Catching the Promise.all() of a collection that includes a' +
Promise.all([Promise.reject(e)]).then(common.fail, function()Ā {});
});
-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) {
+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) {
+ process.nextTick(function() {
+ reject(e);
+ });
+ });
+ p = Promise.all([p]);
process.nextTick(function() {
- reject(e);
+ p.then(common.fail, function()Ā {});
});
- });
- p = Promise.all([p]);
- process.nextTick(function() {
- p.then(common.fail, function()Ā {});
- });
-});
+ }
+);
asyncTest('Failing to catch the Promise.all() of a collection that includes' +
' a rejected promise triggers unhandledRejection for the returned' +
@@ -513,26 +521,28 @@ asyncTest('Waiting for some combination of promise microtasks + ' +
});
});
-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);
+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);
- setImmediate(function() {
- var a = Promise.reject(e);
- Promise.resolve().then(function() {
- process.nextTick(function() {
- Promise.resolve().then(function() {
- process.nextTick(function() {
- a.catch(function()Ā {});
+ setImmediate(function() {
+ var a = Promise.reject(e);
+ Promise.resolve().then(function() {
+ process.nextTick(function() {
+ Promise.resolve().then(function() {
+ process.nextTick(function() {
+ a.catch(function()Ā {});
+ });
});
});
});
});
- });
-});
+ }
+);
asyncTest('Waiting for some combination of promise microtasks +' +
' process.nextTick to attach a catch handler is still soon enough' +
@@ -612,28 +622,30 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch' +
});
});
-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) {
- domainReceivedError = e;
- });
- d.run(function() {
- var e = new Error('error');
- var domainError = new Error('domain error');
- onUnhandledSucceed(done, function(reason, promise) {
- assert.strictEqual(reason, e);
- assert.strictEqual(domainReceivedError, domainError);
- d.dispose();
+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) {
+ domainReceivedError = e;
});
- Promise.reject(e);
- process.nextTick(function() {
- throw domainError;
+ d.run(function() {
+ var e = new Error('error');
+ var domainError = new Error('domain error');
+ onUnhandledSucceed(done, function(reason, promise) {
+ assert.strictEqual(reason, e);
+ assert.strictEqual(domainReceivedError, domainError);
+ d.dispose();
+ });
+ Promise.reject(e);
+ process.nextTick(function() {
+ throw domainError;
+ });
});
- });
-});
+ }
+);
asyncTest('nextTick is immediately scheduled when called inside an event' +
' handler', function(done) {
diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js
index bb3c361f88..f30d0a3cb2 100644
--- a/test/parallel/test-querystring.js
+++ b/test/parallel/test-querystring.js
@@ -182,12 +182,11 @@ assert.equal(
// Test removing limit
function testUnlimitedKeys() {
- var query = {},
- url;
+ const query = {};
for (var i = 0; i < 2000; i++) query[i] = i;
- url = qs.stringify(query);
+ const url = qs.stringify(query);
assert.equal(
Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length,
diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js
index 0c0340e037..3ea34a00d1 100644
--- a/test/parallel/test-readline-interface.js
+++ b/test/parallel/test-readline-interface.js
@@ -259,7 +259,7 @@ function isWarned(emitter) {
});
try {
fi.emit('data', 'fooX');
- } catch(e) { }
+ } catch (e) { }
fi.emit('data', 'bar');
assert.equal(keys.join(''), 'fooXbar');
rli.close();
diff --git a/test/parallel/test-regress-GH-7511.js b/test/parallel/test-regress-GH-7511.js
index 03813dea00..6194da291c 100644
--- a/test/parallel/test-regress-GH-7511.js
+++ b/test/parallel/test-regress-GH-7511.js
@@ -1,7 +1,7 @@
'use strict';
require('../common');
-var assert = require('assert'),
- vm = require('vm');
+const assert = require('assert');
+const vm = require('vm');
assert.doesNotThrow(function() {
var context = vm.createContext({ process: process });
diff --git a/test/parallel/test-repl-console.js b/test/parallel/test-repl-console.js
index fe737d841e..609822703f 100644
--- a/test/parallel/test-repl-console.js
+++ b/test/parallel/test-repl-console.js
@@ -1,7 +1,7 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- repl = require('repl');
+const common = require('../common');
+const assert = require('assert');
+const repl = require('repl');
// Create a dummy stream that does nothing
const stream = new common.ArrayStream();
diff --git a/test/parallel/test-repl-definecommand.js b/test/parallel/test-repl-definecommand.js
index a28689a55d..c0e1b3269a 100644
--- a/test/parallel/test-repl-definecommand.js
+++ b/test/parallel/test-repl-definecommand.js
@@ -2,9 +2,9 @@
require('../common');
-const stream = require('stream'),
- assert = require('assert'),
- repl = require('repl');
+const stream = require('stream');
+const assert = require('assert');
+const repl = require('repl');
var output = '';
const inputStream = new stream.PassThrough();
diff --git a/test/parallel/test-repl-end-emits-exit.js b/test/parallel/test-repl-end-emits-exit.js
index 2c18b413d6..7f2c4b9eb2 100644
--- a/test/parallel/test-repl-end-emits-exit.js
+++ b/test/parallel/test-repl-end-emits-exit.js
@@ -1,9 +1,9 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- repl = require('repl'),
- terminalExit = 0,
- regularExit = 0;
+const common = require('../common');
+const assert = require('assert');
+const repl = require('repl');
+let terminalExit = 0;
+let regularExit = 0;
// Create a dummy stream that does nothing
const stream = new common.ArrayStream();
diff --git a/test/parallel/test-repl-envvars.js b/test/parallel/test-repl-envvars.js
index 2c34bbf2da..759b4e15a1 100644
--- a/test/parallel/test-repl-envvars.js
+++ b/test/parallel/test-repl-envvars.js
@@ -8,30 +8,32 @@ const REPL = require('internal/repl');
const assert = require('assert');
const inspect = require('util').inspect;
-const tests = [{
- env: {},
- expected: { terminal: true, useColors: true }
-},
-{
- env: { NODE_DISABLE_COLORS: '1' },
- expected: { terminal: true, useColors: false }
-},
-{
- env: { NODE_NO_READLINE: '1' },
- expected: { terminal: false, useColors: false }
-},
-{
- env: { TERM: 'dumb' },
- expected: { terminal: true, useColors: false }
-},
-{
- env: { NODE_NO_READLINE: '1', NODE_DISABLE_COLORS: '1' },
- expected: { terminal: false, useColors: false }
-},
-{
- env: { NODE_NO_READLINE: '0' },
- expected: { terminal: true, useColors: true }
-}];
+const tests = [
+ {
+ env: {},
+ expected: { terminal: true, useColors: true }
+ },
+ {
+ env: { NODE_DISABLE_COLORS: '1' },
+ expected: { terminal: true, useColors: false }
+ },
+ {
+ env: { NODE_NO_READLINE: '1' },
+ expected: { terminal: false, useColors: false }
+ },
+ {
+ env: { TERM: 'dumb' },
+ expected: { terminal: true, useColors: false }
+ },
+ {
+ env: { NODE_NO_READLINE: '1', NODE_DISABLE_COLORS: '1' },
+ expected: { terminal: false, useColors: false }
+ },
+ {
+ env: { NODE_NO_READLINE: '0' },
+ expected: { terminal: true, useColors: true }
+ }
+];
function run(test) {
const env = test.env;
diff --git a/test/parallel/test-repl-options.js b/test/parallel/test-repl-options.js
index ec3b144ec0..395cd3e367 100644
--- a/test/parallel/test-repl-options.js
+++ b/test/parallel/test-repl-options.js
@@ -1,7 +1,7 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- repl = require('repl');
+const common = require('../common');
+const assert = require('assert');
+const repl = require('repl');
common.globalCheck = false;
diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js
index 7571527b73..81e728974f 100644
--- a/test/parallel/test-repl-persistent-history.js
+++ b/test/parallel/test-repl-persistent-history.js
@@ -79,107 +79,109 @@ const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
-const tests = [{
- env: { NODE_REPL_HISTORY: '' },
- test: [UP],
- expected: [prompt, replDisabled, prompt]
-},
-{
- env: { NODE_REPL_HISTORY: '',
- NODE_REPL_HISTORY_FILE: enoentHistoryPath },
- test: [UP],
- expected: [prompt, replDisabled, prompt]
-},
-{
- env: { NODE_REPL_HISTORY: '',
- NODE_REPL_HISTORY_FILE: oldHistoryPath },
- test: [UP],
- expected: [prompt, replDisabled, prompt]
-},
-{
- env: { NODE_REPL_HISTORY_FILE: emptyHistoryPath },
- test: [UP],
- expected: [prompt, convertMsg, prompt]
-},
-{
- env: { NODE_REPL_HISTORY_FILE: defaultHistoryPath },
- test: [UP],
- expected: [prompt, sameHistoryFilePaths, prompt]
-},
-{
- env: { NODE_REPL_HISTORY: historyPath },
- test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
-},
-{
- env: { NODE_REPL_HISTORY: historyPath,
- NODE_REPL_HISTORY_FILE: oldHistoryPath },
- test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
-},
-{
- env: { NODE_REPL_HISTORY: historyPath,
- NODE_REPL_HISTORY_FILE: '' },
- test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
-},
-{
- env: {},
- test: [UP],
- expected: [prompt]
-},
-{
- env: { NODE_REPL_HISTORY_FILE: oldHistoryPath },
- test: [UP, CLEAR, '\'42\'', ENTER],
- expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt, '\'',
- '4', '2', '\'', '\'42\'\n', prompt, prompt],
- after: function ensureHistoryFixture() {
- // XXX(Fishrock123) Make sure nothing weird happened to our fixture
- // or it's temporary copy.
- // Sometimes this test used to erase the fixture and I'm not sure why.
- const history = fs.readFileSync(historyFixturePath, 'utf8');
- assert.strictEqual(history,
- '\'you look fabulous today\'\n\'Stay Fresh~\'\n');
- const historyCopy = fs.readFileSync(historyPath, 'utf8');
- assert.strictEqual(historyCopy, '\'you look fabulous today\'' + os.EOL +
- '\'Stay Fresh~\'' + os.EOL);
- }
-},
-{ // Requires the above testcase
- env: {},
- test: [UP, UP, ENTER],
- expected: [prompt, prompt + '\'42\'', prompt + '\'=^.^=\'', '\'=^.^=\'\n',
- prompt]
-},
-{
- env: { NODE_REPL_HISTORY: historyPath,
- NODE_REPL_HISTORY_SIZE: 1 },
- test: [UP, UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
-},
-{
- env: { NODE_REPL_HISTORY_FILE: oldHistoryPath,
- NODE_REPL_HISTORY_SIZE: 1 },
- test: [UP, UP, UP, CLEAR],
- expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt]
-},
-{
- env: { NODE_REPL_HISTORY: historyPathFail,
- NODE_REPL_HISTORY_SIZE: 1 },
- test: [UP],
- expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
-},
-{ // Make sure this is always the last test, since we change os.homedir()
- before: function mockHomedirFailure() {
- // Mock os.homedir() failure
- os.homedir = function() {
- throw new Error('os.homedir() failure');
- };
+const tests = [
+ {
+ env: { NODE_REPL_HISTORY: '' },
+ test: [UP],
+ expected: [prompt, replDisabled, prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: '',
+ NODE_REPL_HISTORY_FILE: enoentHistoryPath },
+ test: [UP],
+ expected: [prompt, replDisabled, prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: '',
+ NODE_REPL_HISTORY_FILE: oldHistoryPath },
+ test: [UP],
+ expected: [prompt, replDisabled, prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY_FILE: emptyHistoryPath },
+ test: [UP],
+ expected: [prompt, convertMsg, prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY_FILE: defaultHistoryPath },
+ test: [UP],
+ expected: [prompt, sameHistoryFilePaths, prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: historyPath },
+ test: [UP, CLEAR],
+ expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: historyPath,
+ NODE_REPL_HISTORY_FILE: oldHistoryPath },
+ test: [UP, CLEAR],
+ expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: historyPath,
+ NODE_REPL_HISTORY_FILE: '' },
+ test: [UP, CLEAR],
+ expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
},
- env: {},
- test: [UP],
- expected: [prompt, homedirErr, prompt, replDisabled, prompt]
-}];
+ {
+ env: {},
+ test: [UP],
+ expected: [prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY_FILE: oldHistoryPath },
+ test: [UP, CLEAR, '\'42\'', ENTER],
+ expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt, '\'',
+ '4', '2', '\'', '\'42\'\n', prompt, prompt],
+ after: function ensureHistoryFixture() {
+ // XXX(Fishrock123) Make sure nothing weird happened to our fixture
+ // or it's temporary copy.
+ // Sometimes this test used to erase the fixture and I'm not sure why.
+ const history = fs.readFileSync(historyFixturePath, 'utf8');
+ assert.strictEqual(history,
+ '\'you look fabulous today\'\n\'Stay Fresh~\'\n');
+ const historyCopy = fs.readFileSync(historyPath, 'utf8');
+ assert.strictEqual(historyCopy, '\'you look fabulous today\'' + os.EOL +
+ '\'Stay Fresh~\'' + os.EOL);
+ }
+ },
+ { // Requires the above testcase
+ env: {},
+ test: [UP, UP, ENTER],
+ expected: [prompt, prompt + '\'42\'', prompt + '\'=^.^=\'', '\'=^.^=\'\n',
+ prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: historyPath,
+ NODE_REPL_HISTORY_SIZE: 1 },
+ test: [UP, UP, CLEAR],
+ expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY_FILE: oldHistoryPath,
+ NODE_REPL_HISTORY_SIZE: 1 },
+ test: [UP, UP, UP, CLEAR],
+ expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt]
+ },
+ {
+ env: { NODE_REPL_HISTORY: historyPathFail,
+ NODE_REPL_HISTORY_SIZE: 1 },
+ test: [UP],
+ expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
+ },
+ { // Make sure this is always the last test, since we change os.homedir()
+ before: function mockHomedirFailure() {
+ // Mock os.homedir() failure
+ os.homedir = function() {
+ throw new Error('os.homedir() failure');
+ };
+ },
+ env: {},
+ test: [UP],
+ expected: [prompt, homedirErr, prompt, replDisabled, prompt]
+ }
+];
const numtests = tests.length;
diff --git a/test/parallel/test-repl-require-cache.js b/test/parallel/test-repl-require-cache.js
index c5f317ac26..8a5d384935 100644
--- a/test/parallel/test-repl-require-cache.js
+++ b/test/parallel/test-repl-require-cache.js
@@ -1,7 +1,7 @@
'use strict';
require('../common');
-var assert = require('assert'),
- repl = require('repl');
+const assert = require('assert');
+const repl = require('repl');
// https://github.com/joyent/node/issues/3226
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index cda4e9886f..d9e69cd614 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -5,17 +5,17 @@ var assert = require('assert');
common.globalCheck = false;
common.refreshTmpDir();
-var net = require('net'),
- repl = require('repl'),
- message = 'Read, Eval, Print Loop',
- prompt_unix = 'node via Unix socket> ',
- prompt_tcp = 'node via TCP socket> ',
- prompt_multiline = '... ',
- prompt_npm = 'npm should be run outside of the ' +
- 'node repl, in your normal shell.\n' +
- '(Press Control-D to exit.)\n',
- expect_npm = prompt_npm + prompt_unix,
- server_tcp, server_unix, client_tcp, client_unix, timer;
+const net = require('net');
+const repl = require('repl');
+const message = 'Read, Eval, Print Loop';
+const prompt_unix = 'node via Unix socket> ';
+const prompt_tcp = 'node via TCP socket> ';
+const prompt_multiline = '... ';
+const prompt_npm = 'npm should be run outside of the ' +
+ 'node repl, in your normal shell.\n' +
+ '(Press Control-D to exit.)\n';
+const expect_npm = prompt_npm + prompt_unix;
+var server_tcp, server_unix, client_tcp, client_unix, timer;
// absolute path to test/fixtures/a.js
diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js
index bcd8256272..dc37a8a1f6 100644
--- a/test/parallel/test-signal-handler.js
+++ b/test/parallel/test-signal-handler.js
@@ -10,8 +10,8 @@ if (common.isWindows) {
console.log('process.pid: ' + process.pid);
-var first = 0,
- second = 0;
+let first = 0;
+let second = 0;
var sighup = false;
diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js
index 5b07dd1119..2aa992b4a9 100644
--- a/test/parallel/test-stream-writev.js
+++ b/test/parallel/test-stream-writev.js
@@ -44,24 +44,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: 'utf8', chunk: 'world' },
- { encoding: 'buffer', chunk: [33] },
- { encoding: 'binary', chunk: '\nand then...' },
- { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
- ];
+ [
+ { 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' }
+ ];
var actualChunks;
w._writev = function(chunks, cb) {
diff --git a/test/parallel/test-stringbytes-external-at-max.js b/test/parallel/test-stringbytes-external-at-max.js
index 31f476d66b..5467d05a20 100644
--- a/test/parallel/test-stringbytes-external-at-max.js
+++ b/test/parallel/test-stringbytes-external-at-max.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/parallel/test-timers-immediate.js b/test/parallel/test-timers-immediate.js
index 9486465602..40e91a0998 100644
--- a/test/parallel/test-timers-immediate.js
+++ b/test/parallel/test-timers-immediate.js
@@ -2,15 +2,15 @@
require('../common');
var assert = require('assert');
-var immediateA = false,
- immediateB = false,
- immediateC = [],
- before;
+let immediateA = false;
+let immediateB = false;
+let immediateC = [];
+let before;
setImmediate(function() {
try {
immediateA = process.hrtime(before);
- } catch(e) {
+ } catch (e) {
console.log('failed to get hrtime with offset');
}
clearImmediate(immediateB);
diff --git a/test/parallel/test-timers-this.js b/test/parallel/test-timers-this.js
index 1882f116fe..e21167581e 100644
--- a/test/parallel/test-timers-this.js
+++ b/test/parallel/test-timers-this.js
@@ -2,8 +2,8 @@
require('../common');
var assert = require('assert');
-var immediateThis, intervalThis, timeoutThis,
- immediateArgsThis, intervalArgsThis, timeoutArgsThis;
+let immediateThis, intervalThis, timeoutThis;
+let immediateArgsThis, intervalArgsThis, timeoutArgsThis;
var immediateHandler = setImmediate(function() {
immediateThis = this;
diff --git a/test/parallel/test-timers-unref.js b/test/parallel/test-timers-unref.js
index 671c676e35..134b2ffe4c 100644
--- a/test/parallel/test-timers-unref.js
+++ b/test/parallel/test-timers-unref.js
@@ -2,12 +2,12 @@
require('../common');
var assert = require('assert');
-var interval_fired = false,
- timeout_fired = false,
- unref_interval = false,
- unref_timer = false,
- unref_callbacks = 0,
- interval, check_unref, checks = 0;
+let interval_fired = false;
+let timeout_fired = false;
+let unref_interval = false;
+let unref_timer = false;
+let unref_callbacks = 0;
+let interval, check_unref, checks = 0;
var LONG_TIME = 10 * 1000;
var SHORT_TIME = 100;
diff --git a/test/parallel/test-tls-connect-no-host.js b/test/parallel/test-tls-connect-no-host.js
index 75870bea98..a6ead6ea6d 100644
--- a/test/parallel/test-tls-connect-no-host.js
+++ b/test/parallel/test-tls-connect-no-host.js
@@ -23,12 +23,12 @@ tls.createServer({
}).listen(common.PORT);
var socket = tls.connect({
- port: common.PORT,
- ca: cert,
- // No host set here. 'localhost' is the default,
- // but tls.checkServerIdentity() breaks before the fix with:
- // Error: Hostname/IP doesn't match certificate's altnames:
- // "Host: undefined. is not cert's CN: localhost"
+ port: common.PORT,
+ ca: cert,
+ // No host set here. 'localhost' is the default,
+ // but tls.checkServerIdentity() breaks before the fix with:
+ // Error: Hostname/IP doesn't match certificate's altnames:
+ // "Host: undefined. is not cert's CN: localhost"
}, function() {
assert(socket.authorized);
process.exit();
diff --git a/test/parallel/test-tls-connect-stream-writes.js b/test/parallel/test-tls-connect-stream-writes.js
index 4187c9b439..8fabc7edae 100644
--- a/test/parallel/test-tls-connect-stream-writes.js
+++ b/test/parallel/test-tls-connect-stream-writes.js
@@ -1,16 +1,15 @@
'use strict';
-var assert = require('assert'),
- fs = require('fs'),
- path = require('path'),
- tls = require('tls'),
- stream = require('stream'),
- net = require('net');
-
-var common = require('../common');
+const common = require('../common');
+const assert = require('assert');
+const fs = require('fs');
+const path = require('path');
+const tls = require('tls');
+const stream = require('stream');
+const net = require('net');
var server;
-var cert_dir = path.resolve(__dirname, '../fixtures'),
- options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
+var cert_dir = path.resolve(__dirname, '../fixtures');
+var options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
ciphers: 'AES256-GCM-SHA384' };
diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js
index 0a0453633a..211cfc7ed3 100644
--- a/test/parallel/test-tls-npn-server-client.js
+++ b/test/parallel/test-tls-npn-server-client.js
@@ -5,9 +5,9 @@ if (!process.features.tls_npn) {
return;
}
-var common = require('../common'),
- assert = require('assert'),
- fs = require('fs');
+const common = require('../common');
+const assert = require('assert');
+const fs = require('fs');
if (!common.hasCrypto) {
console.log('1..0 # Skipped: missing crypto');
@@ -69,8 +69,8 @@ var clientsOptions = [{
rejectUnauthorized: false
}];
-var serverResults = [],
- clientsResults = [];
+const serverResults = [];
+const clientsResults = [];
var server = tls.createServer(serverOptions, function(c) {
serverResults.push(c.npnProtocol);
diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js
index fed77357da..c9d4d263f5 100644
--- a/test/parallel/test-tls-server-verify.js
+++ b/test/parallel/test-tls-server-verify.js
@@ -87,15 +87,14 @@ var testCases =
renegotiate: false,
CAs: ['ca2-cert'],
crl: 'ca2-crl',
- clients:
- [
+ clients: [
{ name: 'agent1', shouldReject: true, shouldAuth: false },
{ name: 'agent2', shouldReject: true, shouldAuth: false },
{ name: 'agent3', shouldReject: false, shouldAuth: true },
// Agent4 has a cert in the CRL.
{ name: 'agent4', shouldReject: true, shouldAuth: false },
{ name: 'nocert', shouldReject: true }
- ]
+ ]
}
];
diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js
index cbd46c46fe..1f69a4cc51 100644
--- a/test/parallel/test-tls-sni-option.js
+++ b/test/parallel/test-tls-sni-option.js
@@ -5,9 +5,9 @@ if (!process.features.tls_sni) {
return;
}
-var common = require('../common'),
- assert = require('assert'),
- fs = require('fs');
+const common = require('../common');
+const assert = require('assert');
+const fs = require('fs');
if (!common.hasCrypto) {
console.log('1..0 # Skipped: missing crypto');
@@ -99,12 +99,12 @@ var clientsOptions = [{
rejectUnauthorized: false
}];
-var serverResults = [],
- clientResults = [],
- serverErrors = [],
- clientErrors = [],
- serverError,
- clientError;
+const serverResults = [];
+const clientResults = [];
+const serverErrors = [];
+const clientErrors = [];
+let serverError;
+let clientError;
var server = tls.createServer(serverOptions, function(c) {
serverResults.push({ sni: c.servername, authorized: c.authorized });
diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js
index bad5e10878..8eb80b50e4 100644
--- a/test/parallel/test-tls-sni-server-client.js
+++ b/test/parallel/test-tls-sni-server-client.js
@@ -5,9 +5,9 @@ if (!process.features.tls_sni) {
return;
}
-var common = require('../common'),
- assert = require('assert'),
- fs = require('fs');
+const common = require('../common');
+const assert = require('assert');
+const fs = require('fs');
if (!common.hasCrypto) {
console.log('1..0 # Skipped: missing crypto');
@@ -73,8 +73,8 @@ var clientsOptions = [{
rejectUnauthorized: false
}];
-var serverResults = [],
- clientResults = [];
+const serverResults = [];
+const clientResults = [];
var server = tls.createServer(serverOptions, function(c) {
serverResults.push(c.servername);
diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js
index cd097be243..9fa087261e 100644
--- a/test/parallel/test-url.js
+++ b/test/parallel/test-url.js
@@ -260,19 +260,19 @@ var parseTests = {
},
'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=':
- {
- 'href': 'http://user:pass@mt0.google.com/vt/lyrs=m@114???' +
- '&hl=en&src=api&x=2&y=2&z=3&s=',
- 'protocol': 'http:',
- 'slashes': true,
- 'host': 'mt0.google.com',
- 'auth': 'user:pass',
- 'hostname': 'mt0.google.com',
- 'search': '???&hl=en&src=api&x=2&y=2&z=3&s=',
- 'query': '??&hl=en&src=api&x=2&y=2&z=3&s=',
- 'pathname': '/vt/lyrs=m@114',
- 'path': '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
- },
+ {
+ 'href': 'http://user:pass@mt0.google.com/vt/lyrs=m@114???' +
+ '&hl=en&src=api&x=2&y=2&z=3&s=',
+ 'protocol': 'http:',
+ 'slashes': true,
+ 'host': 'mt0.google.com',
+ 'auth': 'user:pass',
+ 'hostname': 'mt0.google.com',
+ 'search': '???&hl=en&src=api&x=2&y=2&z=3&s=',
+ 'query': '??&hl=en&src=api&x=2&y=2&z=3&s=',
+ 'pathname': '/vt/lyrs=m@114',
+ 'path': '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
+ },
'file:///etc/passwd' : {
'href': 'file:///etc/passwd',
@@ -870,8 +870,8 @@ for (var u in parseTests) {
assert.deepEqual(actual, expected);
assert.deepEqual(spaced, expected);
- var expected = parseTests[u].href,
- actual = url.format(parseTests[u]);
+ expected = parseTests[u].href;
+ actual = url.format(parseTests[u]);
assert.equal(actual, expected,
'format(' + u + ') == ' + u + '\nactual:' + actual);
@@ -1194,8 +1194,8 @@ var relativeTests = [
['http://localhost', 'file://foo/Users', 'file://foo/Users']
];
relativeTests.forEach(function(relativeTest) {
- var a = url.resolve(relativeTest[0], relativeTest[1]),
- e = relativeTest[2];
+ const a = url.resolve(relativeTest[0], relativeTest[1]);
+ const e = relativeTest[2];
assert.equal(a, e,
'resolve(' + [relativeTest[0], relativeTest[1]] + ') == ' + e +
'\n actual=' + a);
@@ -1504,8 +1504,8 @@ var relativeTests2 = [
'http://diff:auth@www.example.com/']
];
relativeTests2.forEach(function(relativeTest) {
- var a = url.resolve(relativeTest[1], relativeTest[0]),
- e = relativeTest[2];
+ const a = url.resolve(relativeTest[1], relativeTest[0]);
+ const e = relativeTest[2];
assert.equal(a, e,
'resolve(' + [relativeTest[1], relativeTest[0]] + ') == ' + e +
'\n actual=' + a);
@@ -1516,8 +1516,8 @@ relativeTests2.forEach(function(relativeTest) {
//format: [from, path, expected]
relativeTests.forEach(function(relativeTest) {
- var actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]),
- expected = url.parse(relativeTest[2]);
+ var actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]);
+ var expected = url.parse(relativeTest[2]);
assert.deepEqual(actual, expected);
@@ -1544,13 +1544,13 @@ if (relativeTests2[181][0] === './/g' &&
relativeTests2.splice(181, 1);
}
relativeTests2.forEach(function(relativeTest) {
- var actual = url.resolveObject(url.parse(relativeTest[1]), relativeTest[0]),
- expected = url.parse(relativeTest[2]);
+ var actual = url.resolveObject(url.parse(relativeTest[1]), relativeTest[0]);
+ var expected = url.parse(relativeTest[2]);
assert.deepEqual(actual, expected);
- var expected = relativeTest[2],
- actual = url.format(actual);
+ expected = relativeTest[2];
+ actual = url.format(actual);
assert.equal(actual, expected,
'format(' + relativeTest[1] + ') == ' + expected +
diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js
index fbea5e5a31..b9e3d9ce35 100644
--- a/test/parallel/test-util-log.js
+++ b/test/parallel/test-util-log.js
@@ -28,9 +28,9 @@ var tests = [
// test util.log()
tests.forEach(function(test) {
util.log(test.input);
- var result = strings.shift().trim(),
- re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/),
- match = re.exec(result);
+ const result = strings.shift().trim();
+ const re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/);
+ const match = re.exec(result);
assert.ok(match);
assert.equal(match[1], test.output);
});
diff --git a/test/parallel/test-zlib-flush.js b/test/parallel/test-zlib-flush.js
index 6281b8eb21..69f734617e 100644
--- a/test/parallel/test-zlib-flush.js
+++ b/test/parallel/test-zlib-flush.js
@@ -5,18 +5,18 @@ var zlib = require('zlib');
var path = require('path');
var fs = require('fs');
-var file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg')),
- chunkSize = 16,
- opts = { level: 0 },
- deflater = zlib.createDeflate(opts);
+const file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg'));
+const chunkSize = 16;
+const opts = { level: 0 };
+const deflater = zlib.createDeflate(opts);
-var chunk = file.slice(0, chunkSize),
- expectedNone = new Buffer([0x78, 0x01]),
- blkhdr = new Buffer([0x00, 0x10, 0x00, 0xef, 0xff]),
- adler32 = new Buffer([0x00, 0x00, 0x00, 0xff, 0xff]),
- expectedFull = Buffer.concat([blkhdr, chunk, adler32]),
- actualNone,
- actualFull;
+const chunk = file.slice(0, chunkSize);
+const expectedNone = new Buffer([0x78, 0x01]);
+const blkhdr = new Buffer([0x00, 0x10, 0x00, 0xef, 0xff]);
+const adler32 = new Buffer([0x00, 0x00, 0x00, 0xff, 0xff]);
+const expectedFull = Buffer.concat([blkhdr, chunk, adler32]);
+let actualNone;
+let actualFull;
deflater.write(chunk, function() {
deflater.flush(zlib.Z_NO_FLUSH, function() {
diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js
index 9850c6078c..91d4efd388 100644
--- a/test/parallel/test-zlib-invalid-input.js
+++ b/test/parallel/test-zlib-invalid-input.js
@@ -2,8 +2,8 @@
// test uncompressing invalid input
require('../common');
-var assert = require('assert'),
- zlib = require('zlib');
+const assert = require('assert');
+const zlib = require('zlib');
var nonStringInputs = [1, true, {a: 1}, ['a']];
diff --git a/test/parallel/test-zlib-params.js b/test/parallel/test-zlib-params.js
index f349c8dbd0..4e02b7bdb9 100644
--- a/test/parallel/test-zlib-params.js
+++ b/test/parallel/test-zlib-params.js
@@ -5,16 +5,16 @@ var zlib = require('zlib');
var path = require('path');
var fs = require('fs');
-var file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg')),
- chunkSize = 24 * 1024,
- opts = { level: 9, strategy: zlib.Z_DEFAULT_STRATEGY },
- deflater = zlib.createDeflate(opts);
+const file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg'));
+const chunkSize = 24 * 1024;
+const opts = { level: 9, strategy: zlib.Z_DEFAULT_STRATEGY };
+const deflater = zlib.createDeflate(opts);
-var chunk1 = file.slice(0, chunkSize),
- chunk2 = file.slice(chunkSize),
- blkhdr = new Buffer([0x00, 0x48, 0x82, 0xb7, 0x7d]),
- expected = Buffer.concat([blkhdr, chunk2]),
- actual;
+const chunk1 = file.slice(0, chunkSize);
+const chunk2 = file.slice(chunkSize);
+const blkhdr = new Buffer([0x00, 0x48, 0x82, 0xb7, 0x7d]);
+const expected = Buffer.concat([blkhdr, chunk2]);
+let actual;
deflater.write(chunk1, function() {
deflater.params(0, zlib.Z_DEFAULT_STRATEGY, function() {
diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js
index 6fdd416b18..e6b2f82bd9 100644
--- a/test/pummel/test-dh-regr.js
+++ b/test/pummel/test-dh-regr.js
@@ -11,8 +11,8 @@ var crypto = require('crypto');
var p = crypto.createDiffieHellman(1024).getPrime();
for (var i = 0; i < 2000; i++) {
- var a = crypto.createDiffieHellman(p),
- b = crypto.createDiffieHellman(p);
+ const a = crypto.createDiffieHellman(p);
+ const b = crypto.createDiffieHellman(p);
a.generateKeys();
b.generateKeys();
diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js
index 0ff1e2a7cf..994d859f40 100644
--- a/test/pummel/test-exec.js
+++ b/test/pummel/test-exec.js
@@ -17,19 +17,21 @@ var success_count = 0;
var error_count = 0;
-exec('"' + process.execPath + '" -p -e process.versions',
- function(err, stdout, stderr) {
- if (err) {
- error_count++;
- console.log('error!: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
- assert.equal(false, err.killed);
- } else {
- success_count++;
- console.dir(stdout);
+exec(
+ '"' + process.execPath + '" -p -e process.versions',
+ function(err, stdout, stderr) {
+ if (err) {
+ error_count++;
+ console.log('error!: ' + err.code);
+ console.log('stdout: ' + JSON.stringify(stdout));
+ console.log('stderr: ' + JSON.stringify(stderr));
+ assert.equal(false, err.killed);
+ } else {
+ success_count++;
+ console.dir(stdout);
+ }
}
-});
+);
exec('thisisnotavalidcommand', function(err, stdout, stderr) {
diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js
index cd4b16bf31..c21785f233 100644
--- a/test/pummel/test-fs-watch-file-slow.js
+++ b/test/pummel/test-fs-watch-file-slow.js
@@ -19,19 +19,19 @@ catch (e) {
fs.watchFile(FILENAME, {interval:TIMEOUT - 250}, function(curr, prev) {
console.log([curr, prev]);
switch (++nevents) {
- case 1:
- assert.equal(common.fileExists(FILENAME), false);
- break;
- case 2:
- case 3:
- assert.equal(common.fileExists(FILENAME), true);
- break;
- case 4:
- assert.equal(common.fileExists(FILENAME), false);
- fs.unwatchFile(FILENAME);
- break;
- default:
- assert(0);
+ case 1:
+ assert.equal(common.fileExists(FILENAME), false);
+ break;
+ case 2:
+ case 3:
+ assert.equal(common.fileExists(FILENAME), true);
+ break;
+ case 4:
+ assert.equal(common.fileExists(FILENAME), false);
+ fs.unwatchFile(FILENAME);
+ break;
+ default:
+ assert(0);
}
});
diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js
index 12a6fecc70..7b9b8b0da1 100644
--- a/test/pummel/test-http-client-reconnect-bug.js
+++ b/test/pummel/test-http-client-reconnect-bug.js
@@ -1,9 +1,8 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var net = require('net'),
- http = require('http');
+const common = require('../common');
+const assert = require('assert');
+const net = require('net');
+const http = require('http');
var errorCount = 0;
var eofCount = 0;
diff --git a/test/pummel/test-http-upload-timeout.js b/test/pummel/test-http-upload-timeout.js
index d1be5311db..6e5a7ed050 100644
--- a/test/pummel/test-http-upload-timeout.js
+++ b/test/pummel/test-http-upload-timeout.js
@@ -2,10 +2,10 @@
// 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.
-var common = require('../common'),
- http = require('http'),
- server = http.createServer(),
- connections = 0;
+const common = require('../common');
+const http = require('http');
+const server = http.createServer();
+let connections = 0;
server.on('request', function(req, res) {
req.socket.setTimeout(1000);
diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js
index 205485c9eb..784f2faf8c 100644
--- a/test/sequential/test-child-process-execsync.js
+++ b/test/sequential/test-child-process-execsync.js
@@ -12,8 +12,7 @@ var start = Date.now();
var err;
var caught = false;
-try
-{
+try {
var cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
var ret = execSync(cmd, {timeout: TIMER});
} catch (e) {
diff --git a/test/sequential/test-dgram-pingpong.js b/test/sequential/test-dgram-pingpong.js
index 883085a9cd..63d001d0b3 100644
--- a/test/sequential/test-dgram-pingpong.js
+++ b/test/sequential/test-dgram-pingpong.js
@@ -34,8 +34,8 @@ function pingPongTest(port, host) {
server.on('listening', function() {
console.log('server listening on ' + port + ' ' + host);
- var buf = new Buffer('PING'),
- client = dgram.createSocket('udp4');
+ const buf = new Buffer('PING');
+ const client = dgram.createSocket('udp4');
client.on('message', function(msg, rinfo) {
if (debug) console.log('client got: ' + msg +
diff --git a/test/sequential/test-init.js b/test/sequential/test-init.js
index f68c001f64..6bb727ea1f 100644
--- a/test/sequential/test-init.js
+++ b/test/sequential/test-init.js
@@ -1,9 +1,9 @@
'use strict';
(function() {
- var assert = require('assert'),
- child = require('child_process'),
- util = require('util'),
- common = require('../common');
+ const assert = require('assert');
+ const child = require('child_process');
+ const util = require('util');
+ const common = require('../common');
if (process.env['TEST_INIT']) {
util.print('Loaded successfully!');
} else {
diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js
index 43e667fa93..3e4101f8e2 100644
--- a/test/sequential/test-module-loading.js
+++ b/test/sequential/test-module-loading.js
@@ -57,14 +57,14 @@ assert.equal('D', d4.D());
assert.ok((new a.SomeClass()) instanceof c.SomeClass);
console.error('test index.js modules ids and relative loading');
-var one = require('../fixtures/nested-index/one'),
- two = require('../fixtures/nested-index/two');
+const one = require('../fixtures/nested-index/one');
+const two = require('../fixtures/nested-index/two');
assert.notEqual(one.hello, two.hello);
console.error('test index.js in a folder with a trailing slash');
-var three = require('../fixtures/nested-index/three'),
- threeFolder = require('../fixtures/nested-index/three/'),
- threeIndex = require('../fixtures/nested-index/three/index.js');
+const three = require('../fixtures/nested-index/three');
+const threeFolder = require('../fixtures/nested-index/three/');
+const threeIndex = require('../fixtures/nested-index/three/index.js');
assert.equal(threeFolder, threeIndex);
assert.notEqual(threeFolder, three);
@@ -75,8 +75,8 @@ assert.equal(require('../fixtures/packages/main-index').ok, 'ok',
'Failed loading package with index.js in main subdir');
console.error('test cycles containing a .. path');
-var root = require('../fixtures/cycles/root'),
- foo = require('../fixtures/cycles/folder/foo');
+const root = require('../fixtures/cycles/root');
+const foo = require('../fixtures/cycles/folder/foo');
assert.equal(root.foo, foo);
assert.equal(root.sayHello(), root.hello);
@@ -137,8 +137,8 @@ try {
// Check load order is as expected
console.error('load order');
-var loadOrder = '../fixtures/module-load-order/',
- msg = 'Load order incorrect.';
+const loadOrder = '../fixtures/module-load-order/';
+const msg = 'Load order incorrect.';
require.extensions['.reg'] = require.extensions['.js'];
require.extensions['.reg2'] = require.extensions['.js'];
diff --git a/test/sequential/test-regress-GH-1697.js b/test/sequential/test-regress-GH-1697.js
index ba7f90ecf0..bafd389fa8 100644
--- a/test/sequential/test-regress-GH-1697.js
+++ b/test/sequential/test-regress-GH-1697.js
@@ -1,7 +1,7 @@
'use strict';
-var common = require('../common');
-var net = require('net'),
- cp = require('child_process');
+const common = require('../common');
+const net = require('net');
+const cp = require('child_process');
if (process.argv[2] === 'server') {
// Server
@@ -30,8 +30,8 @@ if (process.argv[2] === 'server') {
serverProcess.stdout.once('data', function() {
var client = net.createConnection(common.PORT, '127.0.0.1');
client.on('connect', function() {
- var alot = new Buffer(1024),
- alittle = new Buffer(1);
+ const alot = new Buffer(1024);
+ const alittle = new Buffer(1);
for (var i = 0; i < 100; i++) {
client.write(alot);
diff --git a/test/sequential/test-regress-GH-3542.js b/test/sequential/test-regress-GH-3542.js
index 2025645ae7..77b8cdd698 100644
--- a/test/sequential/test-regress-GH-3542.js
+++ b/test/sequential/test-regress-GH-3542.js
@@ -1,9 +1,9 @@
'use strict';
-var common = require('../common'),
- assert = require('assert'),
- fs = require('fs'),
- path = require('path'),
- succeeded = 0;
+const common = require('../common');
+const assert = require('assert');
+const fs = require('fs');
+const path = require('path');
+let succeeded = 0;
// This test is only relevant on Windows.
if (!common.isWindows) {
diff --git a/test/sequential/test-stringbytes-external-exceed-max-by-1-ascii.js b/test/sequential/test-stringbytes-external-exceed-max-by-1-ascii.js
index 46590cd492..008bc8cbc0 100644
--- a/test/sequential/test-stringbytes-external-exceed-max-by-1-ascii.js
+++ b/test/sequential/test-stringbytes-external-exceed-max-by-1-ascii.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/sequential/test-stringbytes-external-exceed-max-by-1-base64.js b/test/sequential/test-stringbytes-external-exceed-max-by-1-base64.js
index 905f4ac973..537c084ee0 100644
--- a/test/sequential/test-stringbytes-external-exceed-max-by-1-base64.js
+++ b/test/sequential/test-stringbytes-external-exceed-max-by-1-base64.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/sequential/test-stringbytes-external-exceed-max-by-1-binary.js b/test/sequential/test-stringbytes-external-exceed-max-by-1-binary.js
index 9564af08de..f91f1f49ff 100644
--- a/test/sequential/test-stringbytes-external-exceed-max-by-1-binary.js
+++ b/test/sequential/test-stringbytes-external-exceed-max-by-1-binary.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/sequential/test-stringbytes-external-exceed-max-by-1-hex.js b/test/sequential/test-stringbytes-external-exceed-max-by-1-hex.js
index 1ca75403c2..dc0719b0b2 100644
--- a/test/sequential/test-stringbytes-external-exceed-max-by-1-hex.js
+++ b/test/sequential/test-stringbytes-external-exceed-max-by-1-hex.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/sequential/test-stringbytes-external-exceed-max-by-1-utf8.js b/test/sequential/test-stringbytes-external-exceed-max-by-1-utf8.js
index 5e4bca5c9a..4028a94466 100644
--- a/test/sequential/test-stringbytes-external-exceed-max-by-1-utf8.js
+++ b/test/sequential/test-stringbytes-external-exceed-max-by-1-utf8.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/sequential/test-stringbytes-external-exceed-max-by-2.js b/test/sequential/test-stringbytes-external-exceed-max-by-2.js
index 8350c4532e..1ac5a5c7fe 100644
--- a/test/sequential/test-stringbytes-external-exceed-max-by-2.js
+++ b/test/sequential/test-stringbytes-external-exceed-max-by-2.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);
diff --git a/test/sequential/test-stringbytes-external-exceed-max.js b/test/sequential/test-stringbytes-external-exceed-max.js
index 33bc2eaee7..173a2022a7 100644
--- a/test/sequential/test-stringbytes-external-exceed-max.js
+++ b/test/sequential/test-stringbytes-external-exceed-max.js
@@ -21,7 +21,7 @@ try {
// Try to allocate memory first then force gc so future allocations succeed.
new Buffer(2 * kStringMaxLength);
gc();
-} catch(e) {
+} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
console.log(skipMessage);