From 9edce1e12a7b69e7986dd15fce18d6e46590161a Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 21 Jan 2019 01:22:27 +0100 Subject: [PATCH] benchmark,doc,lib,test: capitalize comments This updates a lot of comments. PR-URL: https://github.com/nodejs/node/pull/26223 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Vse Mozhet Byt Reviewed-By: Anto Aravinth --- .eslintrc.js | 4 ++-- benchmark/_cli.js | 4 ++-- benchmark/crypto/cipher-stream.js | 2 +- benchmark/crypto/hash-stream-creation.js | 4 ++-- benchmark/crypto/hash-stream-throughput.js | 2 +- .../crypto/rsa-encrypt-decrypt-throughput.js | 2 +- .../crypto/rsa-sign-verify-throughput.js | 2 +- benchmark/fs/read-stream-throughput.js | 2 +- benchmark/fs/write-stream-throughput.js | 2 +- benchmark/net/tcp-raw-c2s.js | 4 ++-- benchmark/net/tcp-raw-pipe.js | 2 +- benchmark/net/tcp-raw-s2c.js | 2 +- doc/api/child_process.md | 2 +- doc/api/domain.md | 10 ++++----- doc/api/http.md | 2 +- doc/api/http2.md | 6 ++--- doc/api/inspector.md | 2 +- doc/api/querystring.md | 2 +- doc/api/stream.md | 8 +++---- doc/api/util.md | 2 +- lib/_stream_duplex.js | 2 +- lib/_stream_readable.js | 22 +++++++++---------- lib/_stream_writable.js | 18 +++++++-------- lib/_tls_wrap.js | 2 +- lib/dgram.js | 2 +- lib/domain.js | 2 +- lib/events.js | 2 +- lib/fs.js | 10 ++++----- lib/internal/child_process.js | 8 +++---- lib/internal/cluster/child.js | 2 +- lib/internal/console/constructor.js | 2 +- lib/internal/fs/read_file_context.js | 2 +- lib/internal/fs/streams.js | 4 ++-- lib/internal/http2/core.js | 6 ++--- lib/internal/modules/cjs/loader.js | 4 ++-- lib/internal/process/per_thread.js | 2 +- lib/internal/streams/async_iterator.js | 8 +++---- lib/internal/streams/legacy.js | 4 ++-- lib/internal/timers.js | 2 +- lib/internal/url.js | 4 ++-- lib/net.js | 8 +++---- lib/querystring.js | 2 +- lib/readline.js | 8 +++---- lib/timers.js | 4 ++-- lib/url.js | 18 +++++++-------- lib/util.js | 2 +- test/abort/test-addon-uv-handle-leak.js | 2 +- test/addons/load-long-path/test.js | 2 +- .../addons/openssl-client-cert-engine/test.js | 2 +- test/async-hooks/test-callback-error.js | 2 +- ...promise.chain-promise-before-init-hooks.js | 2 +- test/common/index.js | 2 +- .../test-dgram-broadcast-multi-process.js | 4 ++-- test/internet/test-dns-promises-resolve.js | 2 +- test/js-native-api/test_array/test.js | 2 +- test/js-native-api/test_typedarray/test.js | 2 +- ...st-dgram-bind-shared-ports-after-port-0.js | 2 +- .../test-inspector-cluster-port-clash.js | 4 ++-- test/parallel/test-buffer-alloc.js | 12 +++++----- test/parallel/test-buffer-bytelength.js | 2 +- test/parallel/test-buffer-copy.js | 6 ++--- test/parallel/test-buffer-includes.js | 2 +- test/parallel/test-buffer-indexof.js | 4 ++-- test/parallel/test-buffer-read.js | 4 ++-- test/parallel/test-buffer-slow.js | 2 +- test/parallel/test-buffer-tostring-range.js | 8 +++---- .../parallel/test-child-process-disconnect.js | 2 +- test/parallel/test-child-process-fork-net.js | 2 +- test/parallel/test-child-process-silent.js | 2 +- .../test-child-process-stdout-flush-exit.js | 2 +- .../test-child-process-validate-stdio.js | 4 ++-- test/parallel/test-cli-syntax-eval.js | 2 +- test/parallel/test-cli-syntax-piped-bad.js | 2 +- test/parallel/test-cli-syntax-piped-good.js | 2 +- .../test-cluster-disconnect-idle-worker.js | 2 +- test/parallel/test-cluster-disconnect.js | 2 +- test/parallel/test-cluster-eaccess.js | 8 +++---- test/parallel/test-cluster-master-kill.js | 2 +- test/parallel/test-cluster-worker-kill.js | 2 +- test/parallel/test-cluster-worker-no-exit.js | 2 +- .../test-cluster-worker-wait-server-close.js | 2 +- test/parallel/test-console.js | 2 +- test/parallel/test-constants.js | 2 +- test/parallel/test-crypto-authenticated.js | 4 ++-- test/parallel/test-crypto-binary-default.js | 4 ++-- test/parallel/test-crypto-cipher-decipher.js | 4 ++-- test/parallel/test-crypto-dh.js | 2 +- test/parallel/test-crypto-from-binary.js | 2 +- test/parallel/test-crypto-hash.js | 2 +- test/parallel/test-crypto-random.js | 2 +- test/parallel/test-domain-http-server.js | 4 ++-- test/parallel/test-fs-append-file-sync.js | 6 ++--- test/parallel/test-fs-long-path.js | 2 +- test/parallel/test-fs-mkdir.js | 4 ++-- test/parallel/test-fs-promises.js | 6 ++--- test/parallel/test-fs-readfile-pipe-large.js | 2 +- test/parallel/test-fs-readfile-pipe.js | 2 +- .../test-fs-readfile-zero-byte-liar.js | 2 +- .../test-fs-readfilesync-pipe-large.js | 2 +- test/parallel/test-fs-watchfile-bigint.js | 4 ++-- test/parallel/test-fs-watchfile.js | 4 ++-- test/parallel/test-fs-write-file.js | 2 +- .../test-http-addrequest-localaddress.js | 9 ++++---- .../test-http-agent-destroyed-socket.js | 2 +- test/parallel/test-http-agent-keepalive.js | 2 +- test/parallel/test-http-client-pipe-end.js | 2 +- .../test-http-incoming-matchKnownFields.js | 2 +- ...-http-incoming-pipelined-socket-destroy.js | 4 ++-- test/parallel/test-http-outgoing-finish.js | 2 +- .../parallel/test-http-outgoing-settimeout.js | 2 +- .../parallel/test-http-readable-data-event.js | 2 +- ...test-http-res-write-end-dont-take-array.js | 2 +- test/parallel/test-http-set-timeout-server.js | 6 ++--- test/parallel/test-http-set-trailers.js | 2 +- test/parallel/test-http-upgrade-server2.js | 2 +- ...p-url.parse-auth-with-header-in-request.js | 2 +- test/parallel/test-http-url.parse-auth.js | 2 +- test/parallel/test-http-url.parse-basic.js | 4 ++-- .../test-http-url.parse-https.request.js | 2 +- test/parallel/test-http-write-head.js | 2 +- test/parallel/test-http2-client-destroy.js | 2 +- .../test-http2-client-onconnect-errors.js | 2 +- .../test-http2-client-set-priority.js | 2 +- .../test-http2-compat-serverrequest-end.js | 2 +- ...ompat-serverresponse-createpushresponse.js | 2 +- .../test-http2-compat-serverresponse-end.js | 2 +- test/parallel/test-http2-connect.js | 2 +- test/parallel/test-http2-dont-lose-data.js | 2 +- .../test-http2-info-headers-errors.js | 2 +- .../test-http2-misbehaving-multiplex.js | 2 +- .../test-http2-respond-with-fd-errors.js | 2 +- test/parallel/test-http2-server-errors.js | 2 +- test/parallel/test-http2-window-size.js | 2 +- .../parallel/test-https-set-timeout-server.js | 6 ++--- test/parallel/test-https-strict.js | 2 +- test/parallel/test-listen-fd-cluster.js | 2 +- test/parallel/test-net-keepalive.js | 2 +- .../parallel/test-net-persistent-keepalive.js | 2 +- .../parallel/test-net-socket-local-address.js | 2 +- test/parallel/test-path-resolve.js | 2 +- test/parallel/test-preload.js | 8 +++---- test/parallel/test-priority-queue.js | 4 ++-- .../test-process-env-allowed-flags.js | 2 +- ...test-process-external-stdio-close-spawn.js | 2 +- .../test-process-external-stdio-close.js | 2 +- test/parallel/test-process-really-exit.js | 2 +- test/parallel/test-process-umask.js | 2 +- test/parallel/test-punycode.js | 6 ++--- test/parallel/test-querystring.js | 8 +++---- test/parallel/test-readline-interface.js | 8 +++---- test/parallel/test-readline-keys.js | 6 ++--- test/parallel/test-readline-set-raw-mode.js | 4 ++-- test/parallel/test-repl-context.js | 4 ++-- test/parallel/test-repl-end-emits-exit.js | 4 ++-- test/parallel/test-repl-save-load.js | 4 ++-- test/parallel/test-repl-tab-complete.js | 10 ++++----- test/parallel/test-repl-tab.js | 2 +- test/parallel/test-repl.js | 4 ++-- test/parallel/test-require-long-path.js | 2 +- test/parallel/test-stream-duplex-destroy.js | 2 +- test/parallel/test-stream-ispaused.js | 2 +- .../test-stream-pipe-unpipe-streams.js | 2 +- test/parallel/test-stream-pipeline.js | 2 +- test/parallel/test-stream-readable-destroy.js | 2 +- test/parallel/test-stream-readable-event.js | 6 ++--- .../test-stream-readable-flow-recursion.js | 2 +- ...est-stream-readable-reading-readingMore.js | 2 +- .../parallel/test-stream-transform-destroy.js | 2 +- ...st-stream-transform-split-highwatermark.js | 2 +- test/parallel/test-stream-writable-destroy.js | 2 +- test/parallel/test-stream-writev.js | 2 +- test/parallel/test-stream2-transform.js | 4 ++-- test/parallel/test-stream2-unpipe-drain.js | 2 +- test/parallel/test-stream3-cork-end.js | 4 ++-- test/parallel/test-stream3-cork-uncork.js | 4 ++-- test/parallel/test-string-decoder-end.js | 2 +- test/parallel/test-stringbytes-external.js | 12 +++++----- test/parallel/test-tls-getcipher.js | 2 +- test/parallel/test-trace-events-api.js | 4 ++-- .../test-trace-events-category-used.js | 4 ++-- test/parallel/test-url-parse-format.js | 2 +- test/parallel/test-v8-coverage.js | 2 +- .../test-vm-global-property-interceptors.js | 2 +- .../test-windows-failed-heap-allocation.js | 2 +- .../test-zlib-deflate-raw-inherits.js | 2 +- test/parallel/test-zlib-destroy.js | 2 +- test/parallel/test-zlib-dictionary.js | 2 +- test/parallel/test-zlib.js | 2 +- test/sequential/test-cli-syntax-bad.js | 8 +++---- .../test-cli-syntax-file-not-found.js | 4 ++-- test/sequential/test-cli-syntax-good.js | 6 ++--- .../test-dgram-bind-shared-ports.js | 2 +- test/sequential/test-http-econnrefused.js | 2 +- test/sequential/test-inspector.js | 6 ++--- test/sequential/test-module-loading.js | 6 ++--- .../test-net-listen-shared-ports.js | 2 +- test/sequential/test-stream2-stderr-sync.js | 2 +- .../test-timers-blocking-callback.js | 2 +- tools/eslint-rules/no-duplicate-requires.js | 2 +- tools/eslint-rules/required-modules.js | 4 ++-- 200 files changed, 346 insertions(+), 347 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9bd8e661237fd7..03dd8e47b875d3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -60,9 +60,9 @@ module.exports = { 'brace-style': ['error', '1tbs', { allowSingleLine: true }], 'capitalized-comments': ['error', 'always', { line: { - // Ignore all lines that have less characters than 50 and all lines that + // Ignore all lines that have less characters than 40 and all lines that // start with something that looks like a variable name or code. - ignorePattern: '^.{0,50}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]', + ignorePattern: '^.{0,40}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]|^ std', ignoreInlineComments: true, ignoreConsecutiveComments: true, }, diff --git a/benchmark/_cli.js b/benchmark/_cli.js index abd394694457c2..45e4c7a2bf05fb 100644 --- a/benchmark/_cli.js +++ b/benchmark/_cli.js @@ -28,7 +28,7 @@ function CLI(usage, settings) { } let currentOptional = null; - let mode = 'both'; // possible states are: [both, option, item] + let mode = 'both'; // Possible states are: [both, option, item] for (const arg of process.argv.slice(2)) { if (arg === '--') { @@ -59,7 +59,7 @@ function CLI(usage, settings) { this.optional[currentOptional] = arg; } - // the next value can be either an option or an item + // The next value can be either an option or an item mode = 'both'; } else if (['both', 'item'].includes(mode)) { // item arguments diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js index 584039a1e516e6..f426a32769d0dd 100644 --- a/benchmark/crypto/cipher-stream.js +++ b/benchmark/crypto/cipher-stream.js @@ -15,7 +15,7 @@ function main({ api, cipher, type, len, writes }) { cipher = 'AES192'; if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); - // use the legacy, just so that we can compare them. + // Use the legacy, just so that we can compare them. api = 'legacy'; } diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js index faaa12a9e5d484..8ffbe148bb71a5 100644 --- a/benchmark/crypto/hash-stream-creation.js +++ b/benchmark/crypto/hash-stream-creation.js @@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, { function main({ api, type, len, out, writes, algo }) { if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); - // use the legacy, just so that we can compare them. + // Use the legacy, just so that we can compare them. api = 'legacy'; } @@ -54,7 +54,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) { h.update(message, encoding); var res = h.digest(outEnc); - // include buffer creation costs for older versions + // Include buffer creation costs for older versions if (outEnc === 'buffer' && typeof res === 'string') res = Buffer.from(res, 'binary'); } diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js index 934e7a0b11bdae..6ce7a6767e4880 100644 --- a/benchmark/crypto/hash-stream-throughput.js +++ b/benchmark/crypto/hash-stream-throughput.js @@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, { function main({ api, type, len, algo, writes }) { if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); - // use the legacy, just so that we can compare them. + // Use the legacy, just so that we can compare them. api = 'legacy'; } diff --git a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js index 1295ac850609ab..13153c20cad569 100644 --- a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js +++ b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js @@ -1,5 +1,5 @@ 'use strict'; -// throughput benchmark in signing and verifying +// Throughput benchmark in signing and verifying const common = require('../common.js'); const crypto = require('crypto'); const fs = require('fs'); diff --git a/benchmark/crypto/rsa-sign-verify-throughput.js b/benchmark/crypto/rsa-sign-verify-throughput.js index 4ea39d1eb6a6ce..846fa1b9a4bddb 100644 --- a/benchmark/crypto/rsa-sign-verify-throughput.js +++ b/benchmark/crypto/rsa-sign-verify-throughput.js @@ -1,5 +1,5 @@ 'use strict'; -// throughput benchmark in signing and verifying +// Throughput benchmark in signing and verifying const common = require('../common.js'); const crypto = require('crypto'); const fs = require('fs'); diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index bce5f5c996b0a8..cb5d98dc3279f6 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -1,4 +1,4 @@ -// test the throughput of the fs.WriteStream class. +// Test the throughput of the fs.WriteStream class. 'use strict'; const path = require('path'); diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index a1daa619a352aa..bc88330929c2fc 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -1,4 +1,4 @@ -// test the throughput of the fs.WriteStream class. +// Test the throughput of the fs.WriteStream class. 'use strict'; const path = require('path'); diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js index 849b3651681e7f..fe320ddaa2716b 100644 --- a/benchmark/net/tcp-raw-c2s.js +++ b/benchmark/net/tcp-raw-c2s.js @@ -5,7 +5,7 @@ const common = require('../common.js'); const util = require('util'); -// if there are --dur=N and --len=N args, then +// If there are --dur=N and --len=N args, then // run the function with those settings. // if not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { @@ -36,7 +36,7 @@ function main({ dur, len, type }) { if (err) fail(err, 'connect'); - // the meat of the benchmark is right here: + // The meat of the benchmark is right here: bench.start(); var bytes = 0; diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 10c69fb8b2d4bf..89db42dc4f3e72 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -5,7 +5,7 @@ const common = require('../common.js'); const util = require('util'); -// if there are --dur=N and --len=N args, then +// If there are --dur=N and --len=N args, then // run the function with those settings. // if not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index d34434a3d02e41..73f4d292cf5541 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -122,7 +122,7 @@ function main({ dur, len, type }) { clientHandle.readStart(); - // the meat of the benchmark is right here: + // The meat of the benchmark is right here: bench.start(); setTimeout(() => { diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 9586b662eb17ed..a6064ee3c7545f 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1070,7 +1070,7 @@ const subprocess = spawn( ); setTimeout(() => { - subprocess.kill(); // does not terminate the node process in the shell + subprocess.kill(); // Does not terminate the node process in the shell }, 2000); ``` diff --git a/doc/api/domain.md b/doc/api/domain.md index 5ed1de4a4a23ca..0f53e958bd8976 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -128,7 +128,7 @@ if (cluster.isMaster) { // Anything can happen now! Be very careful! try { - // make sure we close down within 30 seconds + // Make sure we close down within 30 seconds const killtimer = setTimeout(() => { process.exit(1); }, 30000); @@ -148,7 +148,7 @@ if (cluster.isMaster) { res.setHeader('content-type', 'text/plain'); res.end('Oops, there was a problem!\n'); } catch (er2) { - // oh well, not much we can do at this point. + // Oh well, not much we can do at this point. console.error(`Error sending 500! ${er2.stack}`); } }); @@ -240,13 +240,13 @@ perhaps we would like to have a separate domain to use for each request. That is possible via explicit binding. ```js -// create a top-level domain for the server +// Create a top-level domain for the server const domain = require('domain'); const http = require('http'); const serverDomain = domain.create(); serverDomain.run(() => { - // server is created in the scope of serverDomain + // Server is created in the scope of serverDomain http.createServer((req, res) => { // Req and res are also created in the scope of serverDomain // however, we'd prefer to have a separate domain for each request. @@ -373,7 +373,7 @@ const d = domain.create(); function readSomeFile(filename, cb) { fs.readFile(filename, 'utf8', d.intercept((data) => { - // note, the first argument is never passed to the + // Note, the first argument is never passed to the // callback since it is assumed to be the 'Error' argument // and thus intercepted by the domain. diff --git a/doc/api/http.md b/doc/api/http.md index 9e6b6e4264ec2c..57ba9302b89a26 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -101,7 +101,7 @@ http.get({ hostname: 'localhost', port: 80, path: '/', - agent: false // create a new agent just for this one request + agent: false // Create a new agent just for this one request }, (res) => { // Do stuff with response }); diff --git a/doc/api/http2.md b/doc/api/http2.md index da2201d55c99a5..4ebc4902130e4b 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2598,7 +2598,7 @@ const server = createSecureServer( ).listen(4443); function onRequest(req, res) { - // detects if it is a HTTPS request or HTTP/2 + // Detects if it is a HTTPS request or HTTP/2 const { socket: { alpnProtocol } } = req.httpVersion === '2.0' ? req.stream.session : req; res.writeHead(200, { 'content-type': 'application/json' }); @@ -3371,9 +3371,9 @@ const obs = new PerformanceObserver((items) => { const entry = items.getEntries()[0]; console.log(entry.entryType); // prints 'http2' if (entry.name === 'Http2Session') { - // entry contains statistics about the Http2Session + // Entry contains statistics about the Http2Session } else if (entry.name === 'Http2Stream') { - // entry contains statistics about the Http2Stream + // Entry contains statistics about the Http2Stream } }); obs.observe({ entryTypes: ['http2'] }); diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 6af8b90aaf6238..0a11f6a1ff12eb 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -167,7 +167,7 @@ session.connect(); session.post('Profiler.enable', () => { session.post('Profiler.start', () => { - // invoke business logic under measurement here... + // Invoke business logic under measurement here... // some time later... session.post('Profiler.stop', (err, { profile }) => { diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 60230d916b3243..67475601af9517 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -109,7 +109,7 @@ Any other input values will be coerced to empty strings. ```js querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); -// returns 'foo=bar&baz=qux&baz=quux&corge=' +// Returns 'foo=bar&baz=qux&baz=quux&corge=' querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); // returns 'foo:bar;baz:qux' diff --git a/doc/api/stream.md b/doc/api/stream.md index 14bc50d3107283..c9d4b035ddd48c 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -135,7 +135,7 @@ const server = http.createServer((req, res) => { req.on('end', () => { try { const data = JSON.parse(body); - // write back something interesting to the user: + // Write back something interesting to the user: res.write(typeof data); res.end(); } catch (er) { @@ -413,7 +413,7 @@ Calling the [`stream.write()`][stream-write] method after calling [`stream.end()`][stream-end] will raise an error. ```js -// write 'hello, ' and then end with 'world!' +// Write 'hello, ' and then end with 'world!' const fs = require('fs'); const file = fs.createWriteStream('example.txt'); file.write('hello, '); @@ -684,7 +684,7 @@ pass.unpipe(writable); pass.on('data', (chunk) => { console.log(chunk.toString()); }); pass.write('ok'); // will not emit 'data' -pass.resume(); // must be called to make stream emit 'data' +pass.resume(); // Must be called to make stream emit 'data' ``` While `readable.readableFlowing` is `false`, data may be accumulating @@ -1211,7 +1211,7 @@ function parseHeader(stream, callback) { const remaining = split.join('\n\n'); const buf = Buffer.from(remaining, 'utf8'); stream.removeListener('error', callback); - // remove the 'readable' listener before unshifting + // Remove the 'readable' listener before unshifting stream.removeListener('readable', onReadable); if (buf.length) stream.unshift(buf); diff --git a/doc/api/util.md b/doc/api/util.md index b1d4854997f053..d53e18b217316c 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -158,7 +158,7 @@ const util = require('util'); const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001'); -fn1(); // emits a deprecation warning with code DEP0001 +fn1(); // Emits a deprecation warning with code DEP0001 fn2(); // Does not emit a deprecation warning because it has the same code ``` diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index 79c91cc3624977..543ace1db2941b 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -131,7 +131,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { return; } - // backward compatibility, the user is explicitly + // Backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; this._writableState.destroyed = value; diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 1fe5e0573d15a9..861c262e1581a0 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -134,7 +134,7 @@ function ReadableState(options, stream, isDuplex) { // The number of writers that are awaiting a drain event in .pipe()s this.awaitDrain = 0; - // if true, a maybeReadMore has been scheduled + // If true, a maybeReadMore has been scheduled this.readingMore = false; this.decoder = null; @@ -189,7 +189,7 @@ Object.defineProperty(Readable.prototype, 'destroyed', { return; } - // backward compatibility, the user is explicitly + // Backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; } @@ -669,7 +669,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { var cleanedUp = false; function cleanup() { debug('cleanup'); - // cleanup event handlers once the pipe is broken + // Cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); @@ -745,7 +745,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // tell the dest that it's being piped to dest.emit('pipe', src); - // start the flow if it hasn't been started already. + // Start the flow if it hasn't been started already. if (!state.flowing) { debug('pipe resume'); src.resume(); @@ -772,13 +772,13 @@ Readable.prototype.unpipe = function(dest) { var state = this._readableState; var unpipeInfo = { hasUnpiped: false }; - // if we're not piping anywhere, then do nothing. + // If we're not piping anywhere, then do nothing. if (state.pipesCount === 0) return this; - // just one destination. most common case. + // Just one destination. most common case. if (state.pipesCount === 1) { - // passed in one, but it's not the right one. + // Passed in one, but it's not the right one. if (dest && dest !== state.pipes) return this; @@ -824,7 +824,7 @@ Readable.prototype.unpipe = function(dest) { return this; }; -// set up data events if they are asked for +// Set up data events if they are asked for // Ensure readable listeners eventually get something Readable.prototype.on = function(ev, fn) { const res = Stream.prototype.on.call(this, ev, fn); @@ -893,7 +893,7 @@ function updateReadableListening(self) { state.readableListening = self.listenerCount('readable') > 0; if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise + // Flowing needs to be set to true now, otherwise // the upcoming resume will not flow. state.flowing = true; @@ -914,7 +914,7 @@ Readable.prototype.resume = function() { var state = this._readableState; if (!state.flowing) { debug('resume'); - // we flow only if there is no one listening + // We flow only if there is no one listening // for readable, but we still have to call // resume() state.flowing = !state.readableListening; @@ -984,7 +984,7 @@ Readable.prototype.wrap = function(stream) { if (state.decoder) chunk = state.decoder.write(chunk); - // don't skip over falsy values in objectMode + // Don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return; else if (!state.objectMode && (!chunk || !chunk.length)) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 570c4c4d0af664..e56a067420f36d 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -69,7 +69,7 @@ function WritableState(options, stream, isDuplex) { if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - // the point at which write() starts returning false + // The point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', @@ -82,7 +82,7 @@ function WritableState(options, stream, isDuplex) { this.needDrain = false; // at the start of calling end() this.ending = false; - // when end() has been called, and returned + // When end() has been called, and returned this.ended = false; // when 'finish' is emitted this.finished = false; @@ -123,7 +123,7 @@ function WritableState(options, stream, isDuplex) { // end up in an overlapped onwrite situation. this.bufferProcessing = false; - // the callback that's passed to _write(chunk,cb) + // The callback that's passed to _write(chunk,cb) this.onwrite = onwrite.bind(undefined, stream); // The callback that the user supplies to write(chunk,encoding,cb) @@ -135,7 +135,7 @@ function WritableState(options, stream, isDuplex) { this.bufferedRequest = null; this.lastBufferedRequest = null; - // number of pending user-supplied write callbacks + // Number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted this.pendingcb = 0; @@ -155,7 +155,7 @@ function WritableState(options, stream, isDuplex) { // count buffered requests this.bufferedRequestCount = 0; - // allocate the first CorkedRequest, there is always + // Allocate the first CorkedRequest, there is always // one allocated and free to use, and we maintain at most two var corkReq = { next: null, entry: null, finish: undefined }; corkReq.finish = onCorkedFinish.bind(undefined, corkReq, this); @@ -423,13 +423,13 @@ function onwriteError(stream, state, sync, er, cb) { // Defer the callback if we are being called synchronously // to avoid piling up things on the stack process.nextTick(cb, er); - // this can emit finish, and it will always happen + // This can emit finish, and it will always happen // after error process.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; errorOrDestroy(stream, er); } else { - // the caller expect this to happen before if + // The caller expect this to happen before if // it is async cb(er); stream._writableState.errorEmitted = true; @@ -545,7 +545,7 @@ function clearBuffer(stream, state) { doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then + // If we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. @@ -703,7 +703,7 @@ Object.defineProperty(Writable.prototype, 'destroyed', { return; } - // backward compatibility, the user is explicitly + // Backward compatibility, the user is explicitly // managing destroyed this._writableState.destroyed = value; } diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index eaf937640ed088..551fb7a8819fe2 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -570,7 +570,7 @@ TLSSocket.prototype._init = function(socket, wrap) { } if (options.ALPNProtocols) { - // keep reference in secureContext not to be GC-ed + // Keep reference in secureContext not to be GC-ed ssl._secureContext.alpnBuffer = options.ALPNProtocols; ssl.setALPNProtocols(ssl._secureContext.alpnBuffer); } diff --git a/lib/dgram.js b/lib/dgram.js index 4a9352b7705684..621f6f1e9af8a3 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -254,7 +254,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { exclusive = false; } - // defaulting address for bind to all interfaces + // Defaulting address for bind to all interfaces if (!address) { if (this.type === 'udp4') address = '0.0.0.0'; diff --git a/lib/domain.js b/lib/domain.js index 031350746cc5b8..048e3e35ea3cd2 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -298,7 +298,7 @@ Domain.prototype.add = function(ee) { if (ee.domain) ee.domain.remove(ee); - // check for circular Domain->Domain links. + // Check for circular Domain->Domain links. // This causes bad insanity! // // For example: diff --git a/lib/events.js b/lib/events.js index 2d7ae8945ff0b2..62fa33463d678e 100644 --- a/lib/events.js +++ b/lib/events.js @@ -374,7 +374,7 @@ EventEmitter.prototype.removeAllListeners = if (events === undefined) return this; - // not listening for removeListener, no need to emit + // Not listening for removeListener, no need to emit if (events.removeListener === undefined) { if (arguments.length === 0) { this._events = Object.create(null); diff --git a/lib/fs.js b/lib/fs.js index 8b10cb913ec107..ccd1ff2756ee26 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -383,7 +383,7 @@ function readFileSync(path, options) { fs.closeSync(fd); if (size === 0) { - // data was collected into the buffers list. + // Data was collected into the buffers list. buffer = Buffer.concat(buffers, pos); } else if (pos < size) { buffer = buffer.slice(0, pos); @@ -649,7 +649,7 @@ function truncateSync(path, len) { if (len === undefined) { len = 0; } - // allow error to be thrown, but still close fd. + // Allow error to be thrown, but still close fd. const fd = fs.openSync(path, 'r+'); let ret; @@ -1484,7 +1484,7 @@ function realpathSync(p, options) { pos = result + 1; } - // continue if not a symlink, break if a pipe/socket + // Continue if not a symlink, break if a pipe/socket if (knownHard[base] || (cache && cache.get(base) === base)) { if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { @@ -1630,7 +1630,7 @@ function realpath(p, options, callback) { pos = result + 1; } - // continue if not a symlink, break if a pipe/socket + // Continue if not a symlink, break if a pipe/socket if (knownHard[base]) { if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { @@ -1645,7 +1645,7 @@ function realpath(p, options, callback) { function gotStat(err, stats) { if (err) return callback(err); - // if not a symlink, skip to the next path part + // If not a symlink, skip to the next path part if (!stats.isSymbolicLink()) { knownHard[base] = true; return process.nextTick(LOOP); diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index edbf396cf543d6..070acd70b7a785 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -99,7 +99,7 @@ const handleConversion = { // if the socket was created by net.Server if (socket.server) { - // the worker should keep track of the socket + // The worker should keep track of the socket message.key = socket.server._connectionKey; var firstTime = !this.channel.sockets.send[message.key]; @@ -384,15 +384,15 @@ ChildProcess.prototype.spawn = function(options) { continue; } - // stream is already cloned and piped, so close + // The stream is already cloned and piped, thus close it. if (stream.type === 'wrap') { stream.handle.close(); continue; } if (stream.handle) { - // when i === 0 - we're dealing with stdin - // (which is the only one writable pipe) + // When i === 0 - we're dealing with stdin + // (which is the only one writable pipe). stream.socket = createSocket(this.pid !== 0 ? stream.handle : null, i > 0); diff --git a/lib/internal/cluster/child.js b/lib/internal/cluster/child.js index 38d52948e56da3..d2f38a6b762b95 100644 --- a/lib/internal/cluster/child.js +++ b/lib/internal/cluster/child.js @@ -47,7 +47,7 @@ cluster._setupWorker = function() { } }; -// obj is a net#Server or a dgram#Socket object. +// `obj` is a net#Server or a dgram#Socket object. cluster._getServer = function(obj, options, cb) { let address = options.address; diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 84339310f0b731..42c35c14a8b3ea 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -358,7 +358,7 @@ Console.prototype.trace = function trace(...args) { Console.prototype.assert = function assert(expression, ...args) { if (!expression) { args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`; - this.warn(...args); // the arguments will be formatted in warn() again + this.warn(...args); // The arguments will be formatted in warn() again } }; diff --git a/lib/internal/fs/read_file_context.js b/lib/internal/fs/read_file_context.js index d7543ffa5aafed..4961ee820a7e84 100644 --- a/lib/internal/fs/read_file_context.js +++ b/lib/internal/fs/read_file_context.js @@ -23,7 +23,7 @@ function readFileAfterRead(err, bytesRead) { else context.read(); } else { - // unknown size, just read until we don't get bytes. + // Unknown size, just read until we don't get bytes. context.buffers.push(context.buffer.slice(0, bytesRead)); context.read(); } diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index 7174990ebb60a0..b057ddb9bd2740 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -153,7 +153,7 @@ ReadStream.prototype._read = function(n) { else toRead = Math.min(this.end - this.bytesRead + 1, toRead); - // already read everything we were supposed to read! + // Already read everything we were supposed to read! // treat as EOF. if (toRead <= 0) return this.push(null); @@ -372,7 +372,7 @@ WriteStream.prototype.close = function(cb) { this.on('finish', this.destroy.bind(this)); } - // we use end() instead of destroy() because of + // We use end() instead of destroy() because of // https://github.com/nodejs/node/issues/2006 this.end(); }; diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 0a566ed9e672f1..dcb1b22d448e0e 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1734,7 +1734,7 @@ class Http2Stream extends Duplex { return !!(this[kState].flags & STREAM_FLAGS_HEADERS_SENT); } - // true if the Http2Stream was aborted abnormally. + // True if the Http2Stream was aborted abnormally. get aborted() { return !!(this[kState].flags & STREAM_FLAGS_ABORTED); } @@ -2242,7 +2242,7 @@ class ServerHttp2Stream extends Http2Stream { this[kAuthority] = headers[HTTP2_HEADER_AUTHORITY]; } - // true if the remote peer accepts push streams + // True if the remote peer accepts push streams get pushAllowed() { return !this.destroyed && !this.closed && @@ -2603,7 +2603,7 @@ function sessionOnError(error) { // When the session times out on the server, try emitting a timeout event. // If no handler is registered, destroy the session. function sessionOnTimeout() { - // if destroyed or closed already, do nothing + // If destroyed or closed already, do nothing if (this.destroyed || this.closed) return; const server = this[kServer]; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index e22294f337698c..8da55acd9bec50 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -237,7 +237,7 @@ function tryPackage(requestPath, exts, isMain) { // Set to an empty Map to reset. const realpathCache = new Map(); -// check if the file exists and is not a directory +// Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. @@ -914,7 +914,7 @@ Module._initPaths = function() { modulePaths = paths; - // clone as a shallow copy, for introspection. + // Clone as a shallow copy, for introspection. Module.globalPaths = modulePaths.slice(0); }; diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 28b9afe1cf9404..fa0334b8bfb2b0 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -262,7 +262,7 @@ function buildAllowedFlags() { constructor(...args) { super(...args); - // the super constructor consumes `add`, but + // The super constructor consumes `add`, but // disallow any future adds. this.add = () => this; } diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index cc8e218498f995..810132c0cb2c86 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -31,7 +31,7 @@ function readAndResolve(iter) { } function onReadable(iter) { - // we wait for the next tick, because it might + // We wait for the next tick, because it might // emit an error with process.nextTick process.nextTick(readAndResolve, iter); } @@ -58,7 +58,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ }, next() { - // if we have detected an error in the meanwhile + // If we have detected an error in the meanwhile // reject straight away const error = this[kError]; if (error !== null) { @@ -95,7 +95,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ if (lastPromise) { promise = new Promise(wrapForNext(lastPromise, this)); } else { - // fast path needed to support multiple this.push() + // Fast path needed to support multiple this.push() // without triggering the next() queue const data = this[kStream].read(); if (data !== null) { @@ -160,7 +160,7 @@ const createReadableStreamAsyncIterator = (stream) => { finished(stream, (err) => { if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { const reject = iterator[kLastReject]; - // reject if we are waiting for data in the Promise + // Reject if we are waiting for data in the Promise // returned by next() and store the error if (reject !== null) { iterator[kLastPromise] = null; diff --git a/lib/internal/streams/legacy.js b/lib/internal/streams/legacy.js index 85c88c73f01f06..693987e9d1aea2 100644 --- a/lib/internal/streams/legacy.js +++ b/lib/internal/streams/legacy.js @@ -50,7 +50,7 @@ Stream.prototype.pipe = function(dest, options) { if (typeof dest.destroy === 'function') dest.destroy(); } - // don't leave dangling pipes when there are errors. + // Don't leave dangling pipes when there are errors. function onerror(er) { cleanup(); if (EE.listenerCount(this, 'error') === 0) { @@ -61,7 +61,7 @@ Stream.prototype.pipe = function(dest, options) { source.on('error', onerror); dest.on('error', onerror); - // remove all the event listeners that were added. + // Remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); diff --git a/lib/internal/timers.js b/lib/internal/timers.js index 6cd8fd72c02cbc..a43819da46cc6a 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -62,7 +62,7 @@ function Timeout(callback, after, args, isRepeat) { '\nTimeout duration was set to 1.', 'TimeoutOverflowWarning'); } - after = 1; // schedule on next tick, follows browser behavior + after = 1; // Schedule on next tick, follows browser behavior } this._idleTimeout = after; diff --git a/lib/internal/url.js b/lib/internal/url.js index 9727133ad1dd62..08ae050b9597fb 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1102,7 +1102,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', { const key = list[i]; const value = list[i + 1]; callback.call(thisArg, value, key, this); - // in case the URL object's `search` is updated + // In case the URL object's `search` is updated list = this[searchParams]; i += 2; } @@ -1369,7 +1369,7 @@ function pathToFileURL(filepath) { const outURL = new URL('file://'); if (resolved.includes('%')) resolved = resolved.replace(percentRegEx, '%25'); - // in posix, "/" is a valid character in paths + // In posix, "/" is a valid character in paths if (!isWindows && resolved.includes('\\')) resolved = resolved.replace(backslashRegEx, '%5C'); if (resolved.includes('\n')) diff --git a/lib/net.js b/lib/net.js index 2726e73272c73d..b649c6779a9484 100644 --- a/lib/net.js +++ b/lib/net.js @@ -299,7 +299,7 @@ function Socket(options) { } } - // shut down the socket when we're finished with it. + // Shut down the socket when we're finished with it. this.on('end', onReadableStreamEnd); initSocketHandle(this); @@ -311,7 +311,7 @@ function Socket(options) { // buffer. if not, then this will happen when we connect if (this._handle && options.readable !== false) { if (options.pauseOnCreate) { - // stop the handle from reading and pause the stream + // Stop the handle from reading and pause the stream this._handle.reading = false; this._handle.readStop(); this.readableFlowing = false; @@ -374,7 +374,7 @@ function afterShutdown(status) { this.callback(); - // callback may come after call to destroy. + // Callback may come after call to destroy. if (self.destroyed) return; @@ -1044,7 +1044,7 @@ function afterConnect(status, handle, req, readable, writable) { self.emit('connect'); self.emit('ready'); - // start the first read, or get an immediate EOF. + // Start the first read, or get an immediate EOF. // this doesn't actually consume any bytes, because len=0. if (readable && !self.isPaused()) self.read(0); diff --git a/lib/querystring.js b/lib/querystring.js index 5839ca6b0d0d0b..bfb6fa33327d0c 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -62,7 +62,7 @@ const unhexTable = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // ... 255 ]; -// a safe fast alternative to decodeURIComponent +// A safe fast alternative to decodeURIComponent function unescapeBuffer(s, decodeSpaces) { var out = Buffer.allocUnsafe(s.length); var index = 0; diff --git a/lib/readline.js b/lib/readline.js index 9c7caff60a8ae8..aa70f812f3b11e 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -183,7 +183,7 @@ function Interface(input, output, completer, terminal) { function onkeypress(s, key) { self._ttyWrite(s, key); if (key && key.sequence) { - // if the key.sequence is half of a surrogate pair + // If the key.sequence is half of a surrogate pair // (>= 0xd800 and <= 0xdfff), refresh the line so // the character is displayed appropriately. const ch = key.sequence.codePointAt(0); @@ -321,10 +321,10 @@ Interface.prototype._writeToOutput = function _writeToOutput(stringToWrite) { Interface.prototype._addHistory = function() { if (this.line.length === 0) return ''; - // if the history is disabled then return the line + // If the history is disabled then return the line if (this.historySize === 0) return this.line; - // if the trimmed line is empty then return the line + // If the trimmed line is empty then return the line if (this.line.trim().length === 0) return this.line; if (this.history.length === 0 || this.history[0] !== this.line) { @@ -471,7 +471,7 @@ Interface.prototype._insertString = function(c) { this._writeToOutput(c); } - // a hack to get the line refreshed if it's needed + // A hack to get the line refreshed if it's needed this._moveCursor(0); } }; diff --git a/lib/timers.js b/lib/timers.js index d0dd25e2623bf0..a7c795701e97f8 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -234,7 +234,7 @@ function insert(item, refed, start) { function TimersList(expiry, msecs) { this._idleNext = this; // Create the list with the linkedlist properties to - this._idlePrev = this; // prevent any unnecessary hidden class changes. + this._idlePrev = this; // Prevent any unnecessary hidden class changes. this.expiry = expiry; this.id = timerListId++; this.msecs = msecs; @@ -410,7 +410,7 @@ exports.unenroll = util.deprecate(unenroll, function enroll(item, msecs) { msecs = validateTimerDuration(msecs, 'msecs'); - // if this item was already in a list somewhere + // If this item was already in a list somewhere // then we should unenroll it from that if (item._idleNext) unenroll(item); diff --git a/lib/url.js b/lib/url.js index 0e02dbc1312101..78dcbe713010e9 100644 --- a/lib/url.js +++ b/lib/url.js @@ -345,14 +345,14 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { // pull out port. this.parseHost(); - // we've indicated that there is a hostname, + // We've indicated that there is a hostname, // so even if it's empty, it has to be present. if (typeof this.hostname !== 'string') this.hostname = ''; var hostname = this.hostname; - // if hostname begins with [ and ends with ] + // If hostname begins with [ and ends with ] // assume that it's an IPv6 address. var ipv6Hostname = hostname.charCodeAt(0) === CHAR_LEFT_SQUARE_BRACKET && hostname.charCodeAt(hostname.length - 1) === CHAR_RIGHT_SQUARE_BRACKET; @@ -527,9 +527,9 @@ function autoEscapeStr(rest) { return escaped; } -// format a parsed object into a url string +// Format a parsed object into a url string function urlFormat(urlObject, options) { - // ensure it's an object, and not a string url. + // Ensure it's an object, and not a string url. // If it's an object, this is a no-op. // this way, you can call urlParse() on strings // to clean up potentially wonky urls. @@ -678,7 +678,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result[tkey] = this[tkey]; } - // hash is always overridden, no matter what. + // Hash is always overridden, no matter what. // even href="" will remove it. result.hash = relative.hash; @@ -688,9 +688,9 @@ Url.prototype.resolveObject = function resolveObject(relative) { return result; } - // hrefs like //foo/bar always cut to the protocol. + // Hrefs like //foo/bar always cut to the protocol. if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative + // Take everything except the protocol from relative var rkeys = Object.keys(relative); for (var rk = 0; rk < rkeys.length; rk++) { var rkey = rkeys[rk]; @@ -709,7 +709,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { } if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing + // If it's a known url protocol, then changing // the protocol does weird things // first, if it's not file:, then we MUST have a host, // and if there was a path @@ -770,7 +770,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { var noLeadingSlashes = result.protocol && !slashedProtocol.has(result.protocol); - // if the url is a non-slashed url, then relative + // If the url is a non-slashed url, then relative // links like ../.. should be able // to crawl up to the hostname, as well. This is strange. // result.protocol has already been set by now. diff --git a/lib/util.js b/lib/util.js index 43e2c01301a3eb..f422a1f41099b8 100644 --- a/lib/util.js +++ b/lib/util.js @@ -143,7 +143,7 @@ function formatWithOptions(inspectOptions, ...args) { str += first.slice(lastPos, i); lastPos = i + 1; continue; - default: // any other character is not a correct placeholder + default: // Any other character is not a correct placeholder continue; } if (lastPos !== i - 1) { diff --git a/test/abort/test-addon-uv-handle-leak.js b/test/abort/test-addon-uv-handle-leak.js index 0bfb6cdb94b72d..47751954ab5728 100644 --- a/test/abort/test-addon-uv-handle-leak.js +++ b/test/abort/test-addon-uv-handle-leak.js @@ -45,7 +45,7 @@ if (process.argv[2] === 'child') { let state = 'initial'; - // parse output that is formatted like this: + // Parse output that is formatted like this: // uv loop at [0x559b65ed5770] has active handles // [0x7f2de0018430] timer diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index 7d1a37bd96055e..0160591746dc2e 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -10,7 +10,7 @@ const assert = require('assert'); const tmpdir = require('../../common/tmpdir'); tmpdir.refresh(); -// make a path that is more than 260 chars long. +// Make a path that is more than 260 chars long. // Any given folder cannot have a name longer than 260 characters, // so create 10 nested folders each with 30 character long names. let addonDestinationDir = path.resolve(tmpdir.path); diff --git a/test/addons/openssl-client-cert-engine/test.js b/test/addons/openssl-client-cert-engine/test.js index 1c0e4564a5c3e9..6466b0fd9d31ef 100644 --- a/test/addons/openssl-client-cert-engine/test.js +++ b/test/addons/openssl-client-cert-engine/test.js @@ -39,7 +39,7 @@ const server = https.createServer(serverOptions, (req, res) => { port: server.address().port, path: '/test', clientCertEngine: engine, // engine will provide key+cert - rejectUnauthorized: false, // prevent failing on self-signed certificates + rejectUnauthorized: false, // Prevent failing on self-signed certificates headers: {} }; diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index b52823c930677c..07293e0315931c 100644 --- a/test/async-hooks/test-callback-error.js +++ b/test/async-hooks/test-callback-error.js @@ -30,7 +30,7 @@ switch (arg) { return; } -// this part should run only for the master test +// This part should run only for the master test assert.ok(!arg); { // console.log should stay until this test's flakiness is solved diff --git a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js index 341b7b4c5dfd89..52a312dbdfe196 100644 --- a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js @@ -17,7 +17,7 @@ p.then(function afterResolution(val) { return val; }); -// init hooks after chained promise is created +// Init hooks after chained promise is created const hooks = initHooks(); hooks._allowNoInit = true; hooks.enable(); diff --git a/test/common/index.js b/test/common/index.js index 8554b85fe86265..60bd3520253e19 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -236,7 +236,7 @@ function platformTimeout(ms) { ms = multipliers.two * ms; if (isAIX) - return multipliers.two * ms; // default localhost speed is slower on AIX + return multipliers.two * ms; // Default localhost speed is slower on AIX if (process.arch !== 'arm') return ms; diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index a8d97869703e58..a989d687b0bdf4 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -85,7 +85,7 @@ if (process.argv[2] !== 'child') { // Handle the death of workers worker.on('exit', function(code, signal) { - // don't consider this the true death if the worker + // Don't consider this the true death if the worker // has finished successfully // or if the exit code is 0 if (worker.isDone || code === 0) { @@ -219,7 +219,7 @@ if (process.argv[2] === 'child') { }); listenSocket.on('message', function(buf, rinfo) { - // receive udp messages only sent from parent + // Receive udp messages only sent from parent if (rinfo.address !== bindAddress) return; console.error('[CHILD] %s received %s from %j', diff --git a/test/internet/test-dns-promises-resolve.js b/test/internet/test-dns-promises-resolve.js index 430f4251379097..6291e0365c2fa4 100644 --- a/test/internet/test-dns-promises-resolve.js +++ b/test/internet/test-dns-promises-resolve.js @@ -31,7 +31,7 @@ const dnsPromises = require('dns').promises; ); } -// rrtype is undefined, it's same as resolve4 +// Setting rrtype to undefined should work like resolve4. { (async function() { const rrtype = undefined; diff --git a/test/js-native-api/test_array/test.js b/test/js-native-api/test_array/test.js index 75c181d9da8269..4ec05596cf63bc 100644 --- a/test/js-native-api/test_array/test.js +++ b/test/js-native-api/test_array/test.js @@ -45,7 +45,7 @@ assert.strictEqual(test_array.TestHasElement(array, array.length + 1), false); assert(test_array.NewWithLength(0) instanceof Array); assert(test_array.NewWithLength(1) instanceof Array); -// check max allowed length for an array 2^32 -1 +// Check max allowed length for an array 2^32 -1 assert(test_array.NewWithLength(4294967295) instanceof Array); { diff --git a/test/js-native-api/test_typedarray/test.js b/test/js-native-api/test_typedarray/test.js index 2a8cf18feb866c..91e17ecbe8bb2a 100644 --- a/test/js-native-api/test_typedarray/test.js +++ b/test/js-native-api/test_typedarray/test.js @@ -38,7 +38,7 @@ assert.strictEqual(externalResult[0], 0); assert.strictEqual(externalResult[1], 1); assert.strictEqual(externalResult[2], 2); -// validate creation of all kinds of TypedArrays +// Validate creation of all kinds of TypedArrays const buffer = new ArrayBuffer(128); const arrayTypes = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, diff --git a/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js b/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js index fbf88d41650d24..703dd243760bb1 100644 --- a/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js +++ b/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js @@ -16,7 +16,7 @@ const BYE = 'bye'; if (cluster.isMaster) { const worker1 = cluster.fork(); - // verify that Windows doesn't support this scenario + // Verify that Windows doesn't support this scenario worker1.on('error', (err) => { if (err.code === 'ENOTSUP') throw err; }); diff --git a/test/known_issues/test-inspector-cluster-port-clash.js b/test/known_issues/test-inspector-cluster-port-clash.js index bc04e9907b168b..0c5580530995a5 100644 --- a/test/known_issues/test-inspector-cluster-port-clash.js +++ b/test/known_issues/test-inspector-cluster-port-clash.js @@ -29,7 +29,7 @@ function serialFork() { return new Promise((res) => { const worker = cluster.fork(); worker.on('error', (err) => assert.fail(err)); - // no common.mustCall since 1 out of 3 should fail + // No common.mustCall since 1 out of 3 should fail worker.on('online', () => { worker.on('message', common.mustCall((message) => { ports.push(message.debugPort); @@ -50,7 +50,7 @@ function serialFork() { if (cluster.isMaster) { cluster.on('online', common.mustCall((worker) => worker.send('dbgport'), 2)); - // block one of the ports with a listening socket + // Block one of the ports with a listening socket const server = net.createServer(); server.listen(clashPort, common.localhostIPv4, common.mustCall(() => { // try to fork 3 workers No.2 should fail diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 2b8e9c5f2250e9..c03179a769bb05 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -90,7 +90,7 @@ common.expectsError(() => b.write('', 2048), outOfBoundsError); // throw when writing to negative offset common.expectsError(() => b.write('a', -1), outOfBoundsError); -// throw when writing past bounds from the pool +// Throw when writing past bounds from the pool common.expectsError(() => b.write('a', 2048), outOfBoundsError); // throw when writing to negative offset @@ -290,7 +290,7 @@ Buffer.alloc(1).write('', 1, 0); assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); { - // test that regular and URL-safe base64 both work + // Test that regular and URL-safe base64 both work const expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]; assert.deepStrictEqual(Buffer.from('//++/++/++//', 'base64'), Buffer.from(expected)); @@ -319,7 +319,7 @@ assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); assert.strictEqual(quote.length, bytesWritten); assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); - // check that the base64 decoder ignores whitespace + // Check that the base64 decoder ignores whitespace const expectedWhite = `${expected.slice(0, 60)} \n` + `${expected.slice(60, 120)} \n` + `${expected.slice(120, 180)} \n` + @@ -418,7 +418,7 @@ assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKio', 'base64').toString(), '*'.repeat(20)); -// handle padding graciously, multiple-of-4 or not +// Handle padding graciously, multiple-of-4 or not assert.strictEqual( Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw==', 'base64').length, 32 @@ -762,7 +762,7 @@ assert.strictEqual(x.inspect(), ''); // Call .fill() first, stops valgrind warning about uninitialized memory reads. Buffer.allocUnsafe(3.3).fill().toString(); -// throws bad argument error in commit 43cb4ec +// Throws bad argument error in commit 43cb4ec Buffer.alloc(3.3).fill().toString(); assert.strictEqual(Buffer.allocUnsafe(3.3).length, 3); assert.strictEqual(Buffer.from({ length: 3.3 }).length, 3); @@ -808,7 +808,7 @@ common.expectsError( outOfRangeError ); -// ensure negative values can't get past offset +// Ensure negative values can't get past offset common.expectsError( () => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), outOfRangeError diff --git a/test/parallel/test-buffer-bytelength.js b/test/parallel/test-buffer-bytelength.js index 06cdda0b2feba9..3d419b316521e0 100644 --- a/test/parallel/test-buffer-bytelength.js +++ b/test/parallel/test-buffer-bytelength.js @@ -74,7 +74,7 @@ assert.strictEqual(Buffer.byteLength('∑éllö wørl∂!', 'utf-8'), 19); assert.strictEqual(Buffer.byteLength('κλμνξο', 'utf8'), 12); assert.strictEqual(Buffer.byteLength('挵挶挷挸挹', 'utf-8'), 15); assert.strictEqual(Buffer.byteLength('𠝹𠱓𠱸', 'UTF8'), 12); -// without an encoding, utf8 should be assumed +// Without an encoding, utf8 should be assumed assert.strictEqual(Buffer.byteLength('hey there'), 9); assert.strictEqual(Buffer.byteLength('𠱸挶νξ#xx :)'), 17); assert.strictEqual(Buffer.byteLength('hello world', ''), 11); diff --git a/test/parallel/test-buffer-copy.js b/test/parallel/test-buffer-copy.js index 82b71a1dd818e8..ec227a93741ec2 100644 --- a/test/parallel/test-buffer-copy.js +++ b/test/parallel/test-buffer-copy.js @@ -37,7 +37,7 @@ let cntr = 0; } { - // copy c into b, without specifying sourceEnd + // Copy c into b, without specifying sourceEnd b.fill(++cntr); c.fill(++cntr); const copied = c.copy(b, 0, 0); @@ -48,7 +48,7 @@ let cntr = 0; } { - // copy c into b, without specifying sourceStart + // Copy c into b, without specifying sourceStart b.fill(++cntr); c.fill(++cntr); const copied = c.copy(b, 0); @@ -135,7 +135,7 @@ common.expectsError( // When sourceStart is greater than sourceEnd, zero copied assert.strictEqual(b.copy(c, 0, 100, 10), 0); -// when targetStart > targetLength, zero copied +// When targetStart > targetLength, zero copied assert.strictEqual(b.copy(c, 512, 0, 10), 0); // Test that the `target` can be a Uint8Array. diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js index 006961173d2b0a..2a163f9e0c628e 100644 --- a/test/parallel/test-buffer-includes.js +++ b/test/parallel/test-buffer-includes.js @@ -287,7 +287,7 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { ); }); -// test truncation of Number arguments to uint8 +// Test truncation of Number arguments to uint8 { const buf = Buffer.from('this is a test'); assert.ok(buf.includes(0x6973)); diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 32176fe03c93dc..0f7d7824366215 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -175,7 +175,7 @@ assert.strictEqual( ); -// test optional offset with passed encoding +// Test optional offset with passed encoding assert.strictEqual(Buffer.from('aaaa0').indexOf('30', 'hex'), 4); assert.strictEqual(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4); @@ -581,7 +581,7 @@ assert.strictEqual(reallyLong.lastIndexOf(pattern), 3932160); pattern = reallyLong.slice(0, 2000000); // first 2/5ths. assert.strictEqual(reallyLong.lastIndexOf(pattern), 0); -// test truncation of Number arguments to uint8 +// Test truncation of Number arguments to uint8 { const buf = Buffer.from('this is a test'); assert.strictEqual(buf.indexOf(0x6973), 3); diff --git a/test/parallel/test-buffer-read.js b/test/parallel/test-buffer-read.js index 4c9f92259d3a7b..1adf0303566380 100644 --- a/test/parallel/test-buffer-read.js +++ b/test/parallel/test-buffer-read.js @@ -21,7 +21,7 @@ read(buf, 'readDoubleLE', [1], -6.966010051009108e+144); read(buf, 'readFloatBE', [1], -1.6691549692541768e+37); read(buf, 'readFloatLE', [1], -7861303808); -// testing basic functionality of readInt8() +// Testing basic functionality of readInt8() read(buf, 'readInt8', [1], -3); // Testing basic functionality of readInt16BE() and readInt16LE() @@ -36,7 +36,7 @@ read(buf, 'readInt32LE', [1], -806729475); read(buf, 'readIntBE', [1, 1], -3); read(buf, 'readIntLE', [2, 1], 0x48); -// testing basic functionality of readUInt8() +// Testing basic functionality of readUInt8() read(buf, 'readUInt8', [1], 0xfd); // Testing basic functionality of readUInt16BE() and readUInt16LE() diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index 99362add3bb336..1b8de4429980ed 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -39,7 +39,7 @@ try { assert.strictEqual(e.name, 'RangeError'); } -// should work with number-coercible values +// Should work with number-coercible values assert.strictEqual(SlowBuffer('6').length, 6); assert.strictEqual(SlowBuffer(true).length, 1); diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js index a06163bac2df9a..9cda0d833559f2 100644 --- a/test/parallel/test-buffer-tostring-range.js +++ b/test/parallel/test-buffer-tostring-range.js @@ -11,13 +11,13 @@ assert.strictEqual(rangeBuffer.toString('ascii', +Infinity), ''); assert.strictEqual(rangeBuffer.toString('ascii', 3.14, 3), ''); assert.strictEqual(rangeBuffer.toString('ascii', 'Infinity', 3), ''); -// if end <= 0, empty string will be returned +// If end <= 0, empty string will be returned assert.strictEqual(rangeBuffer.toString('ascii', 1, 0), ''); assert.strictEqual(rangeBuffer.toString('ascii', 1, -1.2), ''); assert.strictEqual(rangeBuffer.toString('ascii', 1, -100), ''); assert.strictEqual(rangeBuffer.toString('ascii', 1, -Infinity), ''); -// if start < 0, start will be taken as zero +// If start < 0, start will be taken as zero assert.strictEqual(rangeBuffer.toString('ascii', -1, 3), 'abc'); assert.strictEqual(rangeBuffer.toString('ascii', -1.99, 3), 'abc'); assert.strictEqual(rangeBuffer.toString('ascii', -Infinity, 3), 'abc'); @@ -78,12 +78,12 @@ assert.strictEqual(rangeBuffer.toString('ascii', 0, '-1.99'), ''); assert.strictEqual(rangeBuffer.toString('ascii', 0, 1.99), 'a'); assert.strictEqual(rangeBuffer.toString('ascii', 0, true), 'a'); -// try toString() with a object as a encoding +// Try toString() with an object as an encoding assert.strictEqual(rangeBuffer.toString({ toString: function() { return 'ascii'; } }), 'abc'); -// try toString() with 0 and null as the encoding +// Try toString() with 0 and null as the encoding common.expectsError(() => { rangeBuffer.toString(0, 1, 2); }, { diff --git a/test/parallel/test-child-process-disconnect.js b/test/parallel/test-child-process-disconnect.js index a1aebf1e08a7cd..8ca39b5790e243 100644 --- a/test/parallel/test-child-process-disconnect.js +++ b/test/parallel/test-child-process-disconnect.js @@ -71,7 +71,7 @@ if (process.argv[2] === 'child') { let childFlag = false; let parentFlag = false; - // when calling .disconnect the event should emit + // When calling .disconnect the event should emit // and the disconnected flag should be true. child.on('disconnect', common.mustCall(function() { parentFlag = child.connected; diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index 48521a7fdafe08..90ce482309b98f 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -35,7 +35,7 @@ if (process.argv[2] === 'child') { console.error(`[${id}] got socket ${m}`); - // will call .end('end') or .write('write'); + // Will call .end('end') or .write('write'); socket[m](m); socket.resume(); diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js index ce916306d14e42..a2ebb3ffeb9385 100644 --- a/test/parallel/test-child-process-silent.js +++ b/test/parallel/test-child-process-silent.js @@ -50,7 +50,7 @@ if (process.argv[2] === 'pipe') { }); } else { - // testcase | start parent && child IPC test + // Testcase | start parent && child IPC test // testing: is stderr and stdout piped to parent const args = [process.argv[1], 'parent']; diff --git a/test/parallel/test-child-process-stdout-flush-exit.js b/test/parallel/test-child-process-stdout-flush-exit.js index 679d78269fc441..cc1fa83fa9aaec 100644 --- a/test/parallel/test-child-process-stdout-flush-exit.js +++ b/test/parallel/test-child-process-stdout-flush-exit.js @@ -23,7 +23,7 @@ const common = require('../common'); const assert = require('assert'); -// if child process output to console and exit +// If child process output to console and exit if (process.argv[2] === 'child') { console.log('hello'); for (let i = 0; i < 200; i++) { diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 5e23a098841ed7..71edc0559755b2 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -14,7 +14,7 @@ assert.throws(() => _validateStdio('foo'), expectedError); // should throw if not a string or array assert.throws(() => _validateStdio(600), expectedError); -// should populate stdio with undefined if len < 3 +// Should populate stdio with undefined if len < 3 { const stdio1 = []; const result = _validateStdio(stdio1, false); @@ -24,7 +24,7 @@ assert.throws(() => _validateStdio(600), expectedError); assert.strictEqual(result.hasOwnProperty('ipcFd'), true); } -// should throw if stdio has ipc and sync is true +// Should throw if stdio has ipc and sync is true const stdio2 = ['ipc', 'ipc', 'ipc']; common.expectsError(() => _validateStdio(stdio2, true), { code: 'ERR_IPC_SYNC_FORK', type: Error } diff --git a/test/parallel/test-cli-syntax-eval.js b/test/parallel/test-cli-syntax-eval.js index cb4c4fd5688642..31fe2d3449d824 100644 --- a/test/parallel/test-cli-syntax-eval.js +++ b/test/parallel/test-cli-syntax-eval.js @@ -6,7 +6,7 @@ const { exec } = require('child_process'); const node = process.execPath; -// should throw if -c and -e flags are both passed +// Should throw if -c and -e flags are both passed ['-c', '--check'].forEach(function(checkFlag) { ['-e', '--eval'].forEach(function(evalFlag) { const args = [checkFlag, evalFlag, 'foo']; diff --git a/test/parallel/test-cli-syntax-piped-bad.js b/test/parallel/test-cli-syntax-piped-bad.js index 64e2d47931eea1..864497e8f75c94 100644 --- a/test/parallel/test-cli-syntax-piped-bad.js +++ b/test/parallel/test-cli-syntax-piped-bad.js @@ -6,7 +6,7 @@ const { spawnSync } = require('child_process'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] diff --git a/test/parallel/test-cli-syntax-piped-good.js b/test/parallel/test-cli-syntax-piped-good.js index 79716fcf394f56..b3467b037212ab 100644 --- a/test/parallel/test-cli-syntax-piped-good.js +++ b/test/parallel/test-cli-syntax-piped-good.js @@ -6,7 +6,7 @@ const { spawnSync } = require('child_process'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] diff --git a/test/parallel/test-cluster-disconnect-idle-worker.js b/test/parallel/test-cluster-disconnect-idle-worker.js index 5b7e73ba079115..63b8b925da0939 100644 --- a/test/parallel/test-cluster-disconnect-idle-worker.js +++ b/test/parallel/test-cluster-disconnect-idle-worker.js @@ -26,7 +26,7 @@ const cluster = require('cluster'); const fork = cluster.fork; if (cluster.isMaster) { - fork(); // it is intentionally called `fork` instead of + fork(); // It is intentionally called `fork` instead of fork(); // `cluster.fork` to test that `this` is not used cluster.disconnect(common.mustCall(() => { assert.deepStrictEqual(Object.keys(cluster.workers), []); diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js index 1528233eb32df0..36def06a4c3dd2 100644 --- a/test/parallel/test-cluster-disconnect.js +++ b/test/parallel/test-cluster-disconnect.js @@ -52,7 +52,7 @@ if (cluster.isWorker) { }); }; - // test both servers created in the cluster + // Test both servers created in the cluster const testCluster = (cb) => { let done = 0; const portsArray = Array.from(serverPorts); diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index d6cccca5f3b2cd..7a3bc1c5cd1311 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -38,7 +38,7 @@ if (cluster.isMaster && process.argv.length !== 3) { const PIPE_NAME = common.PIPE; const worker = cluster.fork({ PIPE_NAME }); - // makes sure master is able to fork the worker + // Makes sure master is able to fork the worker cluster.on('fork', common.mustCall()); // makes sure the worker is ready @@ -57,14 +57,14 @@ if (cluster.isMaster && process.argv.length !== 3) { // Message from the child indicates it's ready and listening cp.on('message', common.mustCall(function() { const server = net.createServer().listen(PIPE_NAME, function() { - // message child process so that it can exit + // Message child process so that it can exit cp.send('end'); - // inform master about the unexpected situation + // Inform master about the unexpected situation process.send('PIPE should have been in use.'); }); server.on('error', function(err) { - // message to child process tells it to exit + // Message to child process tells it to exit cp.send('end'); // propagate error to parent process.send(err); diff --git a/test/parallel/test-cluster-master-kill.js b/test/parallel/test-cluster-master-kill.js index 4e21d8e906cfaf..2cc800398147f6 100644 --- a/test/parallel/test-cluster-master-kill.js +++ b/test/parallel/test-cluster-master-kill.js @@ -64,7 +64,7 @@ if (cluster.isWorker) { let alive = true; master.on('exit', common.mustCall((code) => { - // make sure that the master died on purpose + // Make sure that the master died on purpose assert.strictEqual(code, 0); // check worker process status diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index bb2d3495d95a4d..1f2978bdb5b406 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -67,7 +67,7 @@ if (cluster.isWorker) { // start worker const worker = cluster.fork(); - // when the worker is up and running, kill it + // When the worker is up and running, kill it worker.once('listening', common.mustCall(() => { worker.process.kill(KILL_SIGNAL); })); diff --git a/test/parallel/test-cluster-worker-no-exit.js b/test/parallel/test-cluster-worker-no-exit.js index d3ee67994bd474..7325759741592c 100644 --- a/test/parallel/test-cluster-worker-no-exit.js +++ b/test/parallel/test-cluster-worker-no-exit.js @@ -50,7 +50,7 @@ if (cluster.isMaster) { destroyed = true; }, 1000); }).once('exit', function() { - // worker should not exit while it has a connection + // Worker should not exit while it has a connection assert(destroyed, 'worker exited before connection destroyed'); success = true; }); diff --git a/test/parallel/test-cluster-worker-wait-server-close.js b/test/parallel/test-cluster-worker-wait-server-close.js index 849591e5734af9..ad3320327acd29 100644 --- a/test/parallel/test-cluster-worker-wait-server-close.js +++ b/test/parallel/test-cluster-worker-wait-server-close.js @@ -24,7 +24,7 @@ if (cluster.isWorker) { // Check worker events and properties process.once('disconnect', function() { - // disconnect should occur after socket close + // Disconnect should occur after socket close assert(serverClosed); clearInterval(keepOpen); }); diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index e94b6020652463..4a7a2fda683ef6 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -145,7 +145,7 @@ console.dirxml( // test console.trace() console.trace('This is a %j %d', { formatted: 'trace' }, 10, 'foo'); -// test console.time() and console.timeEnd() output +// Test console.time() and console.timeEnd() output console.time('label'); console.timeEnd('label'); diff --git a/test/parallel/test-constants.js b/test/parallel/test-constants.js index 945443d8866a2f..e68f972d36aa9a 100644 --- a/test/parallel/test-constants.js +++ b/test/parallel/test-constants.js @@ -19,7 +19,7 @@ assert.ok(binding.crypto); assert.strictEqual(binding[l][k][j], constants[j]); }); } - if (l !== 'os') { // top level os constant isn't currently copied + if (l !== 'os') { // Top level os constant isn't currently copied assert.strictEqual(binding[l][k], constants[k]); } }); diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 414404511f9064..c1abf12b8be3a3 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -199,7 +199,7 @@ for (const test of TEST_CASES) { } { - // trying to get tag before inputting all data: + // Trying to get tag before inputting all data: const encrypt = crypto.createCipheriv(test.algo, Buffer.from(test.key, 'hex'), Buffer.from(test.iv, 'hex'), @@ -209,7 +209,7 @@ for (const test of TEST_CASES) { } { - // trying to create cipher with incorrect IV length + // Trying to create cipher with incorrect IV length assert.throws(function() { crypto.createCipheriv( test.algo, diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 228e2cc8abdc81..bb0247bf5817b5 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -465,7 +465,7 @@ function testCipher1(key) { const plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; const cipher = crypto.createCipher('aes192', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in hex let ciph = cipher.update(plaintext, 'utf8', 'hex'); // Only use binary or hex, not base64. @@ -488,7 +488,7 @@ function testCipher2(key) { 'jAfaFg**'; const cipher = crypto.createCipher('aes256', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in Base64 let ciph = cipher.update(plaintext, 'utf8', 'base64'); ciph += cipher.final('base64'); diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index dfa01e2422c23b..9f79abc70545dd 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -24,7 +24,7 @@ function testCipher1(key) { const plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; const cipher = crypto.createCipher('aes192', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in hex let ciph = cipher.update(plaintext, 'utf8', 'hex'); // Only use binary or hex, not base64. @@ -61,7 +61,7 @@ function testCipher2(key) { 'jAfaFg**'; const cipher = crypto.createCipher('aes256', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in Base64 let ciph = cipher.update(plaintext, 'utf8', 'base64'); ciph += cipher.final('base64'); diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 8e584100d9913b..5a63667c995b09 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -374,7 +374,7 @@ if (availableCurves.has('prime256v1') && availableHashes.has('sha256')) { crypto.createSign('SHA256').sign(ecPrivateKey); } -// invalid test: curve argument is undefined +// Invalid test: curve argument is undefined common.expectsError( () => crypto.createECDH(), { diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index 70bac93a9961cf..56d0cb72079f82 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -42,7 +42,7 @@ while (ucs2_control.length <= EXTERN_APEX) { } -// check resultant buffer and output string +// Check resultant buffer and output string const b = Buffer.from(ucs2_control + ucs2_control, 'ucs2'); // diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 60904cf08fec3d..de15f00bc918aa 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -81,7 +81,7 @@ assert.deepStrictEqual( `${cryptoType} with ${digest} digest failed to evaluate to expected hash` ); -// stream interface should produce the same result. +// Stream interface should produce the same result. assert.deepStrictEqual(a5, a3); assert.deepStrictEqual(a6, a3); assert.notStrictEqual(a7, undefined); diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index 4c85545b4e40b1..deacb45e8fa9dd 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -33,7 +33,7 @@ const { kMaxLength } = require('buffer'); const kMaxUint32 = Math.pow(2, 32) - 1; const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32); -// bump, we register a lot of exit listeners +// Bump, we register a lot of exit listeners process.setMaxListeners(256); common.expectWarning('DeprecationWarning', diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index 47e87b34be5bb3..5b1ef68106cfda 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -40,7 +40,7 @@ const server = http.createServer(function(req, res) { dom.on('error', function(er) { serverCaught++; console.log('horray! got a server error', er); - // try to send a 500. If that fails, oh well. + // Try to send a 500. If that fails, oh well. res.writeHead(500, { 'content-type': 'text/plain' }); res.end(er.stack || er.message || 'Unknown error'); }); @@ -50,7 +50,7 @@ const server = http.createServer(function(req, res) { // if you request 'baz', then it'll throw a JSON circular ref error. const data = JSON.stringify(objects[req.url.replace(/[^a-z]/g, '')]); - // this line will throw if you pick an unknown key + // This line will throw if you pick an unknown key assert.notStrictEqual(data, undefined); res.writeHead(200); diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index c38a07fef76b8c..e053d061610b11 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -48,7 +48,7 @@ const fileData = fs.readFileSync(filename); assert.strictEqual(Buffer.byteLength(data), fileData.length); -// test that appends data to a non empty file +// Test that appends data to a non empty file const filename2 = join(tmpdir.path, 'append-sync2.txt'); fs.writeFileSync(filename2, currentFileData); @@ -59,7 +59,7 @@ const fileData2 = fs.readFileSync(filename2); assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, fileData2.length); -// test that appendFileSync accepts buffers +// Test that appendFileSync accepts buffers const filename3 = join(tmpdir.path, 'append-sync3.txt'); fs.writeFileSync(filename3, currentFileData); @@ -87,7 +87,7 @@ const fileData4 = fs.readFileSync(filename4); assert.strictEqual(Buffer.byteLength(String(num)) + currentFileData.length, fileData4.length); -// test that appendFile accepts file descriptors +// Test that appendFile accepts file descriptors const filename5 = join(tmpdir.path, 'append-sync5.txt'); fs.writeFileSync(filename5, currentFileData); diff --git a/test/parallel/test-fs-long-path.js b/test/parallel/test-fs-long-path.js index 74f63868b81054..11ec4d56fcea3f 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -30,7 +30,7 @@ const assert = require('assert'); const tmpdir = require('../common/tmpdir'); -// make a path that will be at least 260 chars long. +// Make a path that will be at least 260 chars long. const fileNameLen = Math.max(260 - tmpdir.path.length - 1, 1); const fileName = path.join(tmpdir.path, 'x'.repeat(fileNameLen)); const fullPath = path.resolve(fileName); diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index d07aab53769299..f2ed9b9f68ed92 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -33,7 +33,7 @@ function nextdir() { return `test${++dirc}`; } -// mkdir creates directory using assigned path +// fs.mkdir creates directory using assigned path { const pathname = path.join(tmpdir.path, nextdir()); @@ -43,7 +43,7 @@ function nextdir() { })); } -// mkdir creates directory with assigned mode value +// fs.mkdir creates directory with assigned mode value { const pathname = path.join(tmpdir.path, nextdir()); diff --git a/test/parallel/test-fs-promises.js b/test/parallel/test-fs-promises.js index c4143fbb9bd027..749e0a6f087107 100644 --- a/test/parallel/test-fs-promises.js +++ b/test/parallel/test-fs-promises.js @@ -254,7 +254,7 @@ async function getHandle(dest) { await unlink(newLink); } - // testing readdir lists both files and directories + // Testing readdir lists both files and directories { const newDir = path.resolve(tmpDir, 'dir'); const newFile = path.resolve(tmpDir, 'foo.js'); @@ -326,8 +326,8 @@ async function getHandle(dest) { assert(stats.isDirectory()); } - // mkdirp require recursive option to be a boolean. - // Anything else generates an error. + // fs.mkdirp requires the recursive option to be of type boolean. + // Everything else generates an error. { const dir = path.join(tmpDir, nextdir(), nextdir()); ['', 1, {}, [], null, Symbol('test'), () => {}].forEach((recursive) => { diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index 740a3876a2d76c..b2b5192c789271 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -// simulate `cat readfile.js | node readfile.js` +// Simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAIX) common.skip(`No /dev/stdin on ${process.platform}.`); diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index c9f7144c11a6f6..861ce20cfc798d 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -22,7 +22,7 @@ 'use strict'; const common = require('../common'); -// simulate `cat readfile.js | node readfile.js` +// Simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAIX) common.skip(`No /dev/stdin on ${process.platform}.`); diff --git a/test/parallel/test-fs-readfile-zero-byte-liar.js b/test/parallel/test-fs-readfile-zero-byte-liar.js index ec0b9cf6922c8c..a3ba3985abd959 100644 --- a/test/parallel/test-fs-readfile-zero-byte-liar.js +++ b/test/parallel/test-fs-readfile-zero-byte-liar.js @@ -29,7 +29,7 @@ const fs = require('fs'); const dataExpected = fs.readFileSync(__filename, 'utf8'); -// sometimes stat returns size=0, but it's a lie. +// Sometimes stat returns size=0, but it's a lie. fs._fstat = fs.fstat; fs._fstatSync = fs.fstatSync; diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index cfa7ae06ac08e8..f8ad5a63318481 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -// simulate `cat readfile.js | node readfile.js` +// Simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAIX) common.skip(`No /dev/stdin on ${process.platform}.`); diff --git a/test/parallel/test-fs-watchfile-bigint.js b/test/parallel/test-fs-watchfile-bigint.js index 76c619260e00d8..d5528bb2d3730f 100644 --- a/test/parallel/test-fs-watchfile-bigint.js +++ b/test/parallel/test-fs-watchfile-bigint.js @@ -52,7 +52,7 @@ const watcher = assert(prev.ino <= 0n); // Stop watching the file fs.unwatchFile(enoentFile); - watcher.stop(); // stopping a stopped watcher should be a noop + watcher.stop(); // Stopping a stopped watcher should be a noop } }, 2)); @@ -60,4 +60,4 @@ const watcher = // not trigger a 'stop' event. watcher.on('stop', common.mustCall(function onStop() {})); -watcher.start(); // starting a started watcher should be a noop +watcher.start(); // Starting a started watcher should be a noop diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index b3618792cdc756..0b28e0331d3f91 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -74,7 +74,7 @@ const watcher = assert(prev.ino <= 0); // Stop watching the file fs.unwatchFile(enoentFile); - watcher.stop(); // stopping a stopped watcher should be a noop + watcher.stop(); // Stopping a stopped watcher should be a noop } }, 2)); @@ -82,7 +82,7 @@ const watcher = // not trigger a 'stop' event. watcher.on('stop', common.mustCall(function onStop() {})); -watcher.start(); // starting a started watcher should be a noop +watcher.start(); // Starting a started watcher should be a noop // Watch events should callback with a filename on supported systems. // Omitting AIX. It works but not reliably. diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js index b137e55547201e..7f0ec116f1c632 100644 --- a/test/parallel/test-fs-write-file.js +++ b/test/parallel/test-fs-write-file.js @@ -82,7 +82,7 @@ fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) { })); })); -// test that writeFile accepts file descriptors +// Test that writeFile accepts file descriptors const filename4 = join(tmpdir.path, 'test4.txt'); fs.open(filename4, 'w+', common.mustCall(function(e, fd) { diff --git a/test/parallel/test-http-addrequest-localaddress.js b/test/parallel/test-http-addrequest-localaddress.js index ce2ae8d12e2b9a..5e4da01ab4a22d 100644 --- a/test/parallel/test-http-addrequest-localaddress.js +++ b/test/parallel/test-http-addrequest-localaddress.js @@ -15,17 +15,16 @@ const req = { agent.maxSockets = 0; -// localAddress is used when naming requests / sockets -// while using the Legacy API -// port 8080 is hardcoded since this does not create a network connection +// `localAddress` is used when naming requests / sockets while using the Legacy +// API. Port 8080 is hardcoded since this does not create a network connection. agent.addRequest(req, 'localhost', 8080, '127.0.0.1'); assert.strictEqual(Object.keys(agent.requests).length, 1); assert.strictEqual( Object.keys(agent.requests)[0], 'localhost:8080:127.0.0.1'); -// path is *not* used when naming requests / sockets -// port 8080 is hardcoded since this does not create a network connection +// `path` is *not* used when naming requests / sockets. +// Port 8080 is hardcoded since this does not create a network connection agent.addRequest(req, { host: 'localhost', port: 8080, diff --git a/test/parallel/test-http-agent-destroyed-socket.js b/test/parallel/test-http-agent-destroyed-socket.js index 7dbc1db9f93388..145dc484248ef0 100644 --- a/test/parallel/test-http-agent-destroyed-socket.js +++ b/test/parallel/test-http-agent-destroyed-socket.js @@ -49,7 +49,7 @@ const server = http.createServer(common.mustCall((req, res) => { request1.socket.destroy(); response.socket.once('close', common.mustCall(() => { - // assert request2 was removed from the queue + // Assert request2 was removed from the queue assert(!agent.requests[key]); process.nextTick(() => { // Assert that the same socket was not assigned to request2, diff --git a/test/parallel/test-http-agent-keepalive.js b/test/parallel/test-http-agent-keepalive.js index 917c4ee8101f9e..4d682a89ab7a54 100644 --- a/test/parallel/test-http-agent-keepalive.js +++ b/test/parallel/test-http-agent-keepalive.js @@ -39,7 +39,7 @@ const server = http.createServer(common.mustCall((req, res) => { res.destroy(); return; } else if (req.url === '/remote_close') { - // cache the socket, close it after a short delay + // Cache the socket, close it after a short delay const socket = res.connection; setImmediate(common.mustCall(() => socket.end())); } diff --git a/test/parallel/test-http-client-pipe-end.js b/test/parallel/test-http-client-pipe-end.js index 9aa645b12a2866..ee88ce3d96672a 100644 --- a/test/parallel/test-http-client-pipe-end.js +++ b/test/parallel/test-http-client-pipe-end.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// see https://github.com/joyent/node/issues/3257 +// See https://github.com/joyent/node/issues/3257 const common = require('../common'); const http = require('http'); diff --git a/test/parallel/test-http-incoming-matchKnownFields.js b/test/parallel/test-http-incoming-matchKnownFields.js index 14ba8acd021f68..4402cc519a8c76 100644 --- a/test/parallel/test-http-incoming-matchKnownFields.js +++ b/test/parallel/test-http-incoming-matchKnownFields.js @@ -7,7 +7,7 @@ function checkDest(field, result, value) { const dest = {}; const incomingMessage = new IncomingMessage(field); - // dest is changed by IncomingMessage._addHeaderLine + // Dest is changed by IncomingMessage._addHeaderLine if (value) incomingMessage._addHeaderLine(field, 'test', dest); incomingMessage._addHeaderLine(field, value, dest); diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 8e63bdb8a9bbd2..c3aa86fc745b7b 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -45,7 +45,7 @@ const server = http.createServer(common.mustCall(function(req, res) { server.emit('requestDone'); }); - // in one case, actually send a response in 2 chunks + // In one case, actually send a response in 2 chunks case '/3': res.write('hello '); return setImmediate(function() { @@ -78,7 +78,7 @@ server.listen(0, common.mustCall(function() { countdown.dec(); }); - // immediately write the pipelined requests. + // Immediately write the pipelined requests. // Some of these will not have a socket to destroy! client.write(generator(seeds)); })); diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js index 1fcd7cd0769db1..d5b94eb0f65b8f 100644 --- a/test/parallel/test-http-outgoing-finish.js +++ b/test/parallel/test-http-outgoing-finish.js @@ -48,7 +48,7 @@ function write(out) { let finishEvent = false; let endCb = false; - // first, write until it gets some backpressure + // First, write until it gets some backpressure while (out.write(buf)) {} // Now end, and make sure that we don't get the 'finish' event diff --git a/test/parallel/test-http-outgoing-settimeout.js b/test/parallel/test-http-outgoing-settimeout.js index 3dd27686153672..6e46973bc10631 100644 --- a/test/parallel/test-http-outgoing-settimeout.js +++ b/test/parallel/test-http-outgoing-settimeout.js @@ -17,7 +17,7 @@ const { OutgoingMessage } = require('http'); } { - // tests for settimeout method without socket + // Tests for settimeout method without socket const expectedMsecs = 23; const outgoingMessage = new OutgoingMessage(); outgoingMessage.setTimeout(expectedMsecs); diff --git a/test/parallel/test-http-readable-data-event.js b/test/parallel/test-http-readable-data-event.js index 1c48a451ef9714..ddaeca5fe7103c 100644 --- a/test/parallel/test-http-readable-data-event.js +++ b/test/parallel/test-http-readable-data-event.js @@ -13,7 +13,7 @@ const server = http.createServer((req, res) => { 'Content-Length': '' + (helloWorld.length + helloAgainLater.length) }); - // we need to make sure the data is flushed + // We need to make sure the data is flushed // before writing again next = () => { res.end(helloAgainLater); diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js index 72268efcae3a84..39ac800d0d736c 100644 --- a/test/parallel/test-http-res-write-end-dont-take-array.js +++ b/test/parallel/test-http-res-write-end-dont-take-array.js @@ -61,7 +61,7 @@ server.once('request', common.mustCall((req, res) => { })); server.listen(0, function() { - // just make a request, other tests handle responses + // Just make a request, other tests handle responses http.get({ port: this.address().port }, (res) => { res.resume(); // do it again to test .end(Buffer); diff --git a/test/parallel/test-http-set-timeout-server.js b/test/parallel/test-http-set-timeout-server.js index 7984fdfc0ffbf0..793046e57f0786 100644 --- a/test/parallel/test-http-set-timeout-server.js +++ b/test/parallel/test-http-set-timeout-server.js @@ -58,7 +58,7 @@ test(function serverTimeout(cb) { test(function serverRequestTimeout(cb) { const server = http.createServer(common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -79,7 +79,7 @@ test(function serverRequestTimeout(cb) { test(function serverResponseTimeout(cb) { const server = http.createServer(common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = res.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -96,7 +96,7 @@ test(function serverResponseTimeout(cb) { test(function serverRequestNotTimeoutAfterEnd(cb) { const server = http.createServer(common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); res.on('timeout', common.mustCall()); diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index 74eff427a43d30..3252ac7fc0af2a 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -97,7 +97,7 @@ server.on('listening', function() { }); }); -// now, see if the client sees the trailers. +// Now, see if the client sees the trailers. server.on('listening', function() { http.get({ port: this.address().port, diff --git a/test/parallel/test-http-upgrade-server2.js b/test/parallel/test-http-upgrade-server2.js index a6c142e60ac9aa..1a4d4038a50f8b 100644 --- a/test/parallel/test-http-upgrade-server2.js +++ b/test/parallel/test-http-upgrade-server2.js @@ -30,7 +30,7 @@ const server = http.createServer(function(req, res) { }); server.on('upgrade', function(req, socket, upgradeHead) { - // test that throwing an error from upgrade gets + // Test that throwing an error from upgrade gets // is uncaught throw new Error('upgrade error'); }); diff --git a/test/parallel/test-http-url.parse-auth-with-header-in-request.js b/test/parallel/test-http-url.parse-auth-with-header-in-request.js index eb96ac19c172ff..7a9a486bcc5dde 100644 --- a/test/parallel/test-http-url.parse-auth-with-header-in-request.js +++ b/test/parallel/test-http-url.parse-auth-with-header-in-request.js @@ -26,7 +26,7 @@ const http = require('http'); const url = require('url'); function check(request) { - // the correct authorization header is be passed + // The correct authorization header is be passed assert.strictEqual(request.headers.authorization, 'NoAuthForYOU'); } diff --git a/test/parallel/test-http-url.parse-auth.js b/test/parallel/test-http-url.parse-auth.js index ab597e132c8012..ac09c0e1b84216 100644 --- a/test/parallel/test-http-url.parse-auth.js +++ b/test/parallel/test-http-url.parse-auth.js @@ -26,7 +26,7 @@ const http = require('http'); const url = require('url'); function check(request) { - // the correct authorization header is be passed + // The correct authorization header is be passed assert.strictEqual(request.headers.authorization, 'Basic dXNlcjpwYXNzOg=='); } diff --git a/test/parallel/test-http-url.parse-basic.js b/test/parallel/test-http-url.parse-basic.js index c900d045d359b8..e68df80e9151d7 100644 --- a/test/parallel/test-http-url.parse-basic.js +++ b/test/parallel/test-http-url.parse-basic.js @@ -33,7 +33,7 @@ function check(request) { assert.strictEqual(request.method, 'GET'); // There are no URL params, so you should not see any assert.strictEqual(request.url, '/'); - // the host header should use the url.parse.hostname + // The host header should use the url.parse.hostname assert.strictEqual(request.headers.host, `${testURL.hostname}:${testURL.port}`); } @@ -51,7 +51,7 @@ server.listen(0, function() { // make the request const clientRequest = http.request(testURL); - // since there is a little magic with the agent + // Since there is a little magic with the agent // make sure that an http request uses the http.Agent assert.ok(clientRequest.agent instanceof http.Agent); clientRequest.end(); diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index f58be0257c1fc5..6ca9e51e826859 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -54,7 +54,7 @@ server.listen(0, function() { // make the request const clientRequest = https.request(testURL); - // since there is a little magic with the agent + // Since there is a little magic with the agent // make sure that the request uses the https.Agent assert.ok(clientRequest.agent instanceof https.Agent); clientRequest.end(); diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index 83dfcfa20bdb1e..320359e3ec37bf 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -41,7 +41,7 @@ const s = http.createServer(common.mustCall((req, res) => { } ); - // undefined value should throw, via 979d0ca8 + // Undefined value should throw, via 979d0ca8 common.expectsError( () => res.setHeader('foo', undefined), { diff --git a/test/parallel/test-http2-client-destroy.js b/test/parallel/test-http2-client-destroy.js index 0a538e0f9e01e0..6c4adfe5b449c3 100644 --- a/test/parallel/test-http2-client-destroy.js +++ b/test/parallel/test-http2-client-destroy.js @@ -112,7 +112,7 @@ const Countdown = require('../common/countdown'); client.on('close', () => { server.close(); - // calling destroy in here should not matter + // Calling destroy in here should not matter client.destroy(); }); diff --git a/test/parallel/test-http2-client-onconnect-errors.js b/test/parallel/test-http2-client-onconnect-errors.js index ab166c22f0e9de..5c08478784924a 100644 --- a/test/parallel/test-http2-client-onconnect-errors.js +++ b/test/parallel/test-http2-client-onconnect-errors.js @@ -14,7 +14,7 @@ const { const http2 = require('http2'); const { NghttpError } = require('internal/http2/util'); -// tests error handling within requestOnConnect +// Tests error handling within requestOnConnect // - NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE (should emit session error) // - NGHTTP2_ERR_INVALID_ARGUMENT (should emit stream error) // - every other NGHTTP2 error from binding (should emit session error) diff --git a/test/parallel/test-http2-client-set-priority.js b/test/parallel/test-http2-client-set-priority.js index 411b762be89f0f..c41ec99031724a 100644 --- a/test/parallel/test-http2-client-set-priority.js +++ b/test/parallel/test-http2-client-set-priority.js @@ -27,7 +27,7 @@ const checkWeight = (actual, expect) => { })); }; -// when client weight is lower than 1, weight is 1 +// When client weight is lower than 1, weight is 1 checkWeight(-1, 1); checkWeight(0, 1); diff --git a/test/parallel/test-http2-compat-serverrequest-end.js b/test/parallel/test-http2-compat-serverrequest-end.js index 45a678d1a950d1..cee5fa47ad4744 100644 --- a/test/parallel/test-http2-compat-serverrequest-end.js +++ b/test/parallel/test-http2-compat-serverrequest-end.js @@ -18,7 +18,7 @@ server.listen(0, common.mustCall(function() { request.on('end', common.mustCall(() => { assert.strictEqual(request.complete, true); response.on('finish', common.mustCall(function() { - // the following tests edge cases on request socket + // The following tests edge cases on request socket // right after finished fires but before backing // Http2Stream is destroyed assert.strictEqual(request.socket.readable, request.stream.readable); diff --git a/test/parallel/test-http2-compat-serverresponse-createpushresponse.js b/test/parallel/test-http2-compat-serverresponse-createpushresponse.js index 1992d41af69a5d..5790a9942ce680 100644 --- a/test/parallel/test-http2-compat-serverresponse-createpushresponse.js +++ b/test/parallel/test-http2-compat-serverresponse-createpushresponse.js @@ -15,7 +15,7 @@ const server = h2.createServer((request, response) => { assert.strictEqual(response.stream.id % 2, 1); response.write(servExpect); - // callback must be specified (and be a function) + // Callback must be specified (and be a function) common.expectsError( () => response.createPushResponse({ ':path': '/pushed', diff --git a/test/parallel/test-http2-compat-serverresponse-end.js b/test/parallel/test-http2-compat-serverresponse-end.js index 0e846a5948e3cc..d7aaebca3d169c 100644 --- a/test/parallel/test-http2-compat-serverresponse-end.js +++ b/test/parallel/test-http2-compat-serverresponse-end.js @@ -253,7 +253,7 @@ const { } { - // finish should only trigger after 'end' is called + // Finish should only trigger after 'end' is called const server = createServer(mustCall((request, response) => { let finished = false; response.writeHead(HTTP_STATUS_OK, { foo: 'bar' }); diff --git a/test/parallel/test-http2-connect.js b/test/parallel/test-http2-connect.js index 6080dcb90e4c01..bef4ff79604ada 100644 --- a/test/parallel/test-http2-connect.js +++ b/test/parallel/test-http2-connect.js @@ -6,7 +6,7 @@ if (!hasCrypto) const { createServer, connect } = require('http2'); const { connect: netConnect } = require('net'); -// check for session connect callback and event +// Check for session connect callback and event { const server = createServer(); server.listen(0, mustCall(() => { diff --git a/test/parallel/test-http2-dont-lose-data.js b/test/parallel/test-http2-dont-lose-data.js index eb85277b7b124c..c73208f9555044 100644 --- a/test/parallel/test-http2-dont-lose-data.js +++ b/test/parallel/test-http2-dont-lose-data.js @@ -43,7 +43,7 @@ server.listen(0, () => { pushStream.on('end', common.mustCall(() => { assert.strictEqual(pushData, 'a push stream'); - // removing the setImmediate causes the test to pass + // Removing the setImmediate causes the test to pass setImmediate(function() { let data = ''; req.setEncoding('utf8'); diff --git a/test/parallel/test-http2-info-headers-errors.js b/test/parallel/test-http2-info-headers-errors.js index 6540747fd25a5f..a55e9df0269283 100644 --- a/test/parallel/test-http2-info-headers-errors.js +++ b/test/parallel/test-http2-info-headers-errors.js @@ -13,7 +13,7 @@ const { } = internalBinding('http2'); const { NghttpError } = require('internal/http2/util'); -// tests error handling within additionalHeaders +// Tests error handling within additionalHeaders // - every other NGHTTP2 error from binding (should emit stream error) const specificTestKeys = []; diff --git a/test/parallel/test-http2-misbehaving-multiplex.js b/test/parallel/test-http2-misbehaving-multiplex.js index b0b501eacbc5dd..3df3a6f893ddb8 100644 --- a/test/parallel/test-http2-misbehaving-multiplex.js +++ b/test/parallel/test-http2-misbehaving-multiplex.js @@ -17,7 +17,7 @@ server.on('stream', common.mustCall((stream) => { stream.respond(); stream.end('ok'); - // the error will be emitted asynchronously + // The error will be emitted asynchronously stream.on('error', common.expectsError({ type: NghttpError, code: 'ERR_HTTP2_ERROR', diff --git a/test/parallel/test-http2-respond-with-fd-errors.js b/test/parallel/test-http2-respond-with-fd-errors.js index f336d9caac1f8f..4e876c532fad45 100644 --- a/test/parallel/test-http2-respond-with-fd-errors.js +++ b/test/parallel/test-http2-respond-with-fd-errors.js @@ -18,7 +18,7 @@ const { } = internalBinding('http2'); const { NghttpError } = require('internal/http2/util'); -// tests error handling within processRespondWithFD +// Tests error handling within processRespondWithFD // (called by respondWithFD & respondWithFile) // - every other NGHTTP2 error from binding (should emit stream error) diff --git a/test/parallel/test-http2-server-errors.js b/test/parallel/test-http2-server-errors.js index bbdf312fc153d4..eeb9e79682e344 100644 --- a/test/parallel/test-http2-server-errors.js +++ b/test/parallel/test-http2-server-errors.js @@ -59,7 +59,7 @@ const h2 = require('http2'); })); server.on('stream', common.mustCall(function(stream) { - // there is no 'error' handler, and this will crash + // There is no 'error' handler, and this will crash stream.write('hello'); stream.resume(); diff --git a/test/parallel/test-http2-window-size.js b/test/parallel/test-http2-window-size.js index 164a778e1f8c54..adf4534d5bc92b 100644 --- a/test/parallel/test-http2-window-size.js +++ b/test/parallel/test-http2-window-size.js @@ -89,7 +89,7 @@ const initialWindowSizeList = [ (1 << 8) - 1, 1 << 8, 1 << 17, - undefined // use default window size which is (1 << 16) - 1 + undefined // Use default window size which is (1 << 16) - 1 ]; // Call `run` on each element in the cartesian product of buffersList and diff --git a/test/parallel/test-https-set-timeout-server.js b/test/parallel/test-https-set-timeout-server.js index e353f0afde5a92..c67155e9d53143 100644 --- a/test/parallel/test-https-set-timeout-server.js +++ b/test/parallel/test-https-set-timeout-server.js @@ -71,7 +71,7 @@ test(function serverRequestTimeout(cb) { const server = https.createServer( serverOptions, common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -95,7 +95,7 @@ test(function serverResponseTimeout(cb) { const server = https.createServer( serverOptions, common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = res.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -115,7 +115,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) { const server = https.createServer( serverOptions, common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); res.on('timeout', common.mustCall()); diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index a7f4b80716c917..f849ae800fc016 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -57,7 +57,7 @@ const cert3 = read('agent3-cert.pem'); const ca1 = read('ca1-cert.pem'); const ca2 = read('ca2-cert.pem'); -// different agents to use different CA lists. +// Different agents to use different CA lists. // this api is beyond bad. const agent0 = new https.Agent(); const agent1 = new https.Agent({ ca: [ca1] }); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index bc81a8da0bc312..416adb39357ae1 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -65,7 +65,7 @@ test(function(parent, port) { s += c.toString(); }); res.on('end', function() { - // kill the worker before we start doing asserts. + // Kill the worker before we start doing asserts. // it's really annoying when tests leave orphans! parent.kill(); parent.on('exit', function() { diff --git a/test/parallel/test-net-keepalive.js b/test/parallel/test-net-keepalive.js index 49331abf040a30..9cc08af8fe4372 100644 --- a/test/parallel/test-net-keepalive.js +++ b/test/parallel/test-net-keepalive.js @@ -29,7 +29,7 @@ let clientConnection; const echoServer = net.createServer(function(connection) { serverConnection = connection; setTimeout(common.mustCall(function() { - // make sure both connections are still open + // Make sure both connections are still open assert.strictEqual(serverConnection.readyState, 'open'); assert.strictEqual(clientConnection.readyState, 'open'); serverConnection.end(); diff --git a/test/parallel/test-net-persistent-keepalive.js b/test/parallel/test-net-persistent-keepalive.js index 8756cd7d1b2960..85a2950273a6a3 100644 --- a/test/parallel/test-net-persistent-keepalive.js +++ b/test/parallel/test-net-persistent-keepalive.js @@ -8,7 +8,7 @@ let clientConnection; const echoServer = net.createServer(function(connection) { serverConnection = connection; setTimeout(function() { - // make sure both connections are still open + // Make sure both connections are still open assert.strictEqual(serverConnection.readyState, 'open'); assert.strictEqual(clientConnection.readyState, 'open'); serverConnection.end(); diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index e80731bc78fb0a..dda2d5acadb751 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -17,7 +17,7 @@ const server = net.createServer((socket) => { }); server.on('close', common.mustCall(() => { - // client and server should agree on the ports used + // Client and server should agree on the ports used assert.deepStrictEqual(serverRemotePorts, clientLocalPorts); assert.strictEqual(conns, 2); })); diff --git a/test/parallel/test-path-resolve.js b/test/parallel/test-path-resolve.js index abbbf4dd5f47b4..79c2d679204007 100644 --- a/test/parallel/test-path-resolve.js +++ b/test/parallel/test-path-resolve.js @@ -11,7 +11,7 @@ const backslashRE = /\\/g; const resolveTests = [ [ path.win32.resolve, - // arguments result + // Arguments result [[['c:/blah\\blah', 'd:/games', 'c:../a'], 'c:\\blah\\a'], [['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'], 'd:\\e.exe'], [['c:/ignore', 'c:/some/file'], 'c:\\some\\file'], diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 566a3eec546ba2..e54fa385fe3277 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -43,7 +43,7 @@ childProcess.exec( } ); -// test that preloading a throwing module aborts +// Test that preloading a throwing module aborts childProcess.exec( `"${nodeBinary}" ${preloadOption([fixtureA, fixtureThrows])} "${fixtureB}"`, function(err, stdout, stderr) { @@ -55,7 +55,7 @@ childProcess.exec( } ); -// test that preload can be used with --eval +// Test that preload can be used with --eval childProcess.exec( `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');"`, function(err, stdout, stderr) { @@ -64,7 +64,7 @@ childProcess.exec( } ); -// test that preload can be used with stdin +// Test that preload can be used with stdin const stdinProc = childProcess.spawn( nodeBinary, ['--require', fixtureA], @@ -132,7 +132,7 @@ childProcess.exec( } ); -// test that preloading with a relative path works +// Test that preloading with a relative path works process.chdir(fixtures.fixturesDir); childProcess.exec( `"${nodeBinary}" ${preloadOption(['./printA.js'])} "${fixtureB}"`, diff --git a/test/parallel/test-priority-queue.js b/test/parallel/test-priority-queue.js index f8526e6521c24b..f6318ede7ffbca 100644 --- a/test/parallel/test-priority-queue.js +++ b/test/parallel/test-priority-queue.js @@ -116,11 +116,11 @@ const PriorityQueue = require('internal/priority_queue'); queue.removeAt(5); assert.strictEqual(largest.position, 5); - // check that removing 2nd to last item works fine + // Check that removing 2nd to last item works fine queue.removeAt(6); assert.strictEqual(secondLargest.position, 6); - // check that removing the last item doesn't throw + // Check that removing the last item doesn't throw queue.removeAt(6); assert.strictEqual(queue.shift().value, 1); diff --git a/test/parallel/test-process-env-allowed-flags.js b/test/parallel/test-process-env-allowed-flags.js index ad0e05f69bb909..9edc3504efa859 100644 --- a/test/parallel/test-process-env-allowed-flags.js +++ b/test/parallel/test-process-env-allowed-flags.js @@ -48,7 +48,7 @@ require('../common'); }); } -// assert all "canonical" flags begin with dash(es) +// Assert all "canonical" flags begin with dash(es) { process.allowedNodeEnvironmentFlags.forEach((flag) => { assert(/^--?[a-z0-9._-]+$/.test(flag), diff --git a/test/parallel/test-process-external-stdio-close-spawn.js b/test/parallel/test-process-external-stdio-close-spawn.js index 93d7f795bd74ce..f7ee37c44629cd 100644 --- a/test/parallel/test-process-external-stdio-close-spawn.js +++ b/test/parallel/test-process-external-stdio-close-spawn.js @@ -7,7 +7,7 @@ const cp = require('child_process'); if (process.argv[2] === 'child') { process.on('message', common.mustCall((msg) => { assert.strictEqual(msg, 'go'); - // the following console.log is an integral part + // The following console.log is an integral part // of the test. If this regress, this call will // cause the process to exit with 1 console.log('logging should not cause a crash'); diff --git a/test/parallel/test-process-external-stdio-close.js b/test/parallel/test-process-external-stdio-close.js index 067a75ec93492a..9457161cf5ac91 100644 --- a/test/parallel/test-process-external-stdio-close.js +++ b/test/parallel/test-process-external-stdio-close.js @@ -7,7 +7,7 @@ const cp = require('child_process'); if (process.argv[2] === 'child') { process.on('message', common.mustCall((msg) => { assert.strictEqual(msg, 'go'); - // the following console.log is an integral part + // The following console.log is an integral part // of the test. If this regress, this call will // cause the process to exit with 1 console.log('logging should not cause a crash'); diff --git a/test/parallel/test-process-really-exit.js b/test/parallel/test-process-really-exit.js index c806d6c4aa4808..8445d220ca88b7 100644 --- a/test/parallel/test-process-really-exit.js +++ b/test/parallel/test-process-really-exit.js @@ -2,7 +2,7 @@ require('../common'); const assert = require('assert'); -// ensure that the reallyExit hook is executed. +// Ensure that the reallyExit hook is executed. // see: https://github.com/nodejs/node/issues/25650 if (process.argv[2] === 'subprocess') { process.reallyExit = function() { diff --git a/test/parallel/test-process-umask.js b/test/parallel/test-process-umask.js index 592463eca17a9d..85af91620709c7 100644 --- a/test/parallel/test-process-umask.js +++ b/test/parallel/test-process-umask.js @@ -44,7 +44,7 @@ const old = process.umask(mask); assert.strictEqual(process.umask(old), parseInt(mask, 8)); -// confirm reading the umask does not modify it. +// Confirm reading the umask does not modify it. // 1. If the test fails, this call will succeed, but the mask will be set to 0 assert.strictEqual(process.umask(), old); // 2. If the test fails, process.umask() will return 0 diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index 9f7f772e17b0fe..d7ad2ec21faa57 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -245,15 +245,15 @@ tests.forEach((testCase) => { // BMP code point assert.strictEqual(punycode.ucs2.encode([0x61]), 'a'); -// supplementary code point (surrogate pair) +// Supplementary code point (surrogate pair) assert.strictEqual(punycode.ucs2.encode([0x1D306]), '\uD834\uDF06'); // high surrogate assert.strictEqual(punycode.ucs2.encode([0xD800]), '\uD800'); -// high surrogate followed by non-surrogates +// High surrogate followed by non-surrogates assert.strictEqual(punycode.ucs2.encode([0xD800, 0x61, 0x62]), '\uD800ab'); // low surrogate assert.strictEqual(punycode.ucs2.encode([0xDC00]), '\uDC00'); -// low surrogate followed by non-surrogates +// Low surrogate followed by non-surrogates assert.strictEqual(punycode.ucs2.encode([0xDC00, 0x61, 0x62]), '\uDC00ab'); assert.strictEqual(errors, 0); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 72594ce719182d..175098aed77575 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -34,7 +34,7 @@ function createWithNoPrototype(properties) { }); return noProto; } -// folding block, commented to pass gjslint +// Folding block, commented to pass gjslint // {{{ // [ wonkyQS, canonicalQS, obj ] const qsTestCases = [ @@ -204,12 +204,12 @@ function check(actual, expected, input) { }); } -// test that the canonical qs is parsed properly. +// Test that the canonical qs is parsed properly. qsTestCases.forEach((testCase) => { check(qs.parse(testCase[0]), testCase[2], testCase[0]); }); -// test that the colon test cases can do the same +// Test that the colon test cases can do the same qsColonTestCases.forEach((testCase) => { check(qs.parse(testCase[0], ';', ':'), testCase[2], testCase[0]); }); @@ -445,5 +445,5 @@ qsUnescapeTestCases.forEach((testCase) => { createWithNoPrototype([{ key: 'f__', value: 'b_r' }])); qs.unescape = prevUnescape; } -// test separator and "equals" parsing order +// Test separator and "equals" parsing order check(qs.parse('foo&bar', '&', '&'), { foo: '', bar: '' }); diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 87547a9b6ac197..6cbd0b08ac89ea 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -141,7 +141,7 @@ function isWarned(emitter) { assert.ok(called); } - // sending a single character with no newline + // Sending a single character with no newline { const fi = new FakeInput(); const rli = new readline.Interface(fi, {}); @@ -399,7 +399,7 @@ function isWarned(emitter) { }); } - // duplicate lines are removed from history when + // Duplicate lines are removed from history when // `options.removeHistoryDuplicates` is `true` { const fi = new FakeInput(); @@ -439,7 +439,7 @@ function isWarned(emitter) { rli.close(); } - // duplicate lines are not removed from history when + // Duplicate lines are not removed from history when // `options.removeHistoryDuplicates` is `false` { const fi = new FakeInput(); @@ -921,7 +921,7 @@ function isWarned(emitter) { assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'), false); }); - // wide characters should be treated as two columns. + // Wide characters should be treated as two columns. assert.strictEqual(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false); assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index b1c88e2acee157..f61c64043fecc1 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -259,7 +259,7 @@ addTest('\x1b[H\x1b[5H\x1b[1;5H', [ { name: 'home', sequence: '\x1b[1;5H', code: '[H', ctrl: true }, ]); -// escape sequences broken into multiple data chunks +// Escape sequences broken into multiple data chunks addTest('\x1b[D\x1b[C\x1b[D\x1b[C'.split(''), [ { name: 'left', sequence: '\x1b[D', code: '[D' }, { name: 'right', sequence: '\x1b[C', code: '[C' }, @@ -267,7 +267,7 @@ addTest('\x1b[D\x1b[C\x1b[D\x1b[C'.split(''), [ { name: 'right', sequence: '\x1b[C', code: '[C' }, ]); -// escape sequences mixed with regular ones +// Escape sequences mixed with regular ones addTest('\x1b[DD\x1b[2DD\x1b[2^D', [ { name: 'left', sequence: '\x1b[D', code: '[D' }, { name: 'd', sequence: 'D', shift: true }, @@ -318,5 +318,5 @@ const runKeyIntervalTests = [ ]) ].reverse().reduce((acc, fn) => fn(acc), () => {}); -// run key interval tests one after another +// Run key interval tests one after another runKeyIntervalTests(); diff --git a/test/parallel/test-readline-set-raw-mode.js b/test/parallel/test-readline-set-raw-mode.js index db42a5a9495a9e..de47d14b03de8a 100644 --- a/test/parallel/test-readline-set-raw-mode.js +++ b/test/parallel/test-readline-set-raw-mode.js @@ -42,7 +42,7 @@ stream.pause = function() { pauseCalled = true; }; -// when the "readline" starts in "terminal" mode, +// When the "readline" starts in "terminal" mode, // then setRawMode(true) should be called const rli = readline.createInterface({ input: stream, @@ -86,5 +86,5 @@ assert(!resumeCalled); assert(pauseCalled); assert.deepStrictEqual(stream.listeners('keypress'), []); -// one data listener for the keypress events. +// One data listener for the keypress events. assert.strictEqual(stream.listeners('data').length, 1); diff --git a/test/parallel/test-repl-context.js b/test/parallel/test-repl-context.js index 0394129d45df19..378af1c14445e8 100644 --- a/test/parallel/test-repl-context.js +++ b/test/parallel/test-repl-context.js @@ -51,7 +51,7 @@ const stream = new ArrayStream(); // use the server to create a new context const context = server.createContext(); - // ensure that creating a new context does not + // Ensure that creating a new context does not // have side effects on the server assert.ok(server.underscoreAssigned); assert.strictEqual(server.lines.length, 1); @@ -63,7 +63,7 @@ const stream = new ArrayStream(); assert.ok(!server.underscoreAssigned); assert.strictEqual(server.lines.length, 0); - // ensure that assigning to '_' in the new context + // Ensure that assigning to '_' in the new context // does not change the value in our server. assert.ok(!server.underscoreAssigned); vm.runInContext('_ = 1000;\n', context); diff --git a/test/parallel/test-repl-end-emits-exit.js b/test/parallel/test-repl-end-emits-exit.js index d01be957d3990b..8de0a006dfc49b 100644 --- a/test/parallel/test-repl-end-emits-exit.js +++ b/test/parallel/test-repl-end-emits-exit.js @@ -43,7 +43,7 @@ function testTerminalMode() { }); r1.on('exit', function() { - // should be fired from the simulated ^D keypress + // Should be fired from the simulated ^D keypress terminalExit++; testRegularMode(); }); @@ -61,7 +61,7 @@ function testRegularMode() { }); r2.on('exit', function() { - // should be fired from the simulated 'end' event + // Should be fired from the simulated 'end' event regularExit++; }); } diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js index eff05a39203acd..2c42788be6ffcc 100644 --- a/test/parallel/test-repl-save-load.js +++ b/test/parallel/test-repl-save-load.js @@ -73,7 +73,7 @@ assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'), `${cmds.join('\n')}\n\n`); } -// make sure that the REPL data is "correct" +// Make sure that the REPL data is "correct" // so when I load it back I know I'm good testMe.complete('inner.o', function(error, data) { assert.deepStrictEqual(data, works); @@ -85,7 +85,7 @@ putIn.run(['.clear']); // Load the file back in putIn.run([`.load ${saveFileName}`]); -// make sure that the REPL data is "correct" +// Make sure that the REPL data is "correct" testMe.complete('inner.o', function(error, data) { assert.deepStrictEqual(data, works); }); diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 5438c960b84cb1..b28923a49b1a5d 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -145,7 +145,7 @@ testMe.complete('inner.o', common.mustCall(function(error, data) { putIn.run(['.clear']); -// def has the params and { on a separate line +// The definition has the params and { on a separate line. putIn.run([ 'var top = function() {', 'r = function test (', @@ -173,7 +173,7 @@ testMe.complete('inner.o', getNoResultsFunction()); putIn.run(['.clear']); -// currently does not work, but should not break +// Currently does not work, but should not break putIn.run([ 'var top = function() {', 'r = function test (', @@ -187,7 +187,7 @@ testMe.complete('inner.o', getNoResultsFunction()); putIn.run(['.clear']); -// make sure tab completion works on non-Objects +// Make sure tab completion works on non-Objects putIn.run([ 'var str = "test";' ]); @@ -197,7 +197,7 @@ testMe.complete('str.len', common.mustCall(function(error, data) { putIn.run(['.clear']); -// tab completion should not break on spaces +// Tab completion should not break on spaces const spaceTimeout = setTimeout(function() { throw new Error('timeout'); }, 1000); @@ -551,7 +551,7 @@ editor.completer('var log = console.l', common.mustCall((error, data) => { })); { - // tab completion of lexically scoped variables + // Tab completion of lexically scoped variables const stream = new ArrayStream(); const testRepl = repl.start({ stream }); diff --git a/test/parallel/test-repl-tab.js b/test/parallel/test-repl-tab.js index 0ebc9490771598..f64a00d8bca99e 100644 --- a/test/parallel/test-repl-tab.js +++ b/test/parallel/test-repl-tab.js @@ -4,7 +4,7 @@ const assert = require('assert'); const repl = require('repl'); const zlib = require('zlib'); -// just use builtin stream inherited from Duplex +// Just use builtin stream inherited from Duplex const putIn = zlib.createGzip(); const testMe = repl.start('', putIn, function(cmd, context, filename, callback) { diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index bcaa39f6aa8215..2337e32280e8f9 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -48,7 +48,7 @@ async function runReplTests(socket, prompt, tests) { let lineBuffer = ''; for (const { send, expect } of tests) { - // expect can be a single line or multiple lines + // Expect can be a single line or multiple lines const expectedLines = Array.isArray(expect) ? expect : [ expect ]; console.error('out:', JSON.stringify(send)); @@ -448,7 +448,7 @@ const errorTests = [ /'thefourtheye'/ ] }, - // empty lines in the REPL should be allowed + // Empty lines in the REPL should be allowed { send: '\n\r\n\r\n', expect: '' diff --git a/test/parallel/test-require-long-path.js b/test/parallel/test-require-long-path.js index 548a0b5425df39..c39d8f2a41fe1c 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -8,7 +8,7 @@ const path = require('path'); const tmpdir = require('../common/tmpdir'); -// make a path that is more than 260 chars long. +// Make a path that is more than 260 chars long. const dirNameLen = Math.max(260 - tmpdir.path.length, 1); const dirName = path.join(tmpdir.path, 'x'.repeat(dirNameLen)); const fullDirPath = path.resolve(dirName); diff --git a/test/parallel/test-stream-duplex-destroy.js b/test/parallel/test-stream-duplex-destroy.js index 1108413e72480f..3c38d2c364051c 100644 --- a/test/parallel/test-stream-duplex-destroy.js +++ b/test/parallel/test-stream-duplex-destroy.js @@ -76,7 +76,7 @@ const assert = require('assert'); duplex.on('end', common.mustNotCall('no end event')); duplex.on('finish', common.mustNotCall('no finish event')); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy duplex.on('error', common.mustNotCall('no error event')); duplex.on('close', common.mustCall()); diff --git a/test/parallel/test-stream-ispaused.js b/test/parallel/test-stream-ispaused.js index f45c0209ccdcb7..366d34e326ec7d 100644 --- a/test/parallel/test-stream-ispaused.js +++ b/test/parallel/test-stream-ispaused.js @@ -29,7 +29,7 @@ const readable = new stream.Readable(); // _read is a noop, here. readable._read = Function(); -// default state of a stream is not "paused" +// Default state of a stream is not "paused" assert.ok(!readable.isPaused()); // make the stream start flowing... diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js index 49e02bea9cb695..c8a383bc61a24b 100644 --- a/test/parallel/test-stream-pipe-unpipe-streams.js +++ b/test/parallel/test-stream-pipe-unpipe-streams.js @@ -33,7 +33,7 @@ source.unpipe(dest1); assert.strictEqual(source._readableState.pipes, null); { - // test `cleanup()` if we unpipe all streams. + // Test `cleanup()` if we unpipe all streams. const source = Readable({ read: () => {} }); const dest1 = Writable({ write: () => {} }); const dest2 = Writable({ write: () => {} }); diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js index 34928794cdc396..ef5a39fddd881f 100644 --- a/test/parallel/test-stream-pipeline.js +++ b/test/parallel/test-stream-pipeline.js @@ -172,7 +172,7 @@ const { promisify } = require('util'); rs.push('hello'); }, destroy: common.mustCall((err, cb) => { - // prevents fd leaks by destroying http pipelines + // Prevents fd leaks by destroying http pipelines cb(); }) }); diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js index 8ad375e68b3e42..9f56467e203dd5 100644 --- a/test/parallel/test-stream-readable-destroy.js +++ b/test/parallel/test-stream-readable-destroy.js @@ -69,7 +69,7 @@ const assert = require('assert'); read.on('end', common.mustNotCall('no end event')); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy read.on('error', common.mustNotCall('no error event')); read.on('close', common.mustCall()); diff --git a/test/parallel/test-stream-readable-event.js b/test/parallel/test-stream-readable-event.js index 73ca80400ab289..8276e7ce4db533 100644 --- a/test/parallel/test-stream-readable-event.js +++ b/test/parallel/test-stream-readable-event.js @@ -58,7 +58,7 @@ const Readable = require('stream').Readable; r.push(Buffer.from('bl')); setTimeout(function() { - // assert we're testing what we think we are + // Assert we're testing what we think we are assert(r._readableState.reading); r.on('readable', common.mustCall()); }, 1); @@ -78,14 +78,14 @@ const Readable = require('stream').Readable; r.push(null); setTimeout(function() { - // assert we're testing what we think we are + // Assert we're testing what we think we are assert(!r._readableState.reading); r.on('readable', common.mustCall()); }, 1); } { - // pushing a empty string in non-objectMode should + // Pushing an empty string in non-objectMode should // trigger next `read()`. const underlyingData = ['', 'x', 'y', '', 'z']; const expected = underlyingData.filter((data) => data); diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js index 6cc1ce65b1426e..fed4287445e035 100644 --- a/test/parallel/test-stream-readable-flow-recursion.js +++ b/test/parallel/test-stream-readable-flow-recursion.js @@ -30,7 +30,7 @@ const assert = require('assert'); const Readable = require('stream').Readable; -// throw an error if we trigger a nextTick warning. +// Throw an error if we trigger a nextTick warning. process.throwDeprecation = true; const stream = new Readable({ highWaterMark: 2 }); diff --git a/test/parallel/test-stream-readable-reading-readingMore.js b/test/parallel/test-stream-readable-reading-readingMore.js index 5ea91dfa8bad32..2198a889f0584f 100644 --- a/test/parallel/test-stream-readable-reading-readingMore.js +++ b/test/parallel/test-stream-readable-reading-readingMore.js @@ -37,7 +37,7 @@ const Readable = require('stream').Readable; // after which everything is governed by the .read() call assert.strictEqual(state.readingMore, expectedReadingMore.shift()); - // if the stream has ended, we shouldn't be reading + // If the stream has ended, we shouldn't be reading assert.strictEqual(state.ended, !state.reading); const data = readable.read(); diff --git a/test/parallel/test-stream-transform-destroy.js b/test/parallel/test-stream-transform-destroy.js index 47cce87264b5c1..c594d9989ae4de 100644 --- a/test/parallel/test-stream-transform-destroy.js +++ b/test/parallel/test-stream-transform-destroy.js @@ -72,7 +72,7 @@ const assert = require('assert'); transform.on('close', common.mustCall()); transform.on('finish', common.mustNotCall('no finish event')); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy transform.on('error', common.mustNotCall('no error event')); transform.destroy(expected); diff --git a/test/parallel/test-stream-transform-split-highwatermark.js b/test/parallel/test-stream-transform-split-highwatermark.js index f931d4f6ceb928..301d81bc904231 100644 --- a/test/parallel/test-stream-transform-split-highwatermark.js +++ b/test/parallel/test-stream-transform-split-highwatermark.js @@ -81,7 +81,7 @@ testTransform(0, 0, { }); } -// test non Duplex streams ignore the options +// Test non Duplex streams ignore the options { const r = new Readable({ readableHighWaterMark: 666 }); assert.strictEqual(r._readableState.highWaterMark, DEFAULT); diff --git a/test/parallel/test-stream-writable-destroy.js b/test/parallel/test-stream-writable-destroy.js index 5fbb7ae19b14dc..867571ef377a93 100644 --- a/test/parallel/test-stream-writable-destroy.js +++ b/test/parallel/test-stream-writable-destroy.js @@ -69,7 +69,7 @@ const assert = require('assert'); write.on('finish', common.mustNotCall('no finish event')); write.on('close', common.mustCall()); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy write.on('error', common.mustNotCall('no error event')); write.destroy(expected); diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 7283aa493e688d..1123e66ddc5767 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -113,7 +113,7 @@ function test(decode, uncork, multi, next) { w.end(cnt('end')); w.on('finish', function() { - // make sure finish comes after all the write cb + // Make sure finish comes after all the write cb cnt('finish')(); assert.deepStrictEqual(actualChunks, expectChunks); next(); diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index a1bad84a8f55c8..92e4669dd4bc2c 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -423,7 +423,7 @@ const Transform = require('_stream_transform'); }); jp.end(); - // read one more time to get the 'end' event + // Read one more time to get the 'end' event jp.read(); process.nextTick(common.mustCall(function() { @@ -464,7 +464,7 @@ const Transform = require('_stream_transform'); }); js.end(); - // read one more time to get the 'end' event + // Read one more time to get the 'end' event js.read(); process.nextTick(common.mustCall(function() { diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index ac2a3a5b062c9d..4c283df6806c4a 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -28,7 +28,7 @@ const stream = require('stream'); class TestWriter extends stream.Writable { _write(buffer, encoding, callback) { console.log('write called'); - // super slow write stream (callback never called) + // Super slow write stream (callback never called) } } diff --git a/test/parallel/test-stream3-cork-end.js b/test/parallel/test-stream3-cork-end.js index e046d46368a4f9..8403e20fb1e8b2 100644 --- a/test/parallel/test-stream3-cork-end.js +++ b/test/parallel/test-stream3-cork-end.js @@ -21,7 +21,7 @@ const w = new Writable(); w._write = function(chunk, encoding, cb) { // Stream end event is not seen before the last write assert.ok(!seenEnd); - // default encoding given none was specified + // Default encoding given none was specified assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); @@ -70,7 +70,7 @@ writeChunks(inputChunks, () => { // stream should not ended in current tick assert.ok(!seenEnd); - // buffered bytes should be seen in current tick + // Buffered bytes should be seen in current tick assert.strictEqual(seenChunks.length, 4); // did the chunks match diff --git a/test/parallel/test-stream3-cork-uncork.js b/test/parallel/test-stream3-cork-uncork.js index 91d27c916cef45..5b52ec0019feea 100644 --- a/test/parallel/test-stream3-cork-uncork.js +++ b/test/parallel/test-stream3-cork-uncork.js @@ -19,7 +19,7 @@ let seenEnd = false; const w = new Writable(); // lets arrange to store the chunks w._write = function(chunk, encoding, cb) { - // default encoding given none was specified + // Default encoding given none was specified assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); @@ -65,7 +65,7 @@ writeChunks(inputChunks, () => { // trigger writing out the buffer w.uncork(); - // buffered bytes should be seen in current tick + // Buffered bytes should be seen in current tick assert.strictEqual(seenChunks.length, 4); // did the chunks match diff --git a/test/parallel/test-string-decoder-end.js b/test/parallel/test-string-decoder-end.js index 3dd445e6c7149b..b10756a4633fca 100644 --- a/test/parallel/test-string-decoder-end.js +++ b/test/parallel/test-string-decoder-end.js @@ -31,7 +31,7 @@ const encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2']; const bufs = [ '☃💩', 'asdf' ].map((b) => Buffer.from(b)); -// also test just arbitrary bytes from 0-15. +// Also test just arbitrary bytes from 0-15. for (let i = 1; i <= 16; i++) { const bytes = '.'.repeat(i - 1).split('.').map((_, j) => j + 0x78); bufs.push(Buffer.from(bytes)); diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js index f05b40a3ef4f72..9d8aa45f67895e 100644 --- a/test/parallel/test-stringbytes-external.js +++ b/test/parallel/test-stringbytes-external.js @@ -48,9 +48,9 @@ const size = 1 << 20; write_str = write_str.repeat(size); ucs2_control = ucs2_control.repeat(size); -// check resultant buffer and output string +// Check resultant buffer and output string b = Buffer.from(write_str, 'ucs2'); -// check fist Buffer created from write string +// Check fist Buffer created from write string for (let i = 0; i < b.length; i += 2) { assert.strictEqual(b[i], 0x61); assert.strictEqual(b[i + 1], 0); @@ -59,11 +59,11 @@ for (let i = 0; i < b.length; i += 2) { // Create another string to create an external string const b_ucs = b.toString('ucs2'); -// check control against external binary string +// Check control against external binary string const l_bin = b.toString('latin1'); assert.strictEqual(ucs2_control, l_bin); -// check control against external binary string +// Check control against external binary string const b_bin = b.toString('binary'); assert.strictEqual(ucs2_control, b_bin); @@ -72,7 +72,7 @@ const c_bin = Buffer.from(l_bin, 'latin1'); const c_ucs = Buffer.from(b_ucs, 'ucs2'); // make sure they're the same length assert.strictEqual(c_bin.length, c_ucs.length); -// make sure Buffers from externals are the same +// Make sure Buffers from externals are the same for (let i = 0; i < c_bin.length; i++) { assert.strictEqual(c_bin[i], c_ucs[i]); } @@ -82,7 +82,7 @@ assert.strictEqual(c_bin.toString('latin1'), ucs2_control); assert.strictEqual(c_ucs.toString('latin1'), ucs2_control); -// now let's test BASE64 and HEX encoding/decoding +// Now let's test BASE64 and HEX encoding/decoding const RADIOS = 2; const PRE_HALF_APEX = Math.ceil(EXTERN_APEX / 2) - RADIOS; const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index 3ba33faf42369d..37677ada7f411c 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -27,7 +27,7 @@ if (!common.hasCrypto) const assert = require('assert'); const tls = require('tls'); -// import fixtures directly from its module +// Import fixtures directly from its module const fixtures = require('../common/fixtures'); const cipher_list = ['AES128-SHA256', 'AES256-SHA256']; diff --git a/test/parallel/test-trace-events-api.js b/test/parallel/test-trace-events-api.js index cf11daa6edf869..1953e2add96c49 100644 --- a/test/parallel/test-trace-events-api.js +++ b/test/parallel/test-trace-events-api.js @@ -56,7 +56,7 @@ assert.strictEqual(tracing.enabled, false); assert.strictEqual(getEnabledCategories(), enabledCategories); tracing.enable(); -tracing.enable(); // purposefully enable twice to test calling twice +tracing.enable(); // Purposefully enable twice to test calling twice assert.strictEqual(tracing.enabled, true); assert.strictEqual(getEnabledCategories(), @@ -72,7 +72,7 @@ tracing2.enable(); assert.strictEqual(getEnabledCategories(), 'foo'); tracing2.disable(); -tracing2.disable(); // purposefully disable twice to test calling twice +tracing2.disable(); // Purposefully disable twice to test calling twice assert.strictEqual(getEnabledCategories(), enabledCategories); if (isChild) { diff --git a/test/parallel/test-trace-events-category-used.js b/test/parallel/test-trace-events-category-used.js index f4b839dddced35..3d584b1f2a85dd 100644 --- a/test/parallel/test-trace-events-category-used.js +++ b/test/parallel/test-trace-events-category-used.js @@ -17,7 +17,7 @@ tmpdir.refresh(); const procEnabled = cp.spawn( process.execPath, [ '--trace-event-categories', 'custom', - // make test less noisy since internal/test/binding + // Make test less noisy since internal/test/binding // emits a warning. '--no-warnings', '--expose-internals', @@ -35,7 +35,7 @@ procEnabled.once('close', common.mustCall(() => { const procDisabled = cp.spawn( process.execPath, [ '--trace-event-categories', 'other', - // make test less noisy since internal/test/binding + // Make test less noisy since internal/test/binding // emits a warning. '--no-warnings', '--expose-internals', diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index cbe8eea25740f2..b318658febbaea 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -180,7 +180,7 @@ const parseTests = { path: '/b/c' }, - // an unexpected invalid char in the hostname. + // An unexpected invalid char in the hostname. 'HtTp://x.y.cOm;a/b/c?d=e#f gi': { href: 'http://x.y.com/;a/b/c?d=e#f%20g%3Ch%3Ei', protocol: 'http:', diff --git a/test/parallel/test-v8-coverage.js b/test/parallel/test-v8-coverage.js index 5be68bf4b7947f..926d28f14e1a7f 100644 --- a/test/parallel/test-v8-coverage.js +++ b/test/parallel/test-v8-coverage.js @@ -113,7 +113,7 @@ function nextdir() { assert.strictEqual(fixtureCoverage, undefined); } -// disables async hooks before writing coverage. +// Disables async hooks before writing coverage. { const coverageDirectory = path.join(tmpdir.path, nextdir()); const output = spawnSync(process.execPath, [ diff --git a/test/parallel/test-vm-global-property-interceptors.js b/test/parallel/test-vm-global-property-interceptors.js index 8571fbe19fcb60..8fe5f8f3da91b2 100644 --- a/test/parallel/test-vm-global-property-interceptors.js +++ b/test/parallel/test-vm-global-property-interceptors.js @@ -108,7 +108,7 @@ vm.runInContext('k = 2;', ctx); assert.strictEqual(ctx.k, 2); assert.strictEqual(vm.runInContext('k;', ctx), 2); -// redefine properties on the global object +// Redefine properties on the global object assert.strictEqual(typeof vm.runInContext('encodeURI;', ctx), 'function'); assert.strictEqual(ctx.encodeURI, undefined); vm.runInContext(` diff --git a/test/parallel/test-windows-failed-heap-allocation.js b/test/parallel/test-windows-failed-heap-allocation.js index e03c9ee006eabd..ff8062855d6428 100644 --- a/test/parallel/test-windows-failed-heap-allocation.js +++ b/test/parallel/test-windows-failed-heap-allocation.js @@ -9,7 +9,7 @@ const assert = require('assert'); const { exec } = require('child_process'); if (process.argv[2] === 'heapBomb') { - // heap bomb, imitates a memory leak quickly + // Heap bomb, imitates a memory leak quickly const fn = (nM) => [...Array(nM)].map((i) => fn(nM * 2)); fn(2); } diff --git a/test/parallel/test-zlib-deflate-raw-inherits.js b/test/parallel/test-zlib-deflate-raw-inherits.js index bb53caa9b50a6d..34bf31058a1d6b 100644 --- a/test/parallel/test-zlib-deflate-raw-inherits.js +++ b/test/parallel/test-zlib-deflate-raw-inherits.js @@ -4,7 +4,7 @@ require('../common'); const { DeflateRaw } = require('zlib'); const { Readable } = require('stream'); -// validates that zlib.DeflateRaw can be inherited +// Validates that zlib.DeflateRaw can be inherited // with Object.setPrototypeOf function NotInitialized(options) { diff --git a/test/parallel/test-zlib-destroy.js b/test/parallel/test-zlib-destroy.js index d8eab42186a5fa..bbfce22ee2cf8a 100644 --- a/test/parallel/test-zlib-destroy.js +++ b/test/parallel/test-zlib-destroy.js @@ -5,7 +5,7 @@ require('../common'); const assert = require('assert'); const zlib = require('zlib'); -// verify that the zlib transform does clean up +// Verify that the zlib transform does clean up // the handle when calling destroy. const ts = zlib.createGzip(); diff --git a/test/parallel/test-zlib-dictionary.js b/test/parallel/test-zlib-dictionary.js index b7f6a138555237..11c8959cc68505 100644 --- a/test/parallel/test-zlib-dictionary.js +++ b/test/parallel/test-zlib-dictionary.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// test compression/decompression with dictionary +// Test compression/decompression with dictionary const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 6104172c7ae590..d5ef9fe9d13ce7 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -36,7 +36,7 @@ let zlibPairs = [ [zlib.BrotliCompress, zlib.BrotliDecompress], ]; -// how fast to trickle through the slowstream +// How fast to trickle through the slowstream let trickle = [128, 1024, 1024 * 1024]; // tunable options for zlib classes. diff --git a/test/sequential/test-cli-syntax-bad.js b/test/sequential/test-cli-syntax-bad.js index 7c4c9c70d9097c..1512d9df4f1605 100644 --- a/test/sequential/test-cli-syntax-bad.js +++ b/test/sequential/test-cli-syntax-bad.js @@ -7,7 +7,7 @@ const fixtures = require('../common/fixtures'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] @@ -17,7 +17,7 @@ const syntaxArgs = [ // depending on the JavaScript engine. const syntaxErrorRE = /^SyntaxError: \b/m; -// test bad syntax with and without shebang +// Test bad syntax with and without shebang [ 'syntax/bad_syntax.js', 'syntax/bad_syntax', @@ -26,7 +26,7 @@ const syntaxErrorRE = /^SyntaxError: \b/m; ].forEach(function(file) { file = fixtures.path(file); - // loop each possible option, `-c` or `--check` + // Loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const _args = args.concat(file); const cmd = [node, ..._args].join(' '); @@ -38,7 +38,7 @@ const syntaxErrorRE = /^SyntaxError: \b/m; // no stdout should be produced assert.strictEqual(stdout, ''); - // stderr should have a syntax error message + // Stderr should have a syntax error message assert(syntaxErrorRE.test(stderr), `${syntaxErrorRE} === ${stderr}`); // stderr should include the filename diff --git a/test/sequential/test-cli-syntax-file-not-found.js b/test/sequential/test-cli-syntax-file-not-found.js index 2bfb0e38c75013..b3bb9723e2c78e 100644 --- a/test/sequential/test-cli-syntax-file-not-found.js +++ b/test/sequential/test-cli-syntax-file-not-found.js @@ -7,7 +7,7 @@ const fixtures = require('../common/fixtures'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] @@ -22,7 +22,7 @@ const notFoundRE = /^Error: Cannot find module/m; ].forEach(function(file) { file = fixtures.path(file); - // loop each possible option, `-c` or `--check` + // Loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const _args = args.concat(file); const cmd = [node, ..._args].join(' '); diff --git a/test/sequential/test-cli-syntax-good.js b/test/sequential/test-cli-syntax-good.js index 1c2b3cbe55db80..48581e7733da44 100644 --- a/test/sequential/test-cli-syntax-good.js +++ b/test/sequential/test-cli-syntax-good.js @@ -7,13 +7,13 @@ const fixtures = require('../common/fixtures'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] ]; -// test good syntax with and without shebang +// Test good syntax with and without shebang [ 'syntax/good_syntax.js', 'syntax/good_syntax', @@ -23,7 +23,7 @@ const syntaxArgs = [ ].forEach(function(file) { file = fixtures.path(file); - // loop each possible option, `-c` or `--check` + // Loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const _args = args.concat(file); diff --git a/test/sequential/test-dgram-bind-shared-ports.js b/test/sequential/test-dgram-bind-shared-ports.js index 9f7e23ba0bdaf5..cc12d93787df14 100644 --- a/test/sequential/test-dgram-bind-shared-ports.js +++ b/test/sequential/test-dgram-bind-shared-ports.js @@ -89,7 +89,7 @@ if (cluster.isMaster) { assert.strictEqual(typeof port3, 'number'); process.send('success'); }); - // an error is expected only in the second worker + // An error is expected only in the second worker const socket3OnError = !isSecondWorker ? common.mustNotCall() : diff --git a/test/sequential/test-http-econnrefused.js b/test/sequential/test-http-econnrefused.js index ff4508963b9877..5650e7430859ca 100644 --- a/test/sequential/test-http-econnrefused.js +++ b/test/sequential/test-http-econnrefused.js @@ -95,7 +95,7 @@ function afterPing(result) { assert.ok(successRE.test(responses[6])); assert.ok(successRE.test(responses[7])); server.close(); - // we should go to process.on('exit') from here. + // We should go to process.on('exit') from here. break; } } diff --git a/test/sequential/test-inspector.js b/test/sequential/test-inspector.js index 237b65193fa86e..9aaabdc6c95472 100644 --- a/test/sequential/test-inspector.js +++ b/test/sequential/test-inspector.js @@ -212,7 +212,7 @@ async function testCommandLineAPI(session) { }); checkException(result); assert.strictEqual(result.result.value, true); - // after require the module appears in require.cache + // After require the module appears in require.cache result = await session.send( { 'method': 'Runtime.evaluate', 'params': { @@ -235,7 +235,7 @@ async function testCommandLineAPI(session) { }); checkException(result); assert.strictEqual(result.result.value, true); - // require again, should get fresh (empty) exports + // Require again, should get fresh (empty) exports result = await session.send( { 'method': 'Runtime.evaluate', 'params': { @@ -255,7 +255,7 @@ async function testCommandLineAPI(session) { }); checkException(result); assert.deepStrictEqual(JSON.parse(result.result.value), {}); - // both modules end up with the same module.parent + // Both modules end up with the same module.parent result = await session.send( { 'method': 'Runtime.evaluate', 'params': { diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index 90ab1d4f4f285c..9db97a2769a140 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -120,7 +120,7 @@ assert.throws( } console.error('test node_modules folders'); -// asserts are in the fixtures files themselves, +// Asserts are in the fixtures files themselves, // since they depend on the folder structure. require('../fixtures/node_modules/foo'); @@ -129,7 +129,7 @@ require('../fixtures/node_modules/foo'); // This one exists and should import the local module const my_path = require('../fixtures/path'); assert.ok(my_path.path_func instanceof Function); - // this one does not exist and should throw + // This one does not exist and should throw assert.throws(function() { require('./utils'); }, /^Error: Cannot find module '\.\/utils'/); } @@ -216,7 +216,7 @@ assert.throws( } { - // make sure that module.require() is the same as + // Make sure that module.require() is the same as // doing require() inside of that module. const parent = require('../fixtures/module-require/parent/'); const child = require('../fixtures/module-require/child/'); diff --git a/test/sequential/test-net-listen-shared-ports.js b/test/sequential/test-net-listen-shared-ports.js index be33821bf6518c..78d94b4ae1e6b0 100644 --- a/test/sequential/test-net-listen-shared-ports.js +++ b/test/sequential/test-net-listen-shared-ports.js @@ -48,7 +48,7 @@ if (cluster.isMaster) { }); server2.on('error', function(err) { - // an error is expected on the second worker + // An error is expected on the second worker process.send(`server2:${err.code}`); }); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index 40995394ac5530..68d35dbdbc6a91 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -89,6 +89,6 @@ if (!process.argv[2]) { parent(); } else { children[process.argv[2]](); - // immediate process.exit to kill any waiting stuff. + // Immediate process.exit to kill any waiting stuff. process.exit(); } diff --git a/test/sequential/test-timers-blocking-callback.js b/test/sequential/test-timers-blocking-callback.js index 3d05a538ea5f6b..053bc767b8fa13 100644 --- a/test/sequential/test-timers-blocking-callback.js +++ b/test/sequential/test-timers-blocking-callback.js @@ -64,7 +64,7 @@ function blockingCallback(retry, callback) { if (callback) return callback(); } else { - // block by busy-looping to trigger the issue + // Block by busy-looping to trigger the issue common.busyLoop(TIMEOUT); timeCallbackScheduled = Date.now(); diff --git a/tools/eslint-rules/no-duplicate-requires.js b/tools/eslint-rules/no-duplicate-requires.js index 595c22360112ca..c0d036fab92deb 100644 --- a/tools/eslint-rules/no-duplicate-requires.js +++ b/tools/eslint-rules/no-duplicate-requires.js @@ -36,7 +36,7 @@ module.exports = (context) => { } function getRequiredModuleNameFromCall(node) { - // node has arguments and first argument is string + // Node has arguments and first argument is string if (node.arguments.length && isString(node.arguments[0])) { return node.arguments[0].value.trim(); } diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 208e13ffe74fc2..a7a87662ac21e6 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -48,7 +48,7 @@ module.exports = function(context) { function getRequiredModuleName(str) { var value = path.basename(str); - // check if value is in required modules array + // Check if value is in required modules array return requiredModules.indexOf(value) !== -1 ? value : undefined; } @@ -59,7 +59,7 @@ module.exports = function(context) { * @returns {undefined|String} required module name or undefined */ function getRequiredModuleNameFromCall(node) { - // node has arguments and first argument is string + // Node has arguments and first argument is string if (node.arguments.length && isString(node.arguments[0])) { return getRequiredModuleName(node.arguments[0].value.trim()); }