diff --git a/.eslintrc b/.eslintrc index 59f9f06e8baa0d..ffb768217805b9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -57,6 +57,7 @@ rules: comma-spacing: 2 eol-last: 2 indent: [2, 2, {SwitchCase: 1}] + key-spacing: [2, {mode: "minimum"}] keyword-spacing: 2 max-len: [2, 80, 2] new-parens: 2 diff --git a/benchmark/path/format.js b/benchmark/path/format.js index 478a30cbaedbd2..6c6f2106dd3fb7 100644 --- a/benchmark/path/format.js +++ b/benchmark/path/format.js @@ -18,11 +18,11 @@ function main(conf) { ext: '.html', name: 'index' } : { - root : '/', - dir : '/home/user/dir', - base : 'index.html', - ext : '.html', - name : 'index' + root: '/', + dir: '/home/user/dir', + base: 'index.html', + ext: '.html', + name: 'index' }; // Force optimization before starting the benchmark diff --git a/lib/_http_server.js b/lib/_http_server.js index 399f9d49e1d4b0..827c9c346cb708 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -16,67 +16,67 @@ const httpSocketSetup = common.httpSocketSetup; const OutgoingMessage = require('_http_outgoing').OutgoingMessage; const STATUS_CODES = exports.STATUS_CODES = { - 100 : 'Continue', - 101 : 'Switching Protocols', - 102 : 'Processing', // RFC 2518, obsoleted by RFC 4918 - 200 : 'OK', - 201 : 'Created', - 202 : 'Accepted', - 203 : 'Non-Authoritative Information', - 204 : 'No Content', - 205 : 'Reset Content', - 206 : 'Partial Content', - 207 : 'Multi-Status', // RFC 4918 - 208 : 'Already Reported', - 226 : 'IM Used', - 300 : 'Multiple Choices', - 301 : 'Moved Permanently', - 302 : 'Found', - 303 : 'See Other', - 304 : 'Not Modified', - 305 : 'Use Proxy', - 307 : 'Temporary Redirect', - 308 : 'Permanent Redirect', // RFC 7238 - 400 : 'Bad Request', - 401 : 'Unauthorized', - 402 : 'Payment Required', - 403 : 'Forbidden', - 404 : 'Not Found', - 405 : 'Method Not Allowed', - 406 : 'Not Acceptable', - 407 : 'Proxy Authentication Required', - 408 : 'Request Timeout', - 409 : 'Conflict', - 410 : 'Gone', - 411 : 'Length Required', - 412 : 'Precondition Failed', - 413 : 'Payload Too Large', - 414 : 'URI Too Long', - 415 : 'Unsupported Media Type', - 416 : 'Range Not Satisfiable', - 417 : 'Expectation Failed', - 418 : 'I\'m a teapot', // RFC 2324 - 421 : 'Misdirected Request', - 422 : 'Unprocessable Entity', // RFC 4918 - 423 : 'Locked', // RFC 4918 - 424 : 'Failed Dependency', // RFC 4918 - 425 : 'Unordered Collection', // RFC 4918 - 426 : 'Upgrade Required', // RFC 2817 - 428 : 'Precondition Required', // RFC 6585 - 429 : 'Too Many Requests', // RFC 6585 - 431 : 'Request Header Fields Too Large', // RFC 6585 - 500 : 'Internal Server Error', - 501 : 'Not Implemented', - 502 : 'Bad Gateway', - 503 : 'Service Unavailable', - 504 : 'Gateway Timeout', - 505 : 'HTTP Version Not Supported', - 506 : 'Variant Also Negotiates', // RFC 2295 - 507 : 'Insufficient Storage', // RFC 4918 - 508 : 'Loop Detected', - 509 : 'Bandwidth Limit Exceeded', - 510 : 'Not Extended', // RFC 2774 - 511 : 'Network Authentication Required' // RFC 6585 + 100: 'Continue', + 101: 'Switching Protocols', + 102: 'Processing', // RFC 2518, obsoleted by RFC 4918 + 200: 'OK', + 201: 'Created', + 202: 'Accepted', + 203: 'Non-Authoritative Information', + 204: 'No Content', + 205: 'Reset Content', + 206: 'Partial Content', + 207: 'Multi-Status', // RFC 4918 + 208: 'Already Reported', + 226: 'IM Used', + 300: 'Multiple Choices', + 301: 'Moved Permanently', + 302: 'Found', + 303: 'See Other', + 304: 'Not Modified', + 305: 'Use Proxy', + 307: 'Temporary Redirect', + 308: 'Permanent Redirect', // RFC 7238 + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Payload Too Large', + 414: 'URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Range Not Satisfiable', + 417: 'Expectation Failed', + 418: 'I\'m a teapot', // RFC 2324 + 421: 'Misdirected Request', + 422: 'Unprocessable Entity', // RFC 4918 + 423: 'Locked', // RFC 4918 + 424: 'Failed Dependency', // RFC 4918 + 425: 'Unordered Collection', // RFC 4918 + 426: 'Upgrade Required', // RFC 2817 + 428: 'Precondition Required', // RFC 6585 + 429: 'Too Many Requests', // RFC 6585 + 431: 'Request Header Fields Too Large', // RFC 6585 + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 506: 'Variant Also Negotiates', // RFC 2295 + 507: 'Insufficient Storage', // RFC 4918 + 508: 'Loop Detected', + 509: 'Bandwidth Limit Exceeded', + 510: 'Not Extended', // RFC 2774 + 511: 'Network Authentication Required' // RFC 6585 }; const kOnExecute = HTTPParser.kOnExecute | 0; diff --git a/lib/util.js b/lib/util.js index 79fdb33326ebc9..cd643c3120714a 100644 --- a/lib/util.js +++ b/lib/util.js @@ -147,19 +147,19 @@ exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] + 'bold': [1, 22], + 'italic': [3, 23], + 'underline': [4, 24], + 'inverse': [7, 27], + 'white': [37, 39], + 'grey': [90, 39], + 'black': [30, 39], + 'blue': [34, 39], + 'cyan': [36, 39], + 'green': [32, 39], + 'magenta': [35, 39], + 'red': [31, 39], + 'yellow': [33, 39] }; // Don't use 'blue' not visible on cmd.exe diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js index f57fcd94752871..79cf4ce3c3ed47 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -17,7 +17,7 @@ var testData = [ 'source': 'foo', 'modules': [ { 'textRaw': 'Sample Markdown', 'name': 'sample_markdown', - 'modules': [ { 'textRaw':'Seussian Rhymes', + 'modules': [ { 'textRaw': 'Seussian Rhymes', 'name': 'seussian_rhymes', 'desc': '
    \n
  1. fish
  2. \n
  3. fish

    \n
  4. \n
  5. ' + '

    Red fish

    \n
  6. \n
  7. Blue fish
  8. \n
\n', @@ -32,7 +32,7 @@ var testData = [ { 'file': common.fixturesDir + '/order_of_end_tags_5873.md', 'json': { - 'source':'foo', + 'source': 'foo', 'modules': [ { 'textRaw': 'Title', 'name': 'title', @@ -41,8 +41,8 @@ var testData = [ 'name': 'subsection', 'classMethods': [ { 'textRaw': 'Class Method: Buffer.from(array)', - 'type':'classMethod', - 'name':'from', + 'type': 'classMethod', + 'name': 'from', 'signatures': [ { 'params': [ { 'textRaw': '`array` {Array} ', @@ -51,7 +51,7 @@ var testData = [ } ] }, { - 'params' : [ { + 'params': [ { 'name': 'array' } ] } diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index 5f908442339e03..a396bda8cd3350 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -37,8 +37,8 @@ console.log(custom_inspect); // test console.dir() console.dir(custom_inspect); console.dir(custom_inspect, { showHidden: false }); -console.dir({ foo : { bar : { baz : true } } }, { depth: 0 }); -console.dir({ foo : { bar : { baz : true } } }, { depth: 1 }); +console.dir({ foo: { bar: { baz: true } } }, { depth: 0 }); +console.dir({ foo: { bar: { baz: true } } }, { depth: 1 }); // test console.trace() console.trace('This is a %j %d', { formatted: 'trace' }, 10, 'foo'); diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 129bbcacef151e..da29d690645683 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -30,19 +30,19 @@ var rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem', // PFX tests assert.doesNotThrow(function() { - tls.createSecureContext({pfx:certPfx, passphrase:'sample'}); + tls.createSecureContext({pfx: certPfx, passphrase: 'sample'}); }); assert.throws(function() { - tls.createSecureContext({pfx:certPfx}); + tls.createSecureContext({pfx: certPfx}); }, 'mac verify failure'); assert.throws(function() { - tls.createSecureContext({pfx:certPfx, passphrase:'test'}); + tls.createSecureContext({pfx: certPfx, passphrase: 'test'}); }, 'mac verify failure'); assert.throws(function() { - tls.createSecureContext({pfx:'sample', passphrase:'test'}); + tls.createSecureContext({pfx: 'sample', passphrase: 'test'}); }, 'not enough data'); // Test HMAC diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 271541d54a242d..bf87900875b7c4 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -32,19 +32,19 @@ assert.throws(function() { // PFX tests assert.doesNotThrow(function() { - tls.createSecureContext({pfx:certPfx, passphrase:'sample'}); + tls.createSecureContext({pfx: certPfx, passphrase: 'sample'}); }); assert.throws(function() { - tls.createSecureContext({pfx:certPfx}); + tls.createSecureContext({pfx: certPfx}); }, 'mac verify failure'); assert.throws(function() { - tls.createSecureContext({pfx:certPfx, passphrase:'test'}); + tls.createSecureContext({pfx: certPfx, passphrase: 'test'}); }, 'mac verify failure'); assert.throws(function() { - tls.createSecureContext({pfx:'sample', passphrase:'test'}); + tls.createSecureContext({pfx: 'sample', passphrase: 'test'}); }, 'not enough data'); diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index 37dbc30f4234d7..594c34aae8d201 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -20,7 +20,7 @@ var server = http.createServer(function(req, res) { serverCaught++; console.log('horray! got a server error', er); // try to send a 500. If that fails, oh well. - res.writeHead(500, {'content-type':'text/plain'}); + res.writeHead(500, {'content-type': 'text/plain'}); res.end(er.stack || er.message || 'Unknown error'); }); diff --git a/test/parallel/test-domain-top-level-error-handler-throw.js b/test/parallel/test-domain-top-level-error-handler-throw.js index 4bde30d17cb8c8..7933c5d052fe11 100644 --- a/test/parallel/test-domain-top-level-error-handler-throw.js +++ b/test/parallel/test-domain-top-level-error-handler-throw.js @@ -29,7 +29,7 @@ if (process.argv[2] === 'child') { var fork = require('child_process').fork; var assert = require('assert'); - var child = fork(process.argv[1], ['child'], {silent:true}); + var child = fork(process.argv[1], ['child'], {silent: true}); var stderrOutput = ''; if (child) { child.stderr.on('data', function onStderrData(data) { diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index d627c01487c2c2..46fbbd85877a81 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -464,12 +464,12 @@ function test_lying_cache_liar(cb) { // this should not require *any* stat calls, since everything // checked by realpath will be found in the cache. console.log('test_lying_cache_liar'); - var cache = { '/foo/bar/baz/bluff' : '/foo/bar/bluff', - '/1/2/3/4/5/6/7' : '/1', - '/a' : '/a', - '/a/b' : '/a/b', - '/a/b/c' : '/a/b', - '/a/b/d' : '/a/b/d' }; + var cache = { '/foo/bar/baz/bluff': '/foo/bar/bluff', + '/1/2/3/4/5/6/7': '/1', + '/a': '/a', + '/a/b': '/a/b', + '/a/b/c': '/a/b', + '/a/b/d': '/a/b/d' }; if (common.isWindows) { var wc = {}; Object.keys(cache).forEach(function(k) { diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js index 26df0b95e29572..23ec2d0263fa94 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -11,7 +11,7 @@ if (process.argv[2] === 'request') { const http = require('http'); const options = { port: common.PORT, - path : '/' + path: '/' }; http.get(options, (res) => { diff --git a/test/parallel/test-http-client-pipe-end.js b/test/parallel/test-http-client-pipe-end.js index 715f8ccf79df92..5b2db49435a1b6 100644 --- a/test/parallel/test-http-client-pipe-end.js +++ b/test/parallel/test-http-client-pipe-end.js @@ -18,7 +18,7 @@ common.refreshTmpDir(); server.listen(common.PIPE, function() { var req = http.request({ socketPath: common.PIPE, - headers: {'Content-Length':'1'}, + headers: {'Content-Length': '1'}, method: 'POST', path: '/' }); diff --git a/test/parallel/test-http-client-reject-chunked-with-content-length.js b/test/parallel/test-http-client-reject-chunked-with-content-length.js index a6639c90690da3..400a1d0ddbb991 100644 --- a/test/parallel/test-http-client-reject-chunked-with-content-length.js +++ b/test/parallel/test-http-client-reject-chunked-with-content-length.js @@ -17,7 +17,7 @@ server.listen(common.PORT, () => { // The callback should not be called because the server is sending // both a Content-Length header and a Transfer-Encoding: chunked // header, which is a violation of the HTTP spec. - const req = http.get({port:common.PORT}, (res) => { + const req = http.get({port: common.PORT}, (res) => { assert.fail(null, null, 'callback should not be called'); }); req.on('error', common.mustCall((err) => { diff --git a/test/parallel/test-http-client-reject-cr-no-lf.js b/test/parallel/test-http-client-reject-cr-no-lf.js index b60220cbb629b3..350d7f40e95b9b 100644 --- a/test/parallel/test-http-client-reject-cr-no-lf.js +++ b/test/parallel/test-http-client-reject-cr-no-lf.js @@ -16,7 +16,7 @@ const server = net.createServer((socket) => { server.listen(common.PORT, () => { // The callback should not be called because the server is sending a // header field that ends only in \r with no following \n - const req = http.get({port:common.PORT}, (res) => { + const req = http.get({port: common.PORT}, (res) => { assert.fail(null, null, 'callback should not be called'); }); req.on('error', common.mustCall((err) => { diff --git a/test/parallel/test-http-client-response-domain.js b/test/parallel/test-http-client-response-domain.js index 59b95144867538..3034b1087e4d33 100644 --- a/test/parallel/test-http-client-response-domain.js +++ b/test/parallel/test-http-client-response-domain.js @@ -34,7 +34,7 @@ function test() { var req = http.get({ socketPath: common.PIPE, - headers: {'Content-Length':'1'}, + headers: {'Content-Length': '1'}, method: 'POST', path: '/' }); diff --git a/test/parallel/test-http-client-timeout-with-data.js b/test/parallel/test-http-client-timeout-with-data.js index 673908fe6d465f..2fff91227d1984 100644 --- a/test/parallel/test-http-client-timeout-with-data.js +++ b/test/parallel/test-http-client-timeout-with-data.js @@ -19,7 +19,7 @@ const options = { }; const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Length':'2'}); + res.writeHead(200, {'Content-Length': '2'}); res.write('*'); setTimeout(function() { res.end('*'); }, common.platformTimeout(100)); }); diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js index 84c7d473efa108..247346a9ec81a4 100644 --- a/test/parallel/test-http-expect-continue.js +++ b/test/parallel/test-http-expect-continue.js @@ -13,8 +13,8 @@ function handler(req, res) { assert.equal(sent_continue, true, 'Full response sent before 100 Continue'); console.error('Server sending full response...'); res.writeHead(200, { - 'Content-Type' : 'text/plain', - 'ABCD' : '1' + 'Content-Type': 'text/plain', + 'ABCD': '1' }); res.end(test_res_body); } diff --git a/test/parallel/test-http-remove-header-stays-removed.js b/test/parallel/test-http-remove-header-stays-removed.js index 904b8210103ebf..20390ffb2060d6 100644 --- a/test/parallel/test-http-remove-header-stays-removed.js +++ b/test/parallel/test-http-remove-header-stays-removed.js @@ -30,7 +30,7 @@ process.on('exit', function() { server.listen(common.PORT, function() { http.get({ port: common.PORT }, function(res) { assert.equal(200, res.statusCode); - assert.deepEqual(res.headers, { date : 'coffee o clock' }); + assert.deepStrictEqual(res.headers, { date: 'coffee o clock' }); res.setEncoding('ascii'); res.on('data', function(chunk) { diff --git a/test/parallel/test-http-response-multi-content-length.js b/test/parallel/test-http-response-multi-content-length.js index 4b0f2c11e3e901..8c03332fb2b7d2 100644 --- a/test/parallel/test-http-response-multi-content-length.js +++ b/test/parallel/test-http-response-multi-content-length.js @@ -33,7 +33,7 @@ server.listen(common.PORT, common.mustCall(() => { // case, the error handler must be called because the client // is not allowed to accept multiple content-length headers. http.get( - {port:common.PORT, headers:{'x-num': n}}, + {port: common.PORT, headers: {'x-num': n}}, (res) => { assert(false, 'client allowed multiple content-length headers.'); } diff --git a/test/parallel/test-http-response-splitting.js b/test/parallel/test-http-response-splitting.js index 4c954bf90acc7e..3675f8182d21a5 100644 --- a/test/parallel/test-http-response-splitting.js +++ b/test/parallel/test-http-response-splitting.js @@ -29,12 +29,12 @@ const server = http.createServer((req, res) => { break; case 1: assert.throws(common.mustCall(() => { - res.writeHead(200, {'foo' : x}); + res.writeHead(200, {'foo': x}); })); break; case 2: assert.throws(common.mustCall(() => { - res.writeHead(200, {'foo' : y}); + res.writeHead(200, {'foo': y}); })); break; default: diff --git a/test/parallel/test-http-server-multiheaders.js b/test/parallel/test-http-server-multiheaders.js index 99d72988479928..132f3fc1ea047f 100644 --- a/test/parallel/test-http-server-multiheaders.js +++ b/test/parallel/test-http-server-multiheaders.js @@ -18,7 +18,7 @@ var srv = http.createServer(function(req, res) { assert.equal(req.headers['sec-websocket-extensions'], 'foo; 1, bar; 2, baz'); assert.equal(req.headers['constructor'], 'foo, bar, baz'); - res.writeHead(200, {'Content-Type' : 'text/plain'}); + res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('EOF'); srv.close(); diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js index bf54af3465319e..80cc3416d60dae 100644 --- a/test/parallel/test-http-server-multiheaders2.js +++ b/test/parallel/test-http-server-multiheaders2.js @@ -58,7 +58,7 @@ var srv = http.createServer(function(req, res) { 'foo, bar', 'header parsed incorrectly: ' + header); }); - res.writeHead(200, {'Content-Type' : 'text/plain'}); + res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('EOF'); srv.close(); diff --git a/test/parallel/test-http-server-reject-cr-no-lf.js b/test/parallel/test-http-server-reject-cr-no-lf.js index fbb89f0ff3004d..9245dc2de54999 100644 --- a/test/parallel/test-http-server-reject-cr-no-lf.js +++ b/test/parallel/test-http-server-reject-cr-no-lf.js @@ -20,7 +20,7 @@ server.on('clientError', common.mustCall((err) => { server.close(); })); server.listen(common.PORT, () => { - const client = net.connect({port:common.PORT}, () => { + const client = net.connect({port: common.PORT}, () => { client.on('data', (chunk) => { assert.fail(null, null, 'this should not be called'); }); diff --git a/test/parallel/test-listen-fd-ebadf.js b/test/parallel/test-listen-fd-ebadf.js index 51e09a7907f18e..452eb7e14046d5 100644 --- a/test/parallel/test-listen-fd-ebadf.js +++ b/test/parallel/test-listen-fd-ebadf.js @@ -9,8 +9,8 @@ process.on('exit', function() { assert.equal(gotError, 2); }); -net.createServer(common.fail).listen({fd:2}).on('error', onError); -net.createServer(common.fail).listen({fd:42}).on('error', onError); +net.createServer(common.fail).listen({fd: 2}).on('error', onError); +net.createServer(common.fail).listen({fd: 42}).on('error', onError); function onError(ex) { assert.equal(ex.code, 'EINVAL'); diff --git a/test/parallel/test-net-listen-fd0.js b/test/parallel/test-net-listen-fd0.js index 1a6c4716eb6178..b484c6306f8463 100644 --- a/test/parallel/test-net-listen-fd0.js +++ b/test/parallel/test-net-listen-fd0.js @@ -10,7 +10,7 @@ process.on('exit', function() { }); // this should fail with an async EINVAL error, not throw an exception -net.createServer(common.fail).listen({fd:0}).on('error', function(e) { +net.createServer(common.fail).listen({fd: 0}).on('error', function(e) { switch (e.code) { case 'EINVAL': case 'ENOTSOCK': diff --git a/test/parallel/test-stream-transform-split-objectmode.js b/test/parallel/test-stream-transform-split-objectmode.js index 4e33028da2f7de..9d1b01c01b5f47 100644 --- a/test/parallel/test-stream-transform-split-objectmode.js +++ b/test/parallel/test-stream-transform-split-objectmode.js @@ -4,7 +4,7 @@ var assert = require('assert'); var Transform = require('stream').Transform; -var parser = new Transform({ readableObjectMode : true }); +var parser = new Transform({ readableObjectMode: true }); assert(parser._readableState.objectMode); assert(!parser._writableState.objectMode); @@ -12,7 +12,7 @@ assert(parser._readableState.highWaterMark === 16); assert(parser._writableState.highWaterMark === (16 * 1024)); parser._transform = function(chunk, enc, callback) { - callback(null, { val : chunk[0] }); + callback(null, { val: chunk[0] }); }; var parsed; @@ -28,7 +28,7 @@ process.on('exit', function() { }); -var serializer = new Transform({ writableObjectMode : true }); +var serializer = new Transform({ writableObjectMode: true }); assert(!serializer._readableState.objectMode); assert(serializer._writableState.objectMode); @@ -45,7 +45,7 @@ serializer.on('data', function(chunk) { serialized = chunk; }); -serializer.write({ val : 42 }); +serializer.write({ val: 42 }); process.on('exit', function() { assert(serialized[0] === 42); diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index 11ee45915c8395..8554c965e9481b 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -268,7 +268,7 @@ test('assymetric transform (compress)', function(t) { test('complex transform', function(t) { var count = 0; var saved = null; - var pt = new Transform({highWaterMark:3}); + var pt = new Transform({highWaterMark: 3}); pt._transform = function(c, e, cb) { if (count++ === 1) saved = c; diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index 6ebb1e9e0d704b..20e77afda4a4be 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -29,7 +29,7 @@ function loadPEM(n) { var server = tls.Server({ secureProtocol: 'TLSv1_2_server_method', key: loadPEM('agent2-key'), - cert:loadPEM('agent2-cert') + cert: loadPEM('agent2-cert') }, null).listen(common.PORT, function() { var args = ['s_client', '-quiet', '-tls1_1', '-connect', '127.0.0.1:' + common.PORT]; diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js index 9aa2682cbcb523..08f13c809df51e 100644 --- a/test/parallel/test-url.js +++ b/test/parallel/test-url.js @@ -822,7 +822,7 @@ var parseTests = { query: '@c' }, - 'http://a\r" \t\n<\'b:b@c\r\nd/e?f':{ + 'http://a\r" \t\n<\'b:b@c\r\nd/e?f': { protocol: 'http:', slashes: true, auth: 'a\r" \t\n<\'b:b', @@ -912,7 +912,7 @@ var parseTestsWithQueryString = { path: '/example', href: '/example' }, - '/example?query=value':{ + '/example?query=value': { protocol: null, slashes: null, auth: null, @@ -1091,7 +1091,7 @@ var formatTests = { // `#`,`?` in path '/path/to/%%23%3F+=&.txt?foo=theA1#bar': { - href : '/path/to/%%23%3F+=&.txt?foo=theA1#bar', + href: '/path/to/%%23%3F+=&.txt?foo=theA1#bar', pathname: '/path/to/%#?+=&.txt', query: { foo: 'theA1' @@ -1101,7 +1101,7 @@ var formatTests = { // `#`,`?` in path + `#` in query '/path/to/%%23%3F+=&.txt?foo=the%231#bar': { - href : '/path/to/%%23%3F+=&.txt?foo=the%231#bar', + href: '/path/to/%%23%3F+=&.txt?foo=the%231#bar', pathname: '/path/to/%#?+=&.txt', query: { foo: 'the#1' diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js index 864361d80a6dfa..84cd058714df02 100644 --- a/test/parallel/test-util.js +++ b/test/parallel/test-util.js @@ -76,10 +76,10 @@ assert.equal(false, util.isBuffer('foo')); assert.equal(true, util.isBuffer(new Buffer('foo'))); // _extend -assert.deepEqual(util._extend({a:1}), {a:1}); -assert.deepEqual(util._extend({a:1}, []), {a:1}); -assert.deepEqual(util._extend({a:1}, null), {a:1}); -assert.deepEqual(util._extend({a:1}, true), {a:1}); -assert.deepEqual(util._extend({a:1}, false), {a:1}); -assert.deepEqual(util._extend({a:1}, {b:2}), {a:1, b:2}); -assert.deepEqual(util._extend({a:1, b:2}, {b:3}), {a:1, b:3}); +assert.deepStrictEqual(util._extend({a: 1}), {a: 1}); +assert.deepStrictEqual(util._extend({a: 1}, []), {a: 1}); +assert.deepStrictEqual(util._extend({a: 1}, null), {a: 1}); +assert.deepStrictEqual(util._extend({a: 1}, true), {a: 1}); +assert.deepStrictEqual(util._extend({a: 1}, false), {a: 1}); +assert.deepStrictEqual(util._extend({a: 1}, {b: 2}), {a: 1, b: 2}); +assert.deepStrictEqual(util._extend({a: 1, b: 2}, {b: 3}), {a: 1, b: 3}); diff --git a/test/parallel/test-vm-context.js b/test/parallel/test-vm-context.js index 3fe3cf1b66a88e..48bceb14593679 100644 --- a/test/parallel/test-vm-context.js +++ b/test/parallel/test-vm-context.js @@ -52,7 +52,7 @@ console.error('test RegExp as argument to assert.throws'); script = vm.createScript('var assert = require(\'assert\'); assert.throws(' + 'function() { throw "hello world"; }, /hello/);', 'some.js'); -script.runInNewContext({ require : require }); +script.runInNewContext({ require: require }); // Issue GH-7529 script = vm.createScript('delete b'); diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index dfef8c6a657cf2..302b645bdd52f2 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -20,14 +20,14 @@ assert.throws(function() { }); var hashes = { - modp1 : '630e9acd2cc63f7e80d8507624ba60ac0757201a', - modp2 : '18f7aa964484137f57bca64b21917a385b6a0b60', - modp5 : 'c0a8eec0c2c8a5ec2f9c26f9661eb339a010ec61', - modp14 : 'af5455606fe74cec49782bb374e4c63c9b1d132c', - modp15 : '7bdd39e5cdbb9748113933e5c2623b559c534e74', - modp16 : 'daea5277a7ad0116e734a8e0d2f297ef759d1161', - modp17 : '3b62aaf0142c2720f0bf26a9589b0432c00eadc1', - modp18 : 'a870b491bbbec9b131ae9878d07449d32e54f160' + modp1: '630e9acd2cc63f7e80d8507624ba60ac0757201a', + modp2: '18f7aa964484137f57bca64b21917a385b6a0b60', + modp5: 'c0a8eec0c2c8a5ec2f9c26f9661eb339a010ec61', + modp14: 'af5455606fe74cec49782bb374e4c63c9b1d132c', + modp15: '7bdd39e5cdbb9748113933e5c2623b559c534e74', + modp16: 'daea5277a7ad0116e734a8e0d2f297ef759d1161', + modp17: '3b62aaf0142c2720f0bf26a9589b0432c00eadc1', + modp18: 'a870b491bbbec9b131ae9878d07449d32e54f160' }; for (const name in hashes) { diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js index c21785f233c58f..cb3bc5e579b86b 100644 --- a/test/pummel/test-fs-watch-file-slow.js +++ b/test/pummel/test-fs-watch-file-slow.js @@ -16,7 +16,7 @@ catch (e) { // swallow } -fs.watchFile(FILENAME, {interval:TIMEOUT - 250}, function(curr, prev) { +fs.watchFile(FILENAME, {interval: TIMEOUT - 250}, function(curr, prev) { console.log([curr, prev]); switch (++nevents) { case 1: diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index 51d737ddbeede8..249164c7e4e991 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -119,7 +119,7 @@ assert.throws(function() { oldhandle.close(); // clean up assert.throws(function() { - var w = fs.watchFile(__filename, {persistent:false}, function() {}); + var w = fs.watchFile(__filename, {persistent: false}, function() {}); oldhandle = w._handle; w._handle = { stop: w._handle.stop }; w.stop(); diff --git a/tools/doc/html.js b/tools/doc/html.js index 27e9bee17bccec..5f349abe7145b3 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -152,7 +152,7 @@ function parseLists(input) { if (tok.type === 'list_start') { state = 'LIST'; if (depth === 0) { - output.push({ type:'html', text: '
' }); + output.push({ type: 'html', text: '
' }); } depth++; output.push(tok); @@ -176,7 +176,7 @@ function parseLists(input) { output.push(tok); if (depth === 0) { state = null; - output.push({ type:'html', text: '
' }); + output.push({ type: 'html', text: '
' }); } return; }