diff --git a/benchmark/_cli.js b/benchmark/_cli.js index fa2bfb83955e73..8b9f22d0fb4b57 100644 --- a/benchmark/_cli.js +++ b/benchmark/_cli.js @@ -16,7 +16,7 @@ function CLI(usage, settings) { if (!(this instanceof CLI)) return new CLI(usage, settings); if (process.argv.length < 3) { - this.abort(usage); // abort will exit the process + this.abort(usage); // Abort will exit the process } this.usage = usage; diff --git a/benchmark/common.js b/benchmark/common.js index cad0550986bd18..b4778d71935e25 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -202,7 +202,7 @@ Benchmark.prototype.end = function(operations) { if (elapsed[0] === 0 && elapsed[1] === 0) { if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED) throw new Error('insufficient clock precision for short benchmark'); - // avoid dividing by zero + // Avoid dividing by zero elapsed[1] = 1; } diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js index 8ffbe148bb71a5..0a98eb1471c9d4 100644 --- a/benchmark/crypto/hash-stream-creation.js +++ b/benchmark/crypto/hash-stream-creation.js @@ -1,4 +1,4 @@ -// throughput benchmark +// Throughput benchmark // creates a single hasher, then pushes a bunch of data through it 'use strict'; const common = require('../common.js'); diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js index 6ce7a6767e4880..52be3d4caf8501 100644 --- a/benchmark/crypto/hash-stream-throughput.js +++ b/benchmark/crypto/hash-stream-throughput.js @@ -1,4 +1,4 @@ -// throughput benchmark +// Throughput benchmark // creates a single hasher, then pushes a bunch of data through it 'use strict'; const common = require('../common.js'); diff --git a/benchmark/fixtures/simple-http-server.js b/benchmark/fixtures/simple-http-server.js index 0eb7d9ee374615..013ac468f551ff 100644 --- a/benchmark/fixtures/simple-http-server.js +++ b/benchmark/fixtures/simple-http-server.js @@ -9,7 +9,7 @@ const storedUnicode = Object.create(null); const useDomains = process.env.NODE_USE_DOMAINS; -// set up one global domain. +// Set up one global domain. if (useDomains) { var domain = require('domain'); const gdom = domain.create(); diff --git a/benchmark/http/cluster.js b/benchmark/http/cluster.js index 35d0ba98d00b43..7f72db533ed142 100644 --- a/benchmark/http/cluster.js +++ b/benchmark/http/cluster.js @@ -5,7 +5,7 @@ const PORT = common.PORT; const cluster = require('cluster'); if (cluster.isMaster) { var bench = common.createBenchmark(main, { - // unicode confuses ab on os x. + // Unicode confuses ab on os x. type: ['bytes', 'buffer'], len: [4, 1024, 102400], c: [50, 500] diff --git a/benchmark/http/incoming_headers.js b/benchmark/http/incoming_headers.js index 7d9955766c7882..f10178c1891805 100644 --- a/benchmark/http/incoming_headers.js +++ b/benchmark/http/incoming_headers.js @@ -3,7 +3,7 @@ const common = require('../common.js'); const http = require('http'); const bench = common.createBenchmark(main, { - // unicode confuses ab on os x. + // Unicode confuses ab on os x. c: [50, 500], n: [0, 5, 20] }); diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index c6faaaa9efdfd2..2d89dce9be9b98 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - // unicode confuses ab on os x. + // Unicode confuses ab on os x. type: ['bytes', 'buffer'], len: [4, 1024, 102400], chunks: [1, 4], diff --git a/benchmark/net/net-c2s-cork.js b/benchmark/net/net-c2s-cork.js index 34c4b50296ec75..12d15fe0795e57 100644 --- a/benchmark/net/net-c2s-cork.js +++ b/benchmark/net/net-c2s-cork.js @@ -33,7 +33,7 @@ function main({ dur, len, type }) { const writer = new Writer(); - // the actual benchmark. + // The actual benchmark. const server = net.createServer((socket) => { socket.pipe(writer); }); diff --git a/benchmark/net/net-c2s.js b/benchmark/net/net-c2s.js index 732bda131d6b5a..4b64cbeca18124 100644 --- a/benchmark/net/net-c2s.js +++ b/benchmark/net/net-c2s.js @@ -34,7 +34,7 @@ function main({ dur, len, type }) { const reader = new Reader(); const writer = new Writer(); - // the actual benchmark. + // The actual benchmark. const server = net.createServer((socket) => { socket.pipe(writer); }); diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js index 12db1e13b836d2..c4e1da3f6f0c8b 100644 --- a/benchmark/net/net-pipe.js +++ b/benchmark/net/net-pipe.js @@ -34,7 +34,7 @@ function main({ dur, len, type }) { const reader = new Reader(); const writer = new Writer(); - // the actual benchmark. + // The actual benchmark. const server = net.createServer((socket) => { socket.pipe(socket); }); diff --git a/benchmark/net/net-s2c.js b/benchmark/net/net-s2c.js index 848168cda45d83..e3c5c7e5eb41c6 100644 --- a/benchmark/net/net-s2c.js +++ b/benchmark/net/net-s2c.js @@ -33,7 +33,7 @@ function main({ dur, len, type }) { const reader = new Reader(); const writer = new Writer(); - // the actual benchmark. + // The actual benchmark. const server = net.createServer((socket) => { reader.pipe(socket); }); diff --git a/benchmark/net/net-wrap-js-stream-passthrough.js b/benchmark/net/net-wrap-js-stream-passthrough.js index 1c597b6ed0a199..1e8a1ee1c5a092 100644 --- a/benchmark/net/net-wrap-js-stream-passthrough.js +++ b/benchmark/net/net-wrap-js-stream-passthrough.js @@ -38,7 +38,7 @@ function main({ dur, len, type }) { const reader = new Reader(); const writer = new Writer(); - // the actual benchmark. + // The actual benchmark. const fakeSocket = new JSStreamWrap(new PassThrough()); bench.start(); reader.pipe(fakeSocket); diff --git a/benchmark/url/legacy-vs-whatwg-url-parse.js b/benchmark/url/legacy-vs-whatwg-url-parse.js index e4af2e0b7c2db5..e3f50a76a45c77 100644 --- a/benchmark/url/legacy-vs-whatwg-url-parse.js +++ b/benchmark/url/legacy-vs-whatwg-url-parse.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { function useLegacy(data) { const len = data.length; - var result = url.parse(data[0]); // avoid dead code elimination + var result = url.parse(data[0]); // Avoid dead code elimination bench.start(); for (var i = 0; i < len; ++i) { result = url.parse(data[i]); @@ -24,7 +24,7 @@ function useLegacy(data) { function useWHATWGWithBase(data) { const len = data.length; - var result = new URL(data[0][0], data[0][1]); // avoid dead code elimination + var result = new URL(data[0][0], data[0][1]); // Avoid dead code elimination bench.start(); for (var i = 0; i < len; ++i) { const item = data[i]; @@ -36,7 +36,7 @@ function useWHATWGWithBase(data) { function useWHATWGWithoutBase(data) { const len = data.length; - var result = new URL(data[0]); // avoid dead code elimination + var result = new URL(data[0]); // Avoid dead code elimination bench.start(); for (var i = 0; i < len; ++i) { result = new URL(data[i]); diff --git a/benchmark/url/url-searchparams-sort.js b/benchmark/url/url-searchparams-sort.js index 6720b66dca366f..0d4f605fa8edd6 100644 --- a/benchmark/url/url-searchparams-sort.js +++ b/benchmark/url/url-searchparams-sort.js @@ -3,7 +3,7 @@ const common = require('../common.js'); const URLSearchParams = require('url').URLSearchParams; const inputs = { - wpt: 'wpt', // to work around tests + wpt: 'wpt', // To work around tests empty: '', sorted: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z', almostsorted: 'a&b&c&d&e&f&g&i&h&j&k&l&m&n&o&p&q&r&s&t&u&w&v&x&y&z', diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 90e64239b3b198..340c2968cb6fb0 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -315,7 +315,7 @@ if (cluster.isMaster) { } else if (cluster.isWorker) { const net = require('net'); const server = net.createServer((socket) => { - // connections never end + // Connections never end }); server.listen(8000); diff --git a/doc/api/console.md b/doc/api/console.md index 1fe1949664920f..a8369290dfbf0f 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -114,12 +114,12 @@ error output. If `stderr` is not provided, `stdout` is used for `stderr`. ```js const output = fs.createWriteStream('./stdout.log'); const errorOutput = fs.createWriteStream('./stderr.log'); -// custom simple logger +// Custom simple logger const logger = new Console({ stdout: output, stderr: errorOutput }); // use it like console const count = 5; logger.log('count: %d', count); -// in stdout.log: count 5 +// In stdout.log: count 5 ``` The global `console` is a special `Console` whose output is sent to diff --git a/doc/api/domain.md b/doc/api/domain.md index 226eb660f4b0bf..63dbcabbbc205d 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -135,7 +135,7 @@ if (cluster.isMaster) { // But don't keep the process open just for that! killtimer.unref(); - // stop taking new requests. + // Stop taking new requests. server.close(); // Let the master know we're dead. This will trigger a @@ -316,14 +316,13 @@ const d = domain.create(); function readSomeFile(filename, cb) { fs.readFile(filename, 'utf8', d.bind((er, data) => { - // If this throws, it will also be passed to the domain + // If this throws, it will also be passed to the domain. return cb(er, data ? JSON.parse(data) : null); })); } d.on('error', (er) => { - // an error occurred somewhere. - // if we throw it now, it will crash the program + // An error occurred somewhere. If we throw it now, it will crash the program // with the normal line number and stack message. }); ``` @@ -377,7 +376,7 @@ function readSomeFile(filename, cb) { // callback since it is assumed to be the 'Error' argument // and thus intercepted by the domain. - // if this throws, it will also be passed to the domain + // If this throws, it will also be passed to the domain // so the error-handling logic can be moved to the 'error' // event on the domain instead of being repeated throughout // the program. @@ -386,8 +385,7 @@ function readSomeFile(filename, cb) { } d.on('error', (er) => { - // an error occurred somewhere. - // if we throw it now, it will crash the program + // An error occurred somewhere. If we throw it now, it will crash the program // with the normal line number and stack message. }); ``` diff --git a/doc/api/errors.md b/doc/api/errors.md index 18774a9b951884..7e32ba1cfc94be 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -407,7 +407,7 @@ program. try { require('vm').runInThisContext('binary ! isNotOk'); } catch (err) { - // err will be a SyntaxError + // 'err' will be a SyntaxError. } ``` @@ -422,7 +422,7 @@ string would be considered a `TypeError`. ```js require('url').parse(() => { }); -// throws TypeError, since it expected a string +// Throws TypeError, since it expected a string. ``` Node.js will generate and throw `TypeError` instances *immediately* as a form diff --git a/doc/api/events.md b/doc/api/events.md index 8525bf5f2483f2..74846995c2e9aa 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -648,7 +648,7 @@ emitter.on('log', () => console.log('log persistently')); // Will return a new Array with a single function bound by `.on()` above const newListeners = emitter.rawListeners('log'); -// logs "log persistently" twice +// Logs "log persistently" twice newListeners[0](); emitter.emit('log'); ``` diff --git a/doc/api/http.md b/doc/api/http.md index d27fa462a85346..455195d79f0c93 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -358,7 +358,7 @@ const proxy = http.createServer((req, res) => { res.end('okay'); }); proxy.on('connect', (req, cltSocket, head) => { - // connect to an origin server + // Connect to an origin server const srvUrl = url.parse(`http://${req.url}`); const srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => { cltSocket.write('HTTP/1.1 200 Connection Established\r\n' + @@ -370,7 +370,7 @@ proxy.on('connect', (req, cltSocket, head) => { }); }); -// now that proxy is running +// Now that proxy is running proxy.listen(1337, '127.0.0.1', () => { // Make a request to a tunneling proxy @@ -504,7 +504,7 @@ srv.on('upgrade', (req, socket, head) => { socket.pipe(socket); // echo back }); -// now that server is running +// Now that server is running srv.listen(1337, '127.0.0.1', () => { // make a request @@ -626,11 +626,11 @@ request.setHeader('content-type', 'text/html'); request.setHeader('Content-Length', Buffer.byteLength(body)); request.setHeader('Cookie', ['type=ninja', 'language=javascript']); const contentType = request.getHeader('Content-Type'); -// contentType is 'text/html' +// 'contentType' is 'text/html' const contentLength = request.getHeader('Content-Length'); -// contentLength is of type number +// 'contentLength' is of type number const cookie = request.getHeader('Cookie'); -// cookie is of type string[] +// 'cookie' is of type string[] ``` ### request.maxHeadersCount @@ -745,7 +745,7 @@ req.once('response', (res) => { const ip = req.socket.localAddress; const port = req.socket.localPort; console.log(`Your IP address is ${ip} and your source port is ${port}.`); - // consume response object + // Consume response object }); ``` @@ -2065,7 +2065,7 @@ req.on('error', (e) => { console.error(`problem with request: ${e.message}`); }); -// write data to request body +// Write data to request body req.write(postData); req.end(); ``` diff --git a/doc/api/http2.md b/doc/api/http2.md index 04a4972de785d2..1416c976362afe 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2437,7 +2437,7 @@ const client = http2.connect('http://localhost'); client.on('stream', (pushedStream, requestHeaders) => { pushedStream.on('push', (responseHeaders) => { - // process response headers + // Process response headers }); pushedStream.on('data', (chunk) => { /* handle pushed data */ }); }); diff --git a/doc/api/process.md b/doc/api/process.md index 27ba6db319ac8e..ed5e38dd4c817a 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -295,8 +295,8 @@ process.on('unhandledRejection', (reason, p) => { }); somePromise.then((res) => { - return reportToUser(JSON.pasre(res)); // note the typo (`pasre`) -}); // no `.catch()` or `.then()` + return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`) +}); // No `.catch()` or `.then()` ``` The following will also trigger the `'unhandledRejection'` event to be diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 1a1d0adb25f0d5..15fb35d22f627f 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -126,7 +126,7 @@ querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); // Returns 'foo=bar&baz=qux&baz=quux&corge=' querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); -// returns 'foo:bar;baz:qux' +// Returns 'foo:bar;baz:qux' ``` By default, characters requiring percent-encoding within the query string will diff --git a/doc/api/stream.md b/doc/api/stream.md index 156f09f374c5bf..df171b95369741 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -683,7 +683,7 @@ pass.unpipe(writable); // readableFlowing is now false pass.on('data', (chunk) => { console.log(chunk.toString()); }); -pass.write('ok'); // will not emit 'data' +pass.write('ok'); // Will not emit 'data' pass.resume(); // Must be called to make stream emit 'data' ``` @@ -1206,7 +1206,7 @@ function parseHeader(stream, callback) { while (null !== (chunk = stream.read())) { const str = decoder.write(chunk); if (str.match(/\n\n/)) { - // found the header boundary + // Found the header boundary const split = str.split(/\n\n/); header += split.shift(); const remaining = split.join('\n\n'); @@ -1219,7 +1219,7 @@ function parseHeader(stream, callback) { // Now the body of the message can be read from the stream. callback(null, header, stream); } else { - // still reading the header. + // Still reading the header. header += str; } } diff --git a/doc/api/timers.md b/doc/api/timers.md index 9460028928bba1..66ee2ca97e8455 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -163,7 +163,7 @@ setImmediatePromise('foobar').then((value) => { // This is executed after all I/O callbacks. }); -// or with async function +// Or with async function async function timerExample() { console.log('Before I/O callbacks'); await setImmediatePromise(); diff --git a/doc/api/util.md b/doc/api/util.md index 2ef115bc7d4dec..beb79ae0f85616 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -758,7 +758,7 @@ option properties directly is also supported. const util = require('util'); const arr = Array(101).fill(0); -console.log(arr); // logs the truncated array +console.log(arr); // Logs the truncated array util.inspect.defaultOptions.maxArrayLength = null; console.log(arr); // logs the full array ``` diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 6efc2a709c339d..6d0371a8d9a083 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -69,7 +69,7 @@ See [Memory Usage Tuning][] for more information on the speed/memory/compression tradeoffs involved in `zlib` usage. ```js -// client request example +// Client request example const zlib = require('zlib'); const http = require('http'); const fs = require('fs'); diff --git a/lib/_http_server.js b/lib/_http_server.js index 5941e5740fcf91..fc02a66e2eecc7 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -239,10 +239,10 @@ function writeHead(statusCode, reason, obj) { if (k === undefined && this._header) { throw new ERR_HTTP_HEADERS_SENT('render'); } - // only progressive api is used + // Only progressive api is used headers = this[outHeadersKey]; } else { - // only writeHead() called + // Only writeHead() called headers = obj; } @@ -440,7 +440,7 @@ function socketOnTimeout() { function socketOnClose(socket, state) { debug('server socket close'); - // mark this parser as reusable + // Mark this parser as reusable if (socket.parser) { freeParser(socket.parser, null, socket); } @@ -455,7 +455,7 @@ function abortIncoming(incoming) { req.emit('aborted'); req.emit('close'); } - // abort socket._httpMessage ? + // Abort socket._httpMessage ? } function socketOnEnd(server, socket, parser, state) { diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index 05140acac30fc9..11651e2ace65a5 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -96,13 +96,13 @@ Object.defineProperty(Duplex.prototype, 'writableLength', { } }); -// the no-half-open enforcer +// The no-half-open enforcer function onend() { // If the writable side ended, then we're ok. if (this._writableState.ended) return; - // no more data can be written. + // No more data can be written. // But allow more writes to happen in this tick. process.nextTick(onEndNT, this); } diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 79a12dd4350d31..81e8de310c240f 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -130,7 +130,7 @@ function ReadableState(options, stream, isDuplex) { // Should .destroy() be called after 'end' (and potentially 'finish') this.autoDestroy = !!options.autoDestroy; - // has it been destroyed + // Has it been destroyed this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string @@ -295,7 +295,7 @@ function addChunk(stream, state, chunk, addToFront) { state.awaitDrain = 0; stream.emit('data', chunk); } else { - // update the buffer info. + // Update the buffer info. state.length += state.objectMode ? 1 : chunk.length; if (addToFront) state.buffer.unshift(chunk); @@ -323,7 +323,7 @@ Readable.prototype.isPaused = function() { return this._readableState.flowing === false; }; -// backwards compatibility. +// Backwards compatibility. Readable.prototype.setEncoding = function(enc) { if (!StringDecoder) StringDecoder = require('string_decoder').StringDecoder; @@ -459,7 +459,7 @@ Readable.prototype.read = function(n) { // If the length is currently zero, then we *need* a readable event. if (state.length === 0) state.needReadable = true; - // call internal read method + // Call internal read method this._read(state.highWaterMark); state.sync = false; // If _read pushed data synchronously, then `reading` will be false, @@ -818,7 +818,7 @@ Readable.prototype.unpipe = function(dest) { return this; } - // try to find the right one. + // Try to find the right one. var index = state.pipes.indexOf(dest); if (index === -1) return this; @@ -1006,8 +1006,7 @@ Readable.prototype.wrap = function(stream) { } }); - // proxy all the other methods. - // important when wrapping filters and duplexes. + // Proxy all the other methods. Important when wrapping filters and duplexes. for (var i in stream) { if (this[i] === undefined && typeof stream[i] === 'function') { this[i] = function methodWrap(method) { diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index fa7b851249e284..486d044cb0091d 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -80,14 +80,14 @@ function WritableState(options, stream, isDuplex) { // drain event flag. this.needDrain = false; - // at the start of calling end() + // At the start of calling end() this.ending = false; // When end() has been called, and returned this.ended = false; - // when 'finish' is emitted + // When 'finish' is emitted this.finished = false; - // has it been destroyed + // Has it been destroyed this.destroyed = false; // Should we decode strings into buffers before passing to _write? @@ -152,7 +152,7 @@ function WritableState(options, stream, isDuplex) { // Should .destroy() be called after 'finish' (and potentially 'end') this.autoDestroy = !!options.autoDestroy; - // count buffered requests + // Count buffered requests this.bufferedRequestCount = 0; // Allocate the first CorkedRequest, there is always @@ -681,7 +681,7 @@ function onCorkedFinish(corkReq, state, err) { entry = entry.next; } - // reuse the free corkReq. + // Reuse the free corkReq. state.corkedRequestsFree.next = corkReq; } diff --git a/lib/buffer.js b/lib/buffer.js index b072ac407d6ffc..66c345885a7d59 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -356,7 +356,7 @@ function fromArrayLike(obj) { } function fromArrayBuffer(obj, byteOffset, length) { - // convert byteOffset to integer + // Convert byteOffset to integer if (byteOffset === undefined) { byteOffset = 0; } else { diff --git a/lib/dgram.js b/lib/dgram.js index 97709b1d948ded..a81c08f7285eab 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -262,7 +262,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { address = '::'; } - // resolve address first + // Resolve address first state.handle.lookup(address, (err, ip) => { if (err) { state.bindState = BIND_STATE_UNBOUND; diff --git a/lib/domain.js b/lib/domain.js index 46b810857482f6..144d66862449c1 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -68,7 +68,7 @@ const asyncHook = createHook({ }, before(asyncId) { const current = pairing.get(asyncId); - if (current !== undefined) { // enter domain for this cb + if (current !== undefined) { // Enter domain for this cb // We will get the domain through current.get(), because the resource // object's .domain property makes sure it is not garbage collected. current.get().enter(); @@ -76,7 +76,7 @@ const asyncHook = createHook({ }, after(asyncId) { const current = pairing.get(asyncId); - if (current !== undefined) { // exit domain for this cb + if (current !== undefined) { // Exit domain for this cb current.get().exit(); } }, diff --git a/lib/fs.js b/lib/fs.js index 8aeaffb8ec17c3..206ab1fcfe669f 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -121,7 +121,7 @@ function handleErrorFromBinding(ctx) { Error.captureStackTrace(err, handleErrorFromBinding); throw err; } - if (ctx.error !== undefined) { // errors created in C++ land. + if (ctx.error !== undefined) { // Errors created in C++ land. // TODO(joyeecheung): currently, ctx.error are encoding errors // usually caused by memory problems. We need to figure out proper error // code(s) for this. @@ -289,7 +289,7 @@ function readFile(path, options, callback) { if (!ReadFileContext) ReadFileContext = require('internal/fs/read_file_context'); const context = new ReadFileContext(callback, options.encoding); - context.isUserFd = isFd(path); // file descriptor ownership + context.isUserFd = isFd(path); // File descriptor ownership const req = new FSReqCallback(); req.context = context; @@ -349,14 +349,14 @@ function tryReadSync(fd, isUserFd, buffer, pos, len) { function readFileSync(path, options) { options = getOptions(options, { flag: 'r' }); - const isUserFd = isFd(path); // file descriptor ownership + const isUserFd = isFd(path); // File descriptor ownership const fd = isUserFd ? path : fs.openSync(path, options.flag, 0o666); const stats = tryStatSync(fd, isUserFd); const size = isFileType(stats, S_IFREG) ? stats[8] : 0; let pos = 0; - let buffer; // single buffer with file data - let buffers; // list for when size is unknown + let buffer; // Single buffer with file data + let buffers; // List for when size is unknown if (size === 0) { buffers = []; @@ -1242,7 +1242,7 @@ function writeFileSync(path, data, options) { options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'w' }); const flag = options.flag || 'w'; - const isUserFd = isFd(path); // file descriptor ownership + const isUserFd = isFd(path); // File descriptor ownership const fd = isUserFd ? path : fs.openSync(path, flag, options.mode); if (!isArrayBufferView(data)) { diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index dddfd7cbeceb73..390feef96abf30 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -565,7 +565,7 @@ function setupChannel(target, channel) { // Object where socket lists will live channel.sockets = { got: {}, send: {} }; - // handlers will go through this + // Handlers will go through this target.on('internalMessage', function(message, handle) { // Once acknowledged - continue sending handles. if (message.cmd === 'NODE_HANDLE_ACK' || diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index effac318539270..5d58121a25511c 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -14,7 +14,7 @@ // limitations under the License. // SPDX-License-Identifier: MIT -// based upon: +// Based upon: // https://github.com/google/caja/blob/master/src/com/google/caja/ses/startSES.js // https://github.com/google/caja/blob/master/src/com/google/caja/ses/repairES5.js // https://github.com/tc39/proposal-frozen-realms/blob/91ac390e3451da92b5c27e354b39e52b7636a437/shim/src/deep-freeze.js @@ -176,11 +176,11 @@ module.exports = function() { // NB: handle for any new cases in future } if (frozenSet.has(val) || freezingSet.has(val)) { - // todo use uncurried form + // TODO: Use uncurried form // Ignore if already frozen or freezing return; } - freezingSet.add(val); // todo use uncurried form + freezingSet.add(val); // TODO: Use uncurried form } function doFreeze(obj) { @@ -201,8 +201,8 @@ module.exports = function() { const descs = getOwnPropertyDescriptors(obj); enqueue(proto); ownKeys(descs).forEach((name) => { - // todo uncurried form - // todo: getOwnPropertyDescriptors is guaranteed to return well-formed + // TODO: Uncurried form + // TODO: getOwnPropertyDescriptors is guaranteed to return well-formed // descriptors, but they still inherit from Object.prototype. If // someone has poisoned Object.prototype to add 'value' or 'get' // properties, then a simple 'if ("value" in desc)' or 'desc.value' @@ -222,12 +222,12 @@ module.exports = function() { function dequeue() { // New values added before forEach() has finished will be visited. - freezingSet.forEach(doFreeze); // todo curried forEach + freezingSet.forEach(doFreeze); // TODO: Curried forEach } function commit() { - // todo curried forEach - // we capture the real WeakSet.prototype.add above, in case someone + // TODO: Curried forEach + // We capture the real WeakSet.prototype.add above, in case someone // changes it. The two-argument form of forEach passes the second // argument as the 'this' binding, so we add to the correct set. freezingSet.forEach(frozenSet.add, frozenSet); diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index b057ddb9bd2740..24c79dffb54ee5 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -121,7 +121,7 @@ ReadStream.prototype.open = function() { this.fd = fd; this.emit('open', fd); this.emit('ready'); - // start the flow of data. + // Start the flow of data. this.read(); }); }; @@ -137,7 +137,7 @@ ReadStream.prototype._read = function(n) { return; if (!pool || pool.length - pool.used < kMinPoolSpace) { - // discard the old pool. + // Discard the old pool. allocNewPool(this.readableHighWaterMark); } diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index f205b47a4a2798..b7486db6e47c05 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -711,7 +711,7 @@ Module.prototype.load = function(filename) { const module = ESMLoader.moduleMap.get(url); // Create module entry at load time to snapshot exports correctly const exports = this.exports; - if (module !== undefined) { // called from cjs translator + if (module !== undefined) { // Called from cjs translator module.reflect.onReady((reflect) => { reflect.exports.default.set(exports); }); @@ -885,7 +885,7 @@ if (experimentalModules) { }; } -// bootstrap main module. +// Bootstrap main module. Module.runMain = function() { // Load the main module--the command line argument. if (experimentalModules) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 97a7f4a2f354f2..de09910872e133 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -86,7 +86,7 @@ translators.set('cjs', async (url, isMain) => { // through normal resolution translators.set('builtin', async (url) => { debug(`Translating BuiltinModule ${url}`); - // slice 'node:' scheme + // Slice 'node:' scheme const id = url.slice(5); const module = NativeModule.map.get(id); if (!module) { diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 5706d560baeb9c..7d2e83100c7939 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -167,7 +167,7 @@ function wrapProcessMethods(binding) { throw new ERR_INVALID_ARG_TYPE('pid', 'number', pid); } - // preserve null signal + // Preserve null signal if (sig === (sig | 0)) { // XXX(joyeecheung): we have to use process._kill here because // it's monkey-patched by tests. @@ -268,12 +268,12 @@ function buildAllowedFlags() { } delete() { - // noop, `Set` API compatible + // No-op, `Set` API compatible return false; } clear() { - // noop + // No-op } has(key) { diff --git a/lib/internal/readline.js b/lib/internal/readline.js index b05c2d575a31dc..a5611942977df8 100644 --- a/lib/internal/readline.js +++ b/lib/internal/readline.js @@ -186,7 +186,7 @@ function* emitKeys(stream) { } if (escaped && (ch === 'O' || ch === '[')) { - // ansi escape sequence + // ANSI escape sequence let code = ch; let modifier = 0; @@ -407,7 +407,7 @@ function* emitKeys(stream) { key.name = String.fromCharCode(ch.charCodeAt(0) + 'a'.charCodeAt(0) - 1); key.ctrl = true; } else if (/^[0-9A-Za-z]$/.test(ch)) { - // letter, number, shift+letter + // Letter, number, shift+letter key.name = ch.toLowerCase(); key.shift = /^[A-Z]$/.test(ch); key.meta = escaped; diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index 0d22e4efeec99c..16d1316b168f01 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -18,9 +18,7 @@ function readAndResolve(iter) { const resolve = iter[kLastResolve]; if (resolve !== null) { const data = iter[kStream].read(); - // we defer if data is null - // we can be expecting either 'end' or - // 'error' + // We defer if data is null. We can be expecting either 'end' or 'error'. if (data !== null) { iter[kLastPromise] = null; iter[kLastResolve] = null; @@ -32,7 +30,7 @@ function readAndResolve(iter) { function onReadable(iter) { // We wait for the next tick, because it might - // emit an error with process.nextTick + // emit an error with `process.nextTick()`. process.nextTick(readAndResolve, iter); } @@ -59,7 +57,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ next() { // If we have detected an error in the meanwhile - // reject straight away + // reject straight away. const error = this[kError]; if (error !== null) { return Promise.reject(error); @@ -110,9 +108,9 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ }, return() { - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to + // destroy(err, cb) is a private API. + // We can guarantee we have that here, because we control the + // Readable class this is attached to. return new Promise((resolve, reject) => { this[kStream].destroy(null, (err) => { if (err) { @@ -135,9 +133,8 @@ const createReadableStreamAsyncIterator = (stream) => { value: stream._readableState.endEmitted, writable: true }, - // The function passed to new Promise - // is cached so we avoid allocating a new - // closure at every run + // The function passed to new Promise is cached so we avoid allocating a new + // closure at every run. [kHandlePromise]: { value: (resolve, reject) => { const data = iterator[kStream].read(); @@ -159,8 +156,8 @@ 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 - // returned by next() and store the error + // Reject if we are waiting for data in the Promise returned by next() and + // store the error. if (reject !== null) { iterator[kLastPromise] = null; iterator[kLastResolve] = null; diff --git a/lib/internal/timers.js b/lib/internal/timers.js index d485c3ff65a8a5..9a1b0dea0b0dfb 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -154,7 +154,7 @@ function initAsyncResource(resource, type) { // Timer constructor function. // The entire prototype is defined in lib/timers.js function Timeout(callback, after, args, isRepeat) { - after *= 1; // coalesce to number or NaN + after *= 1; // Coalesce to number or NaN if (!(after >= 1 && after <= TIMEOUT_MAX)) { if (after > TIMEOUT_MAX) { process.emitWarning(`${after} does not fit into` + diff --git a/lib/internal/trace_events_async_hooks.js b/lib/internal/trace_events_async_hooks.js index 05bb7b85644915..3b69a85fabf5c7 100644 --- a/lib/internal/trace_events_async_hooks.js +++ b/lib/internal/trace_events_async_hooks.js @@ -60,7 +60,7 @@ function createHook() { trace(kEndEvent, kTraceEventCategory, type, asyncId); - // cleanup asyncId to type map + // Cleanup asyncId to type map typeMemory.delete(asyncId); } }); diff --git a/lib/internal/url.js b/lib/internal/url.js index 95f0fc21e56c90..9bbd80148cded5 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -136,7 +136,7 @@ class URLSearchParams { throw new ERR_ARG_NOT_ITERABLE('Query pairs'); } - // sequence> + // Sequence> // Note: per spec we have to first exhaust the lists then process them const pairs = []; for (const pair of init) { @@ -159,7 +159,7 @@ class URLSearchParams { this[searchParams].push(pair[0], pair[1]); } } else { - // record + // Record // Need to use reflection APIs for full spec compliance. this[searchParams] = []; const keys = Reflect.ownKeys(init); @@ -230,7 +230,7 @@ function onParseComplete(flags, protocol, username, password, ctx.query = query; ctx.fragment = fragment; ctx.host = host; - if (!this[searchParams]) { // invoked from URL constructor + if (!this[searchParams]) { // Invoked from URL constructor this[searchParams] = new URLSearchParams(); this[searchParams][context] = this; } @@ -455,7 +455,7 @@ Object.defineProperties(URL.prototype, { try { return (new URL(ctx.path[0])).origin; } catch { - // fall through... do nothing + // Fall through... do nothing } } return kOpaqueOrigin; diff --git a/lib/net.js b/lib/net.js index 7b4f3f29da84d6..e1a8f1e518f8af 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1261,7 +1261,7 @@ function emitErrorNT(self, err) { function emitListeningNT(self) { - // ensure handle hasn't closed + // Ensure handle hasn't closed if (self._handle) self.emit('listening'); } diff --git a/lib/readline.js b/lib/readline.js index 4012af8bce6d00..67e71fee4164fc 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -96,7 +96,7 @@ function Interface(input, output, completer, terminal) { let prompt = '> '; if (input && input.input) { - // an options object was given + // An options object was given output = input.output; completer = input.completer; terminal = input.terminal; @@ -222,7 +222,7 @@ function Interface(input, output, completer, terminal) { emitKeypressEvents(input, this); - // input usually refers to stdin + // `input` usually refers to stdin input.on('keypress', onkeypress); input.on('end', ontermend); @@ -496,7 +496,7 @@ Interface.prototype._tabComplete = function(lastKeypressWasTab) { } const completions = rv[0]; - const completeOn = rv[1]; // the text that was completed + const completeOn = rv[1]; // The text that was completed if (completions && completions.length) { // Apply/show completions. if (lastKeypressWasTab) { @@ -688,7 +688,7 @@ Interface.prototype._historyNext = function() { if (this.historyIndex > 0) { this.historyIndex--; this.line = this.history[this.historyIndex]; - this.cursor = this.line.length; // set cursor to end of line. + this.cursor = this.line.length; // Set cursor to end of line. this._refreshLine(); } else if (this.historyIndex === 0) { @@ -704,7 +704,7 @@ Interface.prototype._historyPrev = function() { if (this.historyIndex + 1 < this.history.length) { this.historyIndex++; this.line = this.history[this.historyIndex]; - this.cursor = this.line.length; // set cursor to end of line. + this.cursor = this.line.length; // Set cursor to end of line. this._refreshLine(); } @@ -814,7 +814,7 @@ function _ttyWriteDumb(s, key) { } switch (key.name) { - case 'return': // carriage return, i.e. \r + case 'return': // Carriage return, i.e. \r this._sawReturnAt = Date.now(); this._line(); break; @@ -837,7 +837,7 @@ function _ttyWriteDumb(s, key) { } } -// handle a write from the tty +// Handle a write from the tty Interface.prototype._ttyWrite = function(s, key) { const previousKey = this._previousKey; key = key || {}; @@ -893,11 +893,11 @@ Interface.prototype._ttyWrite = function(s, key) { this._deleteLineRight(); break; - case 'a': // go to the start of the line + case 'a': // Go to the start of the line this._moveCursor(-Infinity); break; - case 'e': // go to the end of the line + case 'e': // Go to the end of the line this._moveCursor(+Infinity); break; @@ -905,11 +905,11 @@ Interface.prototype._ttyWrite = function(s, key) { this._moveCursor(-charLengthLeft(this.line, this.cursor)); break; - case 'f': // forward one character + case 'f': // Forward one character this._moveCursor(+charLengthAt(this.line, this.cursor)); break; - case 'l': // clear the whole screen + case 'l': // Clear the whole screen cursorTo(this.output, 0, 0); clearScreenDown(this.output); this._refreshLine(); @@ -919,7 +919,7 @@ Interface.prototype._ttyWrite = function(s, key) { this._historyNext(); break; - case 'p': // previous history item + case 'p': // Previous history item this._historyPrev(); break; @@ -997,7 +997,7 @@ Interface.prototype._ttyWrite = function(s, key) { this._sawReturnAt = 0; switch (key.name) { - case 'return': // carriage return, i.e. \r + case 'return': // Carriage return, i.e. \r this._sawReturnAt = Date.now(); this._line(); break; diff --git a/lib/repl.js b/lib/repl.js index ea4f6ac7e79c52..0ca136023080ee 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1016,12 +1016,12 @@ function complete(line, callback) { if (kill.isFunction) tmp[kill.line] = ''; } - var flat = new ArrayStream(); // make a new "input" stream - var magic = new REPLServer('', flat); // make a nested REPL + var flat = new ArrayStream(); // Make a new "input" stream. + var magic = new REPLServer('', flat); // Make a nested REPL. replMap.set(magic, replMap.get(this)); - flat.run(tmp); // eval the flattened code - // all this is only profitable if the nested REPL - // does not have a bufferedCommand + flat.run(tmp); // `eval` the flattened code. + // All this is only profitable if the nested REPL does not have a + // bufferedCommand. if (!magic[kBufferedCommandSymbol]) { magic._domain.on('error', (err) => { throw err; }); return magic.complete(line, callback); @@ -1188,7 +1188,7 @@ function complete(line, callback) { // https://github.com/nodejs/node/issues/2119 } } - // works for non-objects + // Works for non-objects try { var sentinel = 5; var p; diff --git a/lib/url.js b/lib/url.js index f50d180c7a1585..edc55c87aaaec7 100644 --- a/lib/url.js +++ b/lib/url.js @@ -258,7 +258,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { rest = rest.slice(proto.length); } - // figure out if it's got a host + // Figure out if it's got a host // user@server is *always* interpreted as a hostname, and url // resolution will treat //foo/bar as host=foo,path=bar because that's // how the browser resolves relative URLs. @@ -448,7 +448,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { this.pathname = '/'; } - // to support http.request + // To support http.request if (this.pathname || this.search) { const p = this.pathname || ''; const s = this.search || ''; @@ -746,7 +746,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result.auth = relative.auth; result.hostname = relative.hostname || relative.host; result.port = relative.port; - // to support http.request + // To support http.request if (result.pathname || result.search) { var p = result.pathname || ''; var s = result.search || ''; @@ -819,7 +819,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result.search = relative.search; result.query = relative.query; } else if (relative.search !== null && relative.search !== undefined) { - // just pull out the search. + // Just pull out the search. // like href='?foo'. // Put this after the other two cases because it simplifies the booleans if (noLeadingSlashes) { @@ -846,8 +846,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { } if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. + // No path at all. All other things were already handled above. result.pathname = null; // To support http.request if (result.search) { diff --git a/lib/zlib.js b/lib/zlib.js index 9220b11b0f5971..f598f8b64f0bc5 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -555,7 +555,7 @@ function processCallback() { self.push(null); } - // finished with the chunk. + // Finished with the chunk. this.buffer = null; this.cb(); } diff --git a/test/addons/openssl-client-cert-engine/test.js b/test/addons/openssl-client-cert-engine/test.js index 6466b0fd9d31ef..1320e7b945d66d 100644 --- a/test/addons/openssl-client-cert-engine/test.js +++ b/test/addons/openssl-client-cert-engine/test.js @@ -38,7 +38,7 @@ const server = https.createServer(serverOptions, (req, res) => { host: common.localhostIPv4, port: server.address().port, path: '/test', - clientCertEngine: engine, // engine will provide key+cert + clientCertEngine: engine, // `engine` will provide key+cert rejectUnauthorized: false, // Prevent failing on self-signed certificates headers: {} }; diff --git a/test/async-hooks/test-async-await.js b/test/async-hooks/test-async-await.js index 8aee59a36ff561..19a22d3076b8c0 100644 --- a/test/async-hooks/test-async-await.js +++ b/test/async-hooks/test-async-await.js @@ -12,7 +12,7 @@ const initHooks = require('./init-hooks'); const util = require('util'); const sleep = util.promisify(setTimeout); -// either 'inited' or 'resolved' +// Either 'inited' or 'resolved' const promisesInitState = new Map(); // Either 'before' or 'after' AND asyncId must be present in the other map const promisesExecutionState = new Map(); diff --git a/test/async-hooks/test-graph.signal.js b/test/async-hooks/test-graph.signal.js index c2f889e7b02569..67bf1cf6d8d3ab 100644 --- a/test/async-hooks/test-graph.signal.js +++ b/test/async-hooks/test-graph.signal.js @@ -13,7 +13,7 @@ const { exec } = require('child_process'); const hooks = initHooks(); hooks.enable(); -const interval = setInterval(() => {}, 9999); // keep event loop open +const interval = setInterval(() => {}, 9999); // Keep event loop open process.on('SIGUSR2', common.mustCall(onsigusr2, 2)); let count = 0; @@ -35,7 +35,7 @@ function onsigusr2() { } function onsigusr2Again() { - clearInterval(interval); // let the event loop close + clearInterval(interval); // Let the event loop close } process.on('exit', onexit); diff --git a/test/async-hooks/test-graph.statwatcher.js b/test/async-hooks/test-graph.statwatcher.js index 3067045d2bf8ac..96376926a67450 100644 --- a/test/async-hooks/test-graph.statwatcher.js +++ b/test/async-hooks/test-graph.statwatcher.js @@ -10,16 +10,16 @@ const hooks = initHooks(); hooks.enable(); function onchange() { } -// install first file watcher +// Install first file watcher fs.watchFile(__filename, onchange); -// install second file watcher +// Install second file watcher fs.watchFile(commonPath, onchange); -// remove first file watcher +// Remove first file watcher fs.unwatchFile(__filename); -// remove second file watcher +// Remove second file watcher fs.unwatchFile(commonPath); process.on('exit', onexit); diff --git a/test/async-hooks/test-immediate.js b/test/async-hooks/test-immediate.js index 7b51902f77cbeb..fa9475abaed2ef 100644 --- a/test/async-hooks/test-immediate.js +++ b/test/async-hooks/test-immediate.js @@ -9,7 +9,7 @@ const { checkInvocations } = require('./hook-checks'); const hooks = initHooks(); hooks.enable(); -// install first immediate +// Install first immediate setImmediate(common.mustCall(onimmediate)); const as = hooks.activitiesOfTypes('Immediate'); @@ -29,7 +29,7 @@ function onimmediate() { checkInvocations(imd1, { init: 1, before: 1 }, 'imd1: when first set immediate triggered'); - // install second immediate + // Install second immediate setImmediate(common.mustCall(onimmediateTwo)); as = hooks.activitiesOfTypes('Immediate'); assert.strictEqual(as.length, 2); diff --git a/test/async-hooks/test-statwatcher.js b/test/async-hooks/test-statwatcher.js index 92832a46803bd4..d67bef26eb1d09 100644 --- a/test/async-hooks/test-statwatcher.js +++ b/test/async-hooks/test-statwatcher.js @@ -22,7 +22,7 @@ const hooks = initHooks(); hooks.enable(); function onchange() {} -// install first file watcher +// Install first file watcher const w1 = fs.watchFile(file1, { interval: 10 }, onchange); let as = hooks.activitiesOfTypes('STATWATCHER'); @@ -35,7 +35,7 @@ assert.strictEqual(statwatcher1.triggerAsyncId, 1); checkInvocations(statwatcher1, { init: 1 }, 'watcher1: when started to watch file'); -// install second file watcher +// Install second file watcher const w2 = fs.watchFile(file2, { interval: 10 }, onchange); as = hooks.activitiesOfTypes('STATWATCHER'); assert.strictEqual(as.length, 2); diff --git a/test/async-hooks/test-timers.setTimeout.js b/test/async-hooks/test-timers.setTimeout.js index 748fa5565eee64..540c88abade3b6 100644 --- a/test/async-hooks/test-timers.setTimeout.js +++ b/test/async-hooks/test-timers.setTimeout.js @@ -10,7 +10,7 @@ const TIMEOUT = common.platformTimeout(100); const hooks = initHooks(); hooks.enable(); -// install first timeout +// Install first timeout setTimeout(common.mustCall(ontimeout), TIMEOUT); const as = hooks.activitiesOfTypes('Timeout'); assert.strictEqual(as.length, 1); diff --git a/test/async-hooks/test-ttywrap.readstream.js b/test/async-hooks/test-ttywrap.readstream.js index bf81a3266c1fb6..e6fb3cdc28a4fe 100644 --- a/test/async-hooks/test-ttywrap.readstream.js +++ b/test/async-hooks/test-ttywrap.readstream.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); -// general hook test setup +// General hook test setup const tick = require('../common/tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); diff --git a/test/async-hooks/test-ttywrap.writestream.js b/test/async-hooks/test-ttywrap.writestream.js index 44f32e80f015c2..bcc164c659beed 100644 --- a/test/async-hooks/test-ttywrap.writestream.js +++ b/test/async-hooks/test-ttywrap.writestream.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); -// general hook test setup +// General hook test setup const tick = require('../common/tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); diff --git a/test/common/index.js b/test/common/index.js index d6a24dd944f82a..b0e7e0cd115cef 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -795,7 +795,7 @@ module.exports = { if (opensslCli !== null) return opensslCli; if (process.config.variables.node_shared_openssl) { - // use external command + // Use external command opensslCli = 'openssl'; } else { // Use command built from sources included in Node.js repository diff --git a/test/es-module/test-esm-preserve-symlinks-main.js b/test/es-module/test-esm-preserve-symlinks-main.js index 38ef5d8fcce6ad..239fdddc2e8d79 100644 --- a/test/es-module/test-esm-preserve-symlinks-main.js +++ b/test/es-module/test-esm-preserve-symlinks-main.js @@ -52,6 +52,6 @@ function doTest(flags, done) { // First test the commonjs module loader doTest([], () => { - // now test the new loader + // Now test the new loader doTest(['--experimental-modules'], () => {}); }); diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js index f0be79085b6658..44b672cdc1f77f 100644 --- a/test/js-native-api/test_general/test.js +++ b/test/js-native-api/test_general/test.js @@ -18,12 +18,12 @@ class ExtendedClass extends BaseClass { const baseObject = new BaseClass(); const extendedObject = new ExtendedClass(); -// test napi_strict_equals +// Test napi_strict_equals assert.ok(test_general.testStrictEquals(val1, val1)); assert.strictEqual(test_general.testStrictEquals(val1, val2), false); assert.ok(test_general.testStrictEquals(val2, val3)); -// test napi_get_prototype +// Test napi_get_prototype assert.strictEqual(test_general.testGetPrototype(baseObject), Object.getPrototypeOf(baseObject)); assert.strictEqual(test_general.testGetPrototype(extendedObject), diff --git a/test/js-native-api/test_number/test.js b/test/js-native-api/test_number/test.js index a7a6009852d884..808d1d9d5c374f 100644 --- a/test/js-native-api/test_number/test.js +++ b/test/js-native-api/test_number/test.js @@ -4,7 +4,7 @@ const assert = require('assert'); const test_number = require(`./build/${common.buildType}/test_number`); -// testing api calls for number +// Testing api calls for number function testNumber(num) { assert.strictEqual(num, test_number.Test(num)); } diff --git a/test/js-native-api/test_string/test.js b/test/js-native-api/test_string/test.js index 86fdc1640602bc..1be34212a11c3f 100644 --- a/test/js-native-api/test_string/test.js +++ b/test/js-native-api/test_string/test.js @@ -2,7 +2,7 @@ const common = require('../../common'); const assert = require('assert'); -// testing api calls for string +// Testing api calls for string const test_string = require(`./build/${common.buildType}/test_string`); const empty = ''; diff --git a/test/js-native-api/test_symbol/test1.js b/test/js-native-api/test_symbol/test1.js index 9232210c46da46..c0a4634c88e898 100644 --- a/test/js-native-api/test_symbol/test1.js +++ b/test/js-native-api/test_symbol/test1.js @@ -2,7 +2,7 @@ const common = require('../../common'); const assert = require('assert'); -// testing api calls for symbol +// Testing api calls for symbol const test_symbol = require(`./build/${common.buildType}/test_symbol`); const sym = test_symbol.New('test'); diff --git a/test/js-native-api/test_symbol/test2.js b/test/js-native-api/test_symbol/test2.js index 8bc731b40cb5fe..2060409b9bf8df 100644 --- a/test/js-native-api/test_symbol/test2.js +++ b/test/js-native-api/test_symbol/test2.js @@ -2,7 +2,7 @@ const common = require('../../common'); const assert = require('assert'); -// testing api calls for symbol +// Testing api calls for symbol const test_symbol = require(`./build/${common.buildType}/test_symbol`); const fooSym = test_symbol.New('foo'); diff --git a/test/js-native-api/test_symbol/test3.js b/test/js-native-api/test_symbol/test3.js index a7c6c18c025480..445fa3f891954c 100644 --- a/test/js-native-api/test_symbol/test3.js +++ b/test/js-native-api/test_symbol/test3.js @@ -2,7 +2,7 @@ const common = require('../../common'); const assert = require('assert'); -// testing api calls for symbol +// Testing api calls for symbol const test_symbol = require(`./build/${common.buildType}/test_symbol`); assert.notStrictEqual(test_symbol.New(), test_symbol.New()); diff --git a/test/known_issues/test-vm-ownkeys.js b/test/known_issues/test-vm-ownkeys.js index 12d3ba7470bf8f..f245b0f7b52a37 100644 --- a/test/known_issues/test-vm-ownkeys.js +++ b/test/known_issues/test-vm-ownkeys.js @@ -24,5 +24,5 @@ const ctx = vm.createContext(sandbox); const nativeKeys = vm.runInNewContext('Reflect.ownKeys(this);'); const ownKeys = vm.runInContext('Reflect.ownKeys(this);', ctx); const restKeys = ownKeys.filter((key) => !nativeKeys.includes(key)); -// this should not fail +// This should not fail assert.deepStrictEqual(Array.from(restKeys), ['a', 'b', sym1, sym2]); diff --git a/test/known_issues/test-vm-ownpropertynames.js b/test/known_issues/test-vm-ownpropertynames.js index cb8184babc8904..d1c03186ab19ee 100644 --- a/test/known_issues/test-vm-ownpropertynames.js +++ b/test/known_issues/test-vm-ownpropertynames.js @@ -24,5 +24,5 @@ const ctx = vm.createContext(sandbox); const nativeNames = vm.runInNewContext('Object.getOwnPropertyNames(this);'); const ownNames = vm.runInContext('Object.getOwnPropertyNames(this);', ctx); const restNames = ownNames.filter((name) => !nativeNames.includes(name)); -// this should not fail +// This should not fail assert.deepStrictEqual(Array.from(restNames), ['a', 'b']); diff --git a/test/known_issues/test-vm-ownpropertysymbols.js b/test/known_issues/test-vm-ownpropertysymbols.js index f11c4999cd463b..2f501627907164 100644 --- a/test/known_issues/test-vm-ownpropertysymbols.js +++ b/test/known_issues/test-vm-ownpropertysymbols.js @@ -24,5 +24,5 @@ const ctx = vm.createContext(sandbox); const nativeSym = vm.runInNewContext('Object.getOwnPropertySymbols(this);'); const ownSym = vm.runInContext('Object.getOwnPropertySymbols(this);', ctx); const restSym = ownSym.filter((sym) => !nativeSym.includes(sym)); -// this should not fail +// This should not fail assert.deepStrictEqual(Array.from(restSym), [sym1, sym2]); diff --git a/test/message/throw_custom_error.js b/test/message/throw_custom_error.js index 7290df53e12420..3e0e6a271c7415 100644 --- a/test/message/throw_custom_error.js +++ b/test/message/throw_custom_error.js @@ -22,6 +22,6 @@ 'use strict'; require('../common'); -// custom error throwing +// Custom error throwing // eslint-disable-next-line no-throw-literal throw ({ name: 'MyCustomError', message: 'This is a custom message' }); diff --git a/test/message/throw_non_error.js b/test/message/throw_non_error.js index e7d2f54b85f78f..fc1a568015aaf2 100644 --- a/test/message/throw_non_error.js +++ b/test/message/throw_non_error.js @@ -22,6 +22,6 @@ 'use strict'; require('../common'); -// custom error throwing +// Custom error throwing // eslint-disable-next-line no-throw-literal throw ({ foo: 'bar' }); diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 5b711734780064..3675a18a284fd4 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -356,7 +356,7 @@ assertNotDeepOrStrict( new Map([['1', 5], [0, 5], ['0', 5]]) ); -// undefined value in Map +// Undefined value in Map assertDeepAndStrictEqual( new Map([[1, undefined]]), new Map([[1, undefined]]) diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index ddf2edd896dfb2..8369936b4d8eca 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -537,7 +537,7 @@ assert.strictEqual(Buffer.from('A', 'base64').length, 0); { - // test an invalid slice end. + // Test an invalid slice end. const b = Buffer.from([1, 2, 3, 4, 5]); const b2 = b.toString('hex', 1, 10000); const b3 = b.toString('hex', 1, 5); @@ -737,7 +737,7 @@ assert.strictEqual(x.inspect(), ''); } { - // test for buffer overrun + // Test for buffer overrun const buf = Buffer.from([0, 0, 0, 0, 0]); // length: 5 const sub = buf.slice(0, 4); // length: 4 assert.strictEqual(sub.write('12345', 'latin1'), 4); @@ -747,7 +747,7 @@ assert.strictEqual(x.inspect(), ''); } { - // test alloc with fill option + // Test alloc with fill option const buf = Buffer.alloc(5, '800A', 'hex'); assert.strictEqual(buf[0], 128); assert.strictEqual(buf[1], 10); diff --git a/test/parallel/test-buffer-compare-offset.js b/test/parallel/test-buffer-compare-offset.js index 47e5f3041e12e6..8c590f52ed480c 100644 --- a/test/parallel/test-buffer-compare-offset.js +++ b/test/parallel/test-buffer-compare-offset.js @@ -48,7 +48,7 @@ assert.strictEqual(a.compare(b, 0, 7, 4, 6), -1); // zero length target assert.strictEqual(a.compare(b, 0, null), 1); -// coerces to targetEnd == 5 +// Coerces to targetEnd == 5 assert.strictEqual(a.compare(b, 0, { valueOf: () => 5 }), -1); // zero length target diff --git a/test/parallel/test-buffer-copy.js b/test/parallel/test-buffer-copy.js index b35609743764b3..9810c9824b7b58 100644 --- a/test/parallel/test-buffer-copy.js +++ b/test/parallel/test-buffer-copy.js @@ -128,7 +128,7 @@ common.expectsError( } } -// throw with negative sourceEnd +// Throw with negative sourceEnd common.expectsError( () => b.copy(c, 0, -1), errorProperty); diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js index 605f988de5c648..5bad445adec524 100644 --- a/test/parallel/test-buffer-includes.js +++ b/test/parallel/test-buffer-includes.js @@ -88,7 +88,7 @@ assert.strictEqual( true ); -// test base64 encoding +// Test base64 encoding assert.strictEqual( Buffer.from(b.toString('base64'), 'base64') .includes('ZA==', 0, 'base64'), @@ -112,7 +112,7 @@ assert.strictEqual( true ); -// test latin1 encoding +// Test latin1 encoding assert.strictEqual( Buffer.from(b.toString('latin1'), 'latin1') .includes('d', 0, 'latin1'), @@ -124,7 +124,7 @@ assert.strictEqual( true ); -// test binary encoding +// Test binary encoding assert.strictEqual( Buffer.from(b.toString('binary'), 'binary') .includes('d', 0, 'binary'), diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 44353c127602d8..3f0449ceb084f1 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -96,7 +96,7 @@ assert.strictEqual( 3 ); -// test base64 encoding +// Test base64 encoding assert.strictEqual( Buffer.from(b.toString('base64'), 'base64') .indexOf('ZA==', 0, 'base64'), @@ -120,7 +120,7 @@ assert.strictEqual( 3 ); -// test latin1 encoding +// Test latin1 encoding assert.strictEqual( Buffer.from(b.toString('latin1'), 'latin1') .indexOf('d', 0, 'latin1'), @@ -147,7 +147,7 @@ assert.strictEqual( 0 ); -// test binary encoding +// Test binary encoding assert.strictEqual( Buffer.from(b.toString('binary'), 'binary') .indexOf('d', 0, 'binary'), diff --git a/test/parallel/test-buffer-iterator.js b/test/parallel/test-buffer-iterator.js index 72b775c71313d7..0016b021c078bf 100644 --- a/test/parallel/test-buffer-iterator.js +++ b/test/parallel/test-buffer-iterator.js @@ -6,7 +6,7 @@ const buffer = Buffer.from([1, 2, 3, 4, 5]); let arr; let b; -// buffers should be iterable +// Buffers should be iterable arr = []; diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index 1dbc217bdae970..baab6107c4d7f7 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -7,7 +7,7 @@ const SlowBuffer = buffer.SlowBuffer; const ones = [1, 1, 1, 1]; -// should create a Buffer +// Should create a Buffer let sb = SlowBuffer(4); assert(sb instanceof Buffer); assert.strictEqual(sb.length, 4); @@ -19,7 +19,7 @@ for (const [key, value] of sb.entries()) { // underlying ArrayBuffer should have the same length assert.strictEqual(sb.buffer.byteLength, 4); -// should work without new +// Should work without new sb = SlowBuffer(4); assert(sb instanceof Buffer); assert.strictEqual(sb.length, 4); @@ -28,7 +28,7 @@ for (const [key, value] of sb.entries()) { assert.deepStrictEqual(value, ones[key]); } -// should work with edge cases +// Should work with edge cases assert.strictEqual(SlowBuffer(0).length, 0); try { assert.strictEqual( diff --git a/test/parallel/test-child-process-constructor.js b/test/parallel/test-child-process-constructor.js index f0bebd61efc057..9c9ed2d0e84900 100644 --- a/test/parallel/test-child-process-constructor.js +++ b/test/parallel/test-child-process-constructor.js @@ -73,7 +73,7 @@ function typeName(value) { }); } -// test that we can call spawn +// Test that we can call spawn const child = new ChildProcess(); child.spawn({ file: process.execPath, diff --git a/test/parallel/test-child-process-disconnect.js b/test/parallel/test-child-process-disconnect.js index 7ba30b28db3d3e..fb8a2dd0ea2213 100644 --- a/test/parallel/test-child-process-disconnect.js +++ b/test/parallel/test-child-process-disconnect.js @@ -80,7 +80,7 @@ if (process.argv[2] === 'child') { // The process should also self terminate without using signals child.on('exit', common.mustCall()); - // when child is listening + // When child is listening child.on('message', function(obj) { if (obj && obj.msg === 'ready') { @@ -90,7 +90,7 @@ if (process.argv[2] === 'child') { socket.on('data', function(data) { data = data.toString(); - // ready to be disconnected + // Ready to be disconnected if (data === 'ready') { child.disconnect(); assert.throws( @@ -101,7 +101,7 @@ if (process.argv[2] === 'child') { return; } - // disconnect is emitted + // 'disconnect' is emitted childFlag = (data === 'true'); }); diff --git a/test/parallel/test-child-process-exec-error.js b/test/parallel/test-child-process-exec-error.js index cb8ace0a9bf3e8..eaddeb6614e921 100644 --- a/test/parallel/test-child-process-exec-error.js +++ b/test/parallel/test-child-process-exec-error.js @@ -32,9 +32,9 @@ function test(fn, code) { } if (common.isWindows) { - test(child_process.exec, 1); // exit code of cmd.exe + test(child_process.exec, 1); // Exit code of cmd.exe } else { - test(child_process.exec, 127); // exit code of /bin/sh + test(child_process.exec, 127); // Exit code of /bin/sh } test(child_process.execFile, 'ENOENT'); diff --git a/test/parallel/test-child-process-fork-net-server.js b/test/parallel/test-child-process-fork-net-server.js index 340b3075f9622a..9d39e149af26f7 100644 --- a/test/parallel/test-child-process-fork-net-server.js +++ b/test/parallel/test-child-process-fork-net-server.js @@ -124,7 +124,7 @@ if (process.argv[2] === 'child') { } } else if (msg.what === 'connection') { - // child got connection + // Child got connection connections.done(); } else if (msg.what === 'close') { child.removeListener('message', messageHandlers); diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index 90ce482309b98f..6607d7981666de 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -48,7 +48,7 @@ if (process.argv[2] === 'child') { console.error(`[${id}] socket.end ${m}`); }); - // store the unfinished socket + // Store the unfinished socket if (m === 'write') { needEnd.push(socket); } diff --git a/test/parallel/test-child-process-spawnsync-input.js b/test/parallel/test-child-process-spawnsync-input.js index 6e4a22c0e32d97..d1a602460e92fc 100644 --- a/test/parallel/test-child-process-spawnsync-input.js +++ b/test/parallel/test-child-process-spawnsync-input.js @@ -29,7 +29,7 @@ const spawnSync = require('child_process').spawnSync; const msgOut = 'this is stdout'; const msgErr = 'this is stderr'; -// this is actually not os.EOL? +// This is actually not os.EOL? const msgOutBuf = Buffer.from(`${msgOut}\n`); const msgErrBuf = Buffer.from(`${msgErr}\n`); diff --git a/test/parallel/test-child-process-stdio-inherit.js b/test/parallel/test-child-process-stdio-inherit.js index dfffb70c582016..034a0770168bc9 100644 --- a/test/parallel/test-child-process-stdio-inherit.js +++ b/test/parallel/test-child-process-stdio-inherit.js @@ -51,6 +51,6 @@ function grandparent() { } function parent() { - // should not immediately exit. + // Should not immediately exit. spawn('cat', [], { stdio: 'inherit' }); } diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js index 4ef319ae80d409..7bd818a5e1fe8c 100644 --- a/test/parallel/test-cluster-bind-twice.js +++ b/test/parallel/test-cluster-bind-twice.js @@ -102,7 +102,7 @@ if (!id) { })); }, 2)); } else { - assert(0); // bad command line argument + assert(0); // Bad command line argument } function startWorker() { diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js index 51cbb43c63f5a4..3d1f14257bca59 100644 --- a/test/parallel/test-cluster-disconnect.js +++ b/test/parallel/test-cluster-disconnect.js @@ -37,7 +37,7 @@ if (cluster.isWorker) { const servers = 2; const serverPorts = new Set(); - // test a single TCP server + // Test a single TCP server const testConnection = (port, cb) => { const socket = net.connect(port, '127.0.0.1', () => { // buffer result diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index 4c2d28429307dc..cf6eae1d38eaa6 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -66,7 +66,7 @@ if (cluster.isMaster && process.argv.length !== 3) { server.on('error', function(err) { // Message to child process tells it to exit cp.send('end'); - // propagate error to parent + // 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 2cc800398147f6..3c22e07edeaad2 100644 --- a/test/parallel/test-cluster-master-kill.js +++ b/test/parallel/test-cluster-master-kill.js @@ -26,7 +26,7 @@ const cluster = require('cluster'); if (cluster.isWorker) { - // keep the worker alive + // Keep the worker alive const http = require('http'); http.Server().listen(0, '127.0.0.1'); @@ -39,7 +39,7 @@ if (cluster.isWorker) { pid: worker.process.pid }); - // terminate the cluster process + // Terminate the cluster process worker.once('listening', common.mustCall(() => { setTimeout(() => { process.exit(0); @@ -67,7 +67,7 @@ if (cluster.isWorker) { // Make sure that the master died on purpose assert.strictEqual(code, 0); - // check worker process status + // Check worker process status const pollWorker = () => { alive = common.isAlive(pid); if (alive) { diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js index ba9c4f8775760e..f93a3f587096ab 100644 --- a/test/parallel/test-cluster-worker-exit.js +++ b/test/parallel/test-cluster-worker-exit.js @@ -116,7 +116,7 @@ if (cluster.isWorker) { }; } -// some helper functions ... +// Some helper functions ... function checkResults(expected_results, results) { for (const k in expected_results) { diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index 1f2978bdb5b406..0cd6d0321cf670 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -103,7 +103,7 @@ if (cluster.isWorker) { }); } -// some helper functions ... +// Some helper functions ... function checkResults(expected_results, results) { for (const k in expected_results) { diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index 65e1645f7b1e7b..8f259b7c940b76 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -134,7 +134,7 @@ console.dir(custom_inspect, { showHidden: false }); console.dir({ foo: { bar: { baz: true } } }, { depth: 0 }); console.dir({ foo: { bar: { baz: true } } }, { depth: 1 }); -// test console.dirxml() +// Test console.dirxml() console.dirxml(custom_inspect, custom_inspect); console.dirxml( { foo: { bar: { baz: true } } }, @@ -142,7 +142,7 @@ console.dirxml( { foo: { bar: { quux: true } } } ); -// test console.trace() +// Test console.trace() console.trace('This is a %j %d', { formatted: 'trace' }, 10, 'foo'); // Test console.time() and console.timeEnd() output diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index e7ab8f73b02b0b..ce6ea4e3b81ea4 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -36,7 +36,7 @@ function testCipher1(key) { assert.strictEqual(txt, plaintext); - // streaming cipher interface + // Streaming cipher interface // NB: In real life, it's not guaranteed that you can get all of it // in a single read() like this. But in this case, we know it's // quite small, so there's no harm. diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index b0ad7a97daab18..d9cc725da1d393 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -23,7 +23,7 @@ function testCipher1(key, iv) { assert.strictEqual(txt, plaintext, `encryption/decryption with key ${key} and iv ${iv}`); - // streaming cipher interface + // Streaming cipher interface // NB: In real life, it's not guaranteed that you can get all of it // in a single read() like this. But in this case, we know it's // quite small, so there's no harm. diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 5a63667c995b09..ead77d6a30c811 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -230,7 +230,7 @@ if (availableCurves.has('prime256v1') && availableCurves.has('secp256k1')) { assert(firstByte === 2 || firstByte === 3); firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0]; assert(firstByte === 6 || firstByte === 7); - // format value should be string + // Format value should be string common.expectsError( () => ecdh1.getPublicKey('buffer', 10), diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index 7a164dffe9059b..64964cc7aedf7d 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -606,7 +606,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }); } - // cipher of invalid type. + // Cipher of invalid type. for (const cipher of [0, true, {}]) { common.expectsError(() => generateKeyPairSync('rsa', { modulusLength: 4096, diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js index d6c395f0a42d35..14d853bdfd0a5d 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -46,7 +46,7 @@ function decrypt(val, pad) { // echo 0123456789abcdef0123456789abcdef \ // | openssl enc -e -aes256 -nopad -K -iv \ // | openssl enc -d -aes256 -nopad -K -iv -let plaintext = '0123456789abcdef0123456789abcdef'; // multiple of block size +let plaintext = '0123456789abcdef0123456789abcdef'; // Multiple of block size let encrypted = encrypt(plaintext, false); let decrypted = decrypt(encrypted, false); assert.strictEqual(decrypted, plaintext); diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js index 55b5aeaf8ff06b..e1d0ddf10c98f4 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js @@ -97,9 +97,9 @@ const good = [ const bad = [ { N: 1, p: 1, r: 1 }, // N < 2 { N: 3, p: 1, r: 1 }, // Not power of 2. - { N: 1, cost: 1 }, // both N and cost - { p: 1, parallelization: 1 }, // both p and parallelization - { r: 1, blockSize: 1 } // both r and blocksize + { N: 1, cost: 1 }, // Both N and cost + { p: 1, parallelization: 1 }, // Both p and parallelization + { r: 1, blockSize: 1 } // Both r and blocksize ]; // Test vectors where 128*N*r exceeds maxmem. diff --git a/test/parallel/test-debugger-pid.js b/test/parallel/test-debugger-pid.js index e11d23152f7057..f269ff310b145c 100644 --- a/test/parallel/test-debugger-pid.js +++ b/test/parallel/test-debugger-pid.js @@ -6,7 +6,7 @@ const spawn = require('child_process').spawn; let buffer = ''; -// connect to debug agent +// Connect to debug agent const interfacer = spawn(process.execPath, ['debug', '-p', '655555']); interfacer.stdout.setEncoding('utf-8'); diff --git a/test/parallel/test-dgram-bind.js b/test/parallel/test-dgram-bind.js index 0b8447c3115da1..e3b358bdd2f1f5 100644 --- a/test/parallel/test-dgram-bind.js +++ b/test/parallel/test-dgram-bind.js @@ -38,6 +38,6 @@ socket.on('listening', common.mustCall(() => { socket.close(); })); -const result = socket.bind(); // should not throw +const result = socket.bind(); // Should not throw. -assert.strictEqual(result, socket); // should have returned itself +assert.strictEqual(result, socket); // Should have returned itself. diff --git a/test/parallel/test-dgram-close-in-listening.js b/test/parallel/test-dgram-close-in-listening.js index 16432d85d6f345..ae3ab71d7e2cff 100644 --- a/test/parallel/test-dgram-close-in-listening.js +++ b/test/parallel/test-dgram-close-in-listening.js @@ -13,7 +13,7 @@ socket.on('listening', function() { socket.close(); }); -// get a random port for send +// Get a random port for send const portGetter = dgram.createSocket('udp4') .bind(0, 'localhost', common.mustCall(() => { // Adds a listener to 'listening' to send the data when diff --git a/test/parallel/test-dgram-close-is-not-callback.js b/test/parallel/test-dgram-close-is-not-callback.js index 69c166f42f3151..bfb0bcd2bb86d4 100644 --- a/test/parallel/test-dgram-close-is-not-callback.js +++ b/test/parallel/test-dgram-close-is-not-callback.js @@ -6,7 +6,7 @@ const buf = Buffer.alloc(1024, 42); const socket = dgram.createSocket('udp4'); -// get a random port for send +// Get a random port for send const portGetter = dgram.createSocket('udp4') .bind(0, 'localhost', common.mustCall(() => { socket.send(buf, 0, buf.length, diff --git a/test/parallel/test-dgram-close.js b/test/parallel/test-dgram-close.js index 7b49cee73bed6a..3a91069c306efa 100644 --- a/test/parallel/test-dgram-close.js +++ b/test/parallel/test-dgram-close.js @@ -34,7 +34,7 @@ const buf = Buffer.alloc(1024, 42); let socket = dgram.createSocket('udp4'); const { handle } = socket[kStateSymbol]; -// get a random port for send +// Get a random port for send const portGetter = dgram.createSocket('udp4') .bind(0, 'localhost', common.mustCall(() => { socket.send(buf, 0, buf.length, diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js index 5e18ad44ae7dfa..2654c8bca20712 100644 --- a/test/parallel/test-file-write-stream2.js +++ b/test/parallel/test-file-write-stream2.js @@ -106,7 +106,7 @@ for (let i = 0; i < 11; i++) { const ret = file.write(String(i)); console.error(`${i} ${ret}`); - // return false when i hits 10 + // Return false when i hits 10 assert.strictEqual(ret, i !== 10); } cb_occurred += 'write '; diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index 370b4f46977a20..05e4515ad40abd 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -190,7 +190,7 @@ function re(literals, ...values) { ); } -// link nonexistent file +// Link nonexistent file { const validateError = (err) => { assert.strictEqual(nonexistentFile, err.path); @@ -308,7 +308,7 @@ function re(literals, ...values) { ); } -// rename non-empty directory +// Rename non-empty directory { const validateError = (err) => { assert.strictEqual(existingDir, err.path); diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index 2a15627a0f1767..9bd2df180112f0 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -98,7 +98,7 @@ function nextdir() { const pathname = path.join(tmpdir.path, nextdir(), nextdir()); fs.mkdirSync(pathname, { recursive: true }); - // should not cause an error. + // Should not cause an error. fs.mkdirSync(pathname, { recursive: true }); const exists = fs.existsSync(pathname); @@ -143,7 +143,7 @@ function nextdir() { })); } -// mkdirp when path is a file. +// `mkdirp` when path is a file. { const pathname = path.join(tmpdir.path, nextdir(), nextdir()); diff --git a/test/parallel/test-fs-promises.js b/test/parallel/test-fs-promises.js index 2e6ba0e8a24985..c12b0135191821 100644 --- a/test/parallel/test-fs-promises.js +++ b/test/parallel/test-fs-promises.js @@ -143,7 +143,7 @@ async function getHandle(dest) { assert.deepStrictEqual((await readFile(dest)).toString(), 'hello'); } - // invalid change of ownership + // Invalid change of ownership { const handle = await getHandle(dest); @@ -181,7 +181,7 @@ async function getHandle(dest) { }); } - // set modification times + // Set modification times { const handle = await getHandle(dest); @@ -271,7 +271,7 @@ async function getHandle(dest) { await unlink(newFile); } - // mkdir when options is number. + // `mkdir` when options is number. { const dir = path.join(tmpDir, nextdir()); await mkdir(dir, 777); @@ -279,7 +279,7 @@ async function getHandle(dest) { assert(stats.isDirectory()); } - // mkdir when options is string. + // `mkdir` when options is string. { const dir = path.join(tmpDir, nextdir()); await mkdir(dir, '777'); @@ -295,7 +295,7 @@ async function getHandle(dest) { assert(stats.isDirectory()); } - // mkdirp when path is a file. + // `mkdirp` when path is a file. { const dir = path.join(tmpDir, nextdir(), nextdir()); await mkdir(path.dirname(dir)); diff --git a/test/parallel/test-fs-realpath-on-substed-drive.js b/test/parallel/test-fs-realpath-on-substed-drive.js index 1c86dc364974dc..d5c684f33c073f 100644 --- a/test/parallel/test-fs-realpath-on-substed-drive.js +++ b/test/parallel/test-fs-realpath-on-substed-drive.js @@ -12,7 +12,7 @@ const spawnSync = require('child_process').spawnSync; let result; -// create a subst drive +// Create a subst drive const driveLetters = 'ABCDEFGHIJKLMNOPQRSTUWXYZ'; let drive; let i; diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 48294d4a62e0ec..d12c8a28d2a69b 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -41,7 +41,7 @@ tmpdir.refresh(); let root = '/'; let assertEqualPath = assert.strictEqual; if (common.isWindows) { - // something like "C:\\" + // Something like "C:\\" root = process.cwd().substr(0, 3); assertEqualPath = function(path_left, path_right, message) { assert diff --git a/test/parallel/test-http-agent-getname.js b/test/parallel/test-http-agent-getname.js index 31dc255ba558db..ab946a4bde3ddf 100644 --- a/test/parallel/test-http-agent-getname.js +++ b/test/parallel/test-http-agent-getname.js @@ -9,7 +9,7 @@ const tmpdir = require('../common/tmpdir'); const agent = new http.Agent(); -// default to localhost +// Default to localhost assert.strictEqual( agent.getName({ port: 80, diff --git a/test/parallel/test-http-agent-keepalive.js b/test/parallel/test-http-agent-keepalive.js index 7e2cef4e3e7ee6..5902c5867968cf 100644 --- a/test/parallel/test-http-agent-keepalive.js +++ b/test/parallel/test-http-agent-keepalive.js @@ -119,7 +119,7 @@ function remoteError() { server.listen(0, common.mustCall(() => { name = `localhost:${server.address().port}:`; - // request first, and keep alive + // Request first, and keep alive get('/first', common.mustCall((res) => { assert.strictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); diff --git a/test/parallel/test-http-client-override-global-agent.js b/test/parallel/test-http-client-override-global-agent.js index c36c9d26a8dd63..f046abaa74e45d 100644 --- a/test/parallel/test-http-client-override-global-agent.js +++ b/test/parallel/test-http-client-override-global-agent.js @@ -14,7 +14,7 @@ server.listen(0, common.mustCall(() => { http.globalAgent = agent; makeRequest(); - assert(agent.sockets.hasOwnProperty(name)); // agent has indeed been used + assert(agent.sockets.hasOwnProperty(name)); // Agent has indeed been used })); function makeRequest() { diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index 154f788c188f9d..66c0c0f6b917e8 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -36,7 +36,7 @@ const server = http.createServer((req, res) => { const m = /\/(.*)/.exec(req.url); const reqid = parseInt(m[1], 10); if (reqid % 2) { - // do not reply the request + // Do not reply the request } else { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write(reqid.toString()); diff --git a/test/parallel/test-http-many-ended-pipelines.js b/test/parallel/test-http-many-ended-pipelines.js index d17090cec918a0..eb6f1341c55927 100644 --- a/test/parallel/test-http-many-ended-pipelines.js +++ b/test/parallel/test-http-many-ended-pipelines.js @@ -22,7 +22,7 @@ 'use strict'; require('../common'); -// no warnings should happen! +// No warnings should happen! const trace = console.trace; console.trace = function() { trace.apply(console, arguments); diff --git a/test/parallel/test-http-outgoing-internal-headers.js b/test/parallel/test-http-outgoing-internal-headers.js index 2cebfe9e2b966a..13bb8efc29011c 100644 --- a/test/parallel/test-http-outgoing-internal-headers.js +++ b/test/parallel/test-http-outgoing-internal-headers.js @@ -10,14 +10,14 @@ const warn = 'OutgoingMessage.prototype._headers is deprecated'; common.expectWarning('DeprecationWarning', warn, 'DEP0066'); { - // tests for _headers get method + // Tests for _headers get method const outgoingMessage = new OutgoingMessage(); outgoingMessage.getHeaders = common.mustCall(); outgoingMessage._headers; } { - // tests for _headers set method + // Tests for _headers set method const outgoingMessage = new OutgoingMessage(); outgoingMessage._headers = { host: 'risingstack.com', 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 d7000f6fd2d42c..8bebfc14e4bc2d 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 @@ -30,9 +30,9 @@ server.once('request', common.mustCall((req, res) => { server.on('request', common.mustCall((req, res) => { res.end(Buffer.from('asdf')); })); - // write should accept string + // `res.write()` should accept `string`. res.write('string'); - // write should accept buffer + // `res.write()` should accept `buffer`. res.write(Buffer.from('asdf')); const expectedError = { @@ -40,7 +40,7 @@ server.once('request', common.mustCall((req, res) => { name: 'TypeError', }; - // Write should not accept an Array + // `res.write()` should not accept an Array. assert.throws( () => { res.write(['array']); @@ -48,7 +48,7 @@ server.once('request', common.mustCall((req, res) => { expectedError ); - // End should not accept an Array + // `res.end()` should not accept an Array. assert.throws( () => { res.end(['moo']); @@ -56,12 +56,12 @@ server.once('request', common.mustCall((req, res) => { expectedError ); - // end should accept string + // `res.end()` should accept `string`. res.end('string'); })); 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-cookies.js b/test/parallel/test-http-set-cookies.js index 7a57523b04af9c..613da4742aea4d 100644 --- a/test/parallel/test-http-set-cookies.js +++ b/test/parallel/test-http-set-cookies.js @@ -59,7 +59,7 @@ server.on('listening', function() { }); }); - // two set-cookie headers + // Two set-cookie headers http.get({ port: this.address().port, path: '/two' }, function(res) { assert.deepStrictEqual(res.headers['set-cookie'], ['A', 'B']); diff --git a/test/parallel/test-http-slow-headers-keepalive.js b/test/parallel/test-http-slow-headers-keepalive.js index 5552f33f77e3c2..4e62b59168326e 100644 --- a/test/parallel/test-http-slow-headers-keepalive.js +++ b/test/parallel/test-http-slow-headers-keepalive.js @@ -33,7 +33,7 @@ server.once('timeout', common.mustCall((socket) => { server.listen(0, () => { const client = net.connect(server.address().port); client.write(headers); - // finish the first request + // Finish the first request client.write('\r\n'); // second request client.write(headers); 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 7a9a486bcc5dde..ea5793ee18aef5 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 @@ -31,7 +31,7 @@ function check(request) { } const server = http.createServer(function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-url.parse-auth.js b/test/parallel/test-http-url.parse-auth.js index ac09c0e1b84216..2bb531158645a0 100644 --- a/test/parallel/test-http-url.parse-auth.js +++ b/test/parallel/test-http-url.parse-auth.js @@ -31,7 +31,7 @@ function check(request) { } const server = http.createServer(function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-url.parse-basic.js b/test/parallel/test-http-url.parse-basic.js index e03f39aa9035eb..71885b4bd08949 100644 --- a/test/parallel/test-http-url.parse-basic.js +++ b/test/parallel/test-http-url.parse-basic.js @@ -27,7 +27,7 @@ const url = require('url'); let testURL; -// make sure the basics work +// Make sure the basics work function check(request) { // Default method should still be 'GET' assert.strictEqual(request.method, 'GET'); @@ -39,7 +39,7 @@ function check(request) { } const server = http.createServer(function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index 6ca9e51e826859..2f18899176e73d 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -36,12 +36,12 @@ const httpsOptions = { }; function check(request) { - // assert that I'm https + // Assert that I'm https assert.ok(request.socket._secureEstablished); } const server = https.createServer(httpsOptions, function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-url.parse-path.js b/test/parallel/test-http-url.parse-path.js index 4cc5fbf48e015d..25e4838c4afaf6 100644 --- a/test/parallel/test-http-url.parse-path.js +++ b/test/parallel/test-http-url.parse-path.js @@ -26,12 +26,12 @@ const http = require('http'); const url = require('url'); function check(request) { - // a path should come over + // A path should come over assert.strictEqual(request.url, '/asdf'); } const server = http.createServer(function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-url.parse-post.js b/test/parallel/test-http-url.parse-post.js index 91a567d1560f1a..db5ee78fe6ebe2 100644 --- a/test/parallel/test-http-url.parse-post.js +++ b/test/parallel/test-http-url.parse-post.js @@ -38,7 +38,7 @@ function check(request) { } const server = http.createServer(function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-url.parse-search.js b/test/parallel/test-http-url.parse-search.js index d10713f5f1a7cb..0759c779d3ffb0 100644 --- a/test/parallel/test-http-url.parse-search.js +++ b/test/parallel/test-http-url.parse-search.js @@ -31,7 +31,7 @@ function check(request) { } const server = http.createServer(function(request, response) { - // run the check function + // Run the check function check(request); response.writeHead(200, {}); response.end('ok'); diff --git a/test/parallel/test-http-write-callbacks.js b/test/parallel/test-http-write-callbacks.js index a4f23e12cb955b..3730e57936b4a6 100644 --- a/test/parallel/test-http-write-callbacks.js +++ b/test/parallel/test-http-write-callbacks.js @@ -51,7 +51,7 @@ server.on('checkContinue', (req, res) => { server.close(); assert.strictEqual(req.method, 'PUT'); res.writeContinue(() => { - // continue has been written + // Continue has been written req.on('end', () => { res.write('asdf', (er) => { assert.ifError(er); diff --git a/test/parallel/test-http2-binding.js b/test/parallel/test-http2-binding.js index 8c2826e5fb4b6e..82eafc0de946ff 100644 --- a/test/parallel/test-http2-binding.js +++ b/test/parallel/test-http2-binding.js @@ -22,7 +22,7 @@ assert.strictEqual(settings.maxFrameSize, 16384); assert.strictEqual(binding.nghttp2ErrorString(-517), 'GOAWAY has already been sent'); -// assert constants are present +// Assert constants are present assert(binding.constants); assert.strictEqual(typeof binding.constants, 'object'); const constants = binding.constants; diff --git a/test/parallel/test-http2-client-destroy.js b/test/parallel/test-http2-client-destroy.js index e7ea37e1528ef6..fe2c9591c7017d 100644 --- a/test/parallel/test-http2-client-destroy.js +++ b/test/parallel/test-http2-client-destroy.js @@ -100,7 +100,7 @@ const Countdown = require('../common/countdown'); })); } -// test destroy before goaway +// Test destroy before goaway { const server = h2.createServer(); server.on('stream', common.mustCall((stream) => { @@ -120,7 +120,7 @@ const Countdown = require('../common/countdown'); })); } -// test destroy before connect +// Test destroy before connect { const server = h2.createServer(); server.on('stream', common.mustNotCall()); @@ -138,7 +138,7 @@ const Countdown = require('../common/countdown'); })); } -// test close before connect +// Test close before connect { const server = h2.createServer(); @@ -151,7 +151,7 @@ const Countdown = require('../common/countdown'); })); const req = client.request(); - // should throw goaway error + // Should throw goaway error req.on('error', common.expectsError({ code: 'ERR_HTTP2_GOAWAY_SESSION', type: Error, diff --git a/test/parallel/test-http2-client-socket-destroy.js b/test/parallel/test-http2-client-socket-destroy.js index a91c6da28d1813..2cc6ef1e4ea4a8 100644 --- a/test/parallel/test-http2-client-socket-destroy.js +++ b/test/parallel/test-http2-client-socket-destroy.js @@ -19,7 +19,7 @@ server.on('stream', common.mustCall((stream) => { stream.on('close', common.mustCall()); stream.respond(); stream.write(body); - // purposefully do not end() + // Purposefully do not end() })); server.listen(0, common.mustCall(function() { @@ -27,7 +27,7 @@ server.listen(0, common.mustCall(function() { const req = client.request(); req.on('response', common.mustCall(() => { - // send a premature socket close + // Send a premature socket close client[kSocket].destroy(); })); diff --git a/test/parallel/test-http2-compat-serverresponse-end.js b/test/parallel/test-http2-compat-serverresponse-end.js index e7972c2fe01a9f..e0a49ca23a45f1 100644 --- a/test/parallel/test-http2-compat-serverresponse-end.js +++ b/test/parallel/test-http2-compat-serverresponse-end.js @@ -166,7 +166,7 @@ const { const request = client.request(headers); request.on('response', mustCall((headers, flags) => { strictEqual(headers[HTTP2_HEADER_STATUS], HTTP_STATUS_OK); - strictEqual(flags, 5); // the end of stream flag is set + strictEqual(flags, 5); // The end of stream flag is set strictEqual(headers.foo, 'bar'); })); request.on('data', mustNotCall()); @@ -231,7 +231,7 @@ const { const request = client.request(headers); request.on('response', mustCall((headers, flags) => { strictEqual(headers[HTTP2_HEADER_STATUS], HTTP_STATUS_OK); - strictEqual(flags, 5); // the end of stream flag is set + strictEqual(flags, 5); // The end of stream flag is set strictEqual(headers.foo, 'bar'); })); request.on('data', mustNotCall()); @@ -266,7 +266,7 @@ const { const request = client.request(headers); request.on('response', mustCall((headers, flags) => { strictEqual(headers[HTTP2_HEADER_STATUS], HTTP_STATUS_OK); - strictEqual(flags, 5); // the end of stream flag is set + strictEqual(flags, 5); // The end of stream flag is set strictEqual(headers.foo, 'bar'); })); request.on('data', mustNotCall()); @@ -306,7 +306,7 @@ const { const request = client.request(headers); request.on('response', mustCall((headers, flags) => { strictEqual(headers[HTTP2_HEADER_STATUS], HTTP_STATUS_OK); - strictEqual(flags, 5); // the end of stream flag is set + strictEqual(flags, 5); // The end of stream flag is set strictEqual(headers.foo, 'bar'); })); request.on('data', mustNotCall()); @@ -339,7 +339,7 @@ const { const request = client.request(headers); request.on('response', mustCall((headers, flags) => { strictEqual(headers[HTTP2_HEADER_STATUS], HTTP_STATUS_OK); - strictEqual(flags, 5); // the end of stream flag is set + strictEqual(flags, 5); // The end of stream flag is set })); request.on('data', mustNotCall()); request.on('end', mustCall(() => { diff --git a/test/parallel/test-http2-compat-serverresponse-flushheaders.js b/test/parallel/test-http2-compat-serverresponse-flushheaders.js index d155b07863d26c..6927b3754b1eb3 100644 --- a/test/parallel/test-http2-compat-serverresponse-flushheaders.js +++ b/test/parallel/test-http2-compat-serverresponse-flushheaders.js @@ -15,7 +15,7 @@ server.listen(0, common.mustCall(function() { const port = server.address().port; server.once('request', common.mustCall(function(request, response) { assert.strictEqual(response.headersSent, false); - assert.strictEqual(response._header, false); // alias for headersSent + assert.strictEqual(response._header, false); // Alias for headersSent response.flushHeaders(); assert.strictEqual(response.headersSent, true); assert.strictEqual(response._header, true); diff --git a/test/parallel/test-http2-compat-write-head-destroyed.js b/test/parallel/test-http2-compat-write-head-destroyed.js index 4576119ee7d435..842bf0e9abffb0 100644 --- a/test/parallel/test-http2-compat-write-head-destroyed.js +++ b/test/parallel/test-http2-compat-write-head-destroyed.js @@ -8,7 +8,7 @@ const http2 = require('http2'); // Check that writeHead, write and end do not crash in compatibility mode const server = http2.createServer(common.mustCall((req, res) => { - // destroy the stream first + // Destroy the stream first req.stream.destroy(); res.writeHead(200); diff --git a/test/parallel/test-http2-connect.js b/test/parallel/test-http2-connect.js index bef4ff79604ada..a2f30f974e9329 100644 --- a/test/parallel/test-http2-connect.js +++ b/test/parallel/test-http2-connect.js @@ -55,7 +55,7 @@ const { connect: netConnect } = require('net'); })); } -// check for https as protocol +// Check for https as protocol { const authority = 'https://localhost'; // A socket error may or may not be reported, keep this as a non-op diff --git a/test/parallel/test-http2-head-request.js b/test/parallel/test-http2-head-request.js index a56abf3c9006f3..c8103e7190c3fa 100644 --- a/test/parallel/test-http2-head-request.js +++ b/test/parallel/test-http2-head-request.js @@ -49,7 +49,7 @@ server.listen(0, () => { req.on('response', common.mustCall((headers, flags) => { assert.strictEqual(headers[HTTP2_HEADER_STATUS], 200); - assert.strictEqual(flags, 5); // the end of stream flag is set + assert.strictEqual(flags, 5); // The end of stream flag is set })); req.on('data', common.mustNotCall()); req.on('end', common.mustCall(() => { diff --git a/test/parallel/test-http2-session-settings.js b/test/parallel/test-http2-session-settings.js index 6061808082519d..46ba1753e2da41 100644 --- a/test/parallel/test-http2-session-settings.js +++ b/test/parallel/test-http2-session-settings.js @@ -101,7 +101,7 @@ server.listen( ); }); - // error checks for enablePush + // Error checks for enablePush [1, {}, 'test', [], null, Infinity, NaN].forEach((i) => { common.expectsError( () => client.settings({ enablePush: i }), diff --git a/test/parallel/test-http2-session-unref.js b/test/parallel/test-http2-session-unref.js index 0381971c0eace5..dcfbccf215aec8 100644 --- a/test/parallel/test-http2-session-unref.js +++ b/test/parallel/test-http2-session-unref.js @@ -35,7 +35,7 @@ server.listen(0, common.mustCall(() => { client.unref(); } - // unref destroyed client + // Unref destroyed client { const client = http2.connect(`http://localhost:${port}`); @@ -45,7 +45,7 @@ server.listen(0, common.mustCall(() => { })); } - // unref destroyed client + // Unref destroyed client { const client = http2.connect(`http://localhost:${port}`, { createConnection: common.mustCall(() => clientSide) diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js index c0b50cef01abe4..1bb3da5f1e1501 100644 --- a/test/parallel/test-https-agent-create-connection.js +++ b/test/parallel/test-https-agent-create-connection.js @@ -59,7 +59,7 @@ function createServer() { })); } -// use port and option connect +// Use port and option connect { const server = createServer(); server.listen(0, common.mustCall(() => { @@ -103,7 +103,7 @@ function createServer() { })); } -// options is null +// `options` is null { const server = createServer(); server.listen(0, common.mustCall(() => { @@ -118,7 +118,7 @@ function createServer() { })); } -// options is undefined +// `options` is undefined { const server = createServer(); server.listen(0, common.mustCall(() => { diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index 5c95da549b20b5..dabb08f074af9a 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -15,7 +15,7 @@ assert.strictEqual( 'localhost:::::::::::::::::::' ); -// pass all options arguments +// Pass all options arguments const options = { host: '0.0.0.0', port: 443, diff --git a/test/parallel/test-https-argument-of-creating.js b/test/parallel/test-https-argument-of-creating.js index c46dd204c51922..6f1564826eaf74 100644 --- a/test/parallel/test-https-argument-of-creating.js +++ b/test/parallel/test-https-argument-of-creating.js @@ -10,7 +10,7 @@ const tls = require('tls'); const dftProtocol = {}; -// test for immutable `opts` +// Test for immutable `opts` { const opts = { foo: 'bar', ALPNProtocols: [ 'http/1.1' ] }; const server = https.createServer(opts); diff --git a/test/parallel/test-https-client-override-global-agent.js b/test/parallel/test-https-client-override-global-agent.js index 0aaab0d7b3ef96..a4bb2732756b2b 100644 --- a/test/parallel/test-https-client-override-global-agent.js +++ b/test/parallel/test-https-client-override-global-agent.js @@ -25,7 +25,7 @@ server.listen(0, common.mustCall(() => { https.globalAgent = agent; makeRequest(); - assert(agent.sockets.hasOwnProperty(name)); // agent has indeed been used + assert(agent.sockets.hasOwnProperty(name)); // Agent has indeed been used })); function makeRequest() { diff --git a/test/parallel/test-https-client-renegotiation-limit.js b/test/parallel/test-https-client-renegotiation-limit.js index 3527c48f4b9580..4d3dda3d759e38 100644 --- a/test/parallel/test-https-client-renegotiation-limit.js +++ b/test/parallel/test-https-client-renegotiation-limit.js @@ -35,7 +35,7 @@ const fixtures = require('../common/fixtures'); // Renegotiation as a protocol feature was dropped after TLS1.2. tls.DEFAULT_MAX_VERSION = 'TLSv1.2'; -// renegotiation limits to test +// Renegotiation limits to test const LIMITS = [0, 1, 2, 3, 5, 10, 16]; { @@ -96,7 +96,7 @@ function test(next) { spam(); - // simulate renegotiation attack + // Simulate renegotiation attack function spam() { client.renegotiate({}, (err) => { assert.ifError(err); diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index f849ae800fc016..a72168289d54bb 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -161,7 +161,7 @@ function makeReq(path, port, error, host, ca) { } function allListening() { - // ok, ready to start the tests! + // Ok, ready to start the tests! const port1 = server1.address().port; const port2 = server2.address().port; const port3 = server3.address().port; diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js index e034adc39d2899..9ba621e436859e 100644 --- a/test/parallel/test-https-timeout.js +++ b/test/parallel/test-https-timeout.js @@ -33,7 +33,7 @@ const options = { cert: fixtures.readKey('agent1-cert.pem') }; -// a server that never replies +// A server that never replies const server = https.createServer(options, function() { console.log('Got request. Doing nothing.'); }).listen(0, common.mustCall(function() { diff --git a/test/parallel/test-icu-punycode.js b/test/parallel/test-icu-punycode.js index 35dab6232f34bc..7e8dcf37595123 100644 --- a/test/parallel/test-icu-punycode.js +++ b/test/parallel/test-icu-punycode.js @@ -9,7 +9,7 @@ const { internalBinding } = require('internal/test/binding'); const icu = internalBinding('icu'); const assert = require('assert'); -// test hasConverter method +// Test hasConverter method assert(icu.hasConverter('utf-8'), 'hasConverter should report coverter exists for utf-8'); assert(!icu.hasConverter('x'), diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index 255bf066aa0ff8..7e248bea1dd2a9 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -115,14 +115,14 @@ if (!common.hasIntl) { const collOpts = { sensitivity: 'base', ignorePunctuation: true }; const coll = new Intl.Collator(['en'], collOpts); - // ignore punctuation + // Ignore punctuation assert.strictEqual(coll.compare('blackbird', 'black-bird'), 0); - // compare less + // Compare less assert.strictEqual(coll.compare('blackbird', 'red-bird'), -1); - // compare greater + // Compare greater assert.strictEqual(coll.compare('bluebird', 'blackbird'), 1); - // ignore case + // Ignore case assert.strictEqual(coll.compare('Bluebird', 'bluebird'), 0); - // ffi ligature (contraction) + // `ffi` ligature (contraction) assert.strictEqual(coll.compare('\ufb03', 'ffi'), 0); } diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 416adb39357ae1..45bb03ce588ae0 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -136,7 +136,7 @@ function master() { function worker() { console.error('worker, about to create server and listen on fd=3'); - // start a server on fd=3 + // Start a server on fd=3 http.createServer(function(req, res) { console.error('request on worker'); console.error('%s %s', req.method, req.url, req.headers); diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index 9f672a9a557485..81c07d1263e964 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -105,7 +105,7 @@ function parent() { // Run as a child of the parent() mode. function child() { - // start a server on fd=3 + // Start a server on fd=3 http.createServer(function(req, res) { console.error('request on child'); console.error('%s %s', req.method, req.url, req.headers); diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index d2fa7707193168..efa08323047358 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -102,7 +102,7 @@ function parent() { } function child() { - // start a server on fd=3 + // Start a server on fd=3 http.createServer(function(req, res) { console.error('request on child'); console.error('%s %s', req.method, req.url, req.headers); diff --git a/test/parallel/test-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index a09a01f219daf1..3b6a0a0fac7abd 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -74,7 +74,7 @@ function child() { process.exit(0); }); - // start a server on fd=3 + // Start a server on fd=3 http.createServer(function(req, res) { console.error('request on child'); console.error('%s %s', req.method, req.url, req.headers); diff --git a/test/parallel/test-microtask-queue-run-immediate.js b/test/parallel/test-microtask-queue-run-immediate.js index 2d4e21f83aa6ef..577391993bcc65 100644 --- a/test/parallel/test-microtask-queue-run-immediate.js +++ b/test/parallel/test-microtask-queue-run-immediate.js @@ -33,7 +33,7 @@ process.on('exit', function() { assert.strictEqual(done, 2); }); -// no nextTick, microtask +// No nextTick, microtask setImmediate(function() { enqueueMicrotask(function() { done++; diff --git a/test/parallel/test-microtask-queue-run.js b/test/parallel/test-microtask-queue-run.js index 7a1667819f6758..5281cb4f3c2ed2 100644 --- a/test/parallel/test-microtask-queue-run.js +++ b/test/parallel/test-microtask-queue-run.js @@ -33,7 +33,7 @@ process.on('exit', function() { assert.strictEqual(done, 2); }); -// no nextTick, microtask +// No nextTick, microtask setTimeout(function() { enqueueMicrotask(function() { done++; diff --git a/test/parallel/test-net-can-reset-timeout.js b/test/parallel/test-net-can-reset-timeout.js index 69f6c9288b77f7..2fac07eab05e23 100644 --- a/test/parallel/test-net-can-reset-timeout.js +++ b/test/parallel/test-net-can-reset-timeout.js @@ -33,7 +33,7 @@ const server = net.createServer(common.mustCall(function(stream) { stream.once('timeout', common.mustCall(function() { console.log('timeout'); - // try to reset the timeout. + // Try to reset the timeout. stream.write('WHAT.'); })); diff --git a/test/parallel/test-net-connect-memleak.js b/test/parallel/test-net-connect-memleak.js index 4efceee0eae138..2f06e56e1f631e 100644 --- a/test/parallel/test-net-connect-memleak.js +++ b/test/parallel/test-net-connect-memleak.js @@ -42,7 +42,7 @@ const gcListener = { ongc() { collected = true; } }; const sock = net.createConnection( server.address().port, common.mustCall(() => { - assert.strictEqual(gcObject, gcObject); // keep reference alive + assert.strictEqual(gcObject, gcObject); // Keep reference alive assert.strictEqual(collected, false); setImmediate(done, sock); })); diff --git a/test/parallel/test-net-pingpong.js b/test/parallel/test-net-pingpong.js index 4ab36fc23957b5..99a02eda22fb1d 100644 --- a/test/parallel/test-net-pingpong.js +++ b/test/parallel/test-net-pingpong.js @@ -67,7 +67,7 @@ function pingPongTest(port, host) { socket.on('end', common.mustCall(function() { assert.strictEqual(socket.allowHalfOpen, true); - assert.strictEqual(socket.writable, true); // because allowHalfOpen + assert.strictEqual(socket.writable, true); // Because allowHalfOpen assert.strictEqual(socket.readable, false); socket.end(); })); diff --git a/test/parallel/test-net-server-listen-handle.js b/test/parallel/test-net-server-listen-handle.js index 0d59bd76cad8a8..58f9d2ae3775b7 100644 --- a/test/parallel/test-net-server-listen-handle.js +++ b/test/parallel/test-net-server-listen-handle.js @@ -53,7 +53,7 @@ function randomHandle(type) { assert.fail(`unable to bind ${handleName}: ${getSystemErrorName(errno)}`); } - if (!common.isWindows) { // fd doesn't work on windows + if (!common.isWindows) { // `fd` doesn't work on Windows. // err >= 0 but fd = -1, should not happen assert.notStrictEqual(handle.fd, -1, `Bound ${handleName} has fd -1 and errno ${errno}`); @@ -82,7 +82,7 @@ function randomPipes(number) { // Not a public API, used by child_process if (!common.isWindows) { // Windows doesn't support {fd: } - const handles = randomPipes(2); // generate pipes in advance + const handles = randomPipes(2); // Generate pipes in advance // Test listen(pipe) net.createServer() .listen(handles[0]) @@ -120,7 +120,7 @@ if (!common.isWindows) { // Windows doesn't support {fd: } } if (!common.isWindows) { // Windows doesn't support {fd: } - const handles = randomPipes(6); // generate pipes in advance + const handles = randomPipes(6); // Generate pipes in advance // Test listen({handle: pipe}, cb) net.createServer() .listen({ handle: handles[0] }, closePipeServer(handles[0])); diff --git a/test/parallel/test-net-server-unref-persistent.js b/test/parallel/test-net-server-unref-persistent.js index 9b9460635df3ca..b772782100f3b9 100644 --- a/test/parallel/test-net-server-unref-persistent.js +++ b/test/parallel/test-net-server-unref-persistent.js @@ -3,7 +3,7 @@ const common = require('../common'); const net = require('net'); const server = net.createServer(); -// unref before listening +// Unref before listening server.unref(); server.listen(); diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index dda2d5acadb751..58645322f45100 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -1,6 +1,6 @@ 'use strict'; const common = require('../common'); -// skip test in FreeBSD jails +// Skip test in FreeBSD jails if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); diff --git a/test/parallel/test-path-relative.js b/test/parallel/test-path-relative.js index 5d5d118cc6f45c..599381cdccfcb9 100644 --- a/test/parallel/test-path-relative.js +++ b/test/parallel/test-path-relative.js @@ -35,7 +35,7 @@ const relativeTests = [ ] ], [ path.posix.relative, - // arguments result + // Arguments result [['/var/lib', '/var', '..'], ['/var/lib', '/bin', '../../bin'], ['/var/lib', '/var/lib', ''], diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 698fa4cf6268ea..6d0af8bd3ef91a 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -23,7 +23,7 @@ const common = require('../common'); const assert = require('assert'); -// test variants of pid +// Test variants of pid // // null: TypeError // undefined: TypeError diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js index 090525e18c5d3e..ba5ae74f0ff720 100644 --- a/test/parallel/test-process-raw-debug.js +++ b/test/parallel/test-process-raw-debug.js @@ -58,7 +58,7 @@ function parent() { } function child() { - // even when all hope is lost... + // Even when all hope is lost... process.nextTick = function() { throw new Error('No ticking!'); diff --git a/test/parallel/test-promises-unhandled-proxy-rejections.js b/test/parallel/test-promises-unhandled-proxy-rejections.js index b3cf5719cb9ab0..659db4d17911ee 100644 --- a/test/parallel/test-promises-unhandled-proxy-rejections.js +++ b/test/parallel/test-promises-unhandled-proxy-rejections.js @@ -39,5 +39,5 @@ common.expectWarning({ UnhandledPromiseRejectionWarning: expectedPromiseWarning, }); -// ensure this doesn't crash +// Ensure this doesn't crash Promise.reject(thorny); diff --git a/test/parallel/test-promises-unhandled-symbol-rejections.js b/test/parallel/test-promises-unhandled-symbol-rejections.js index d777a13e62e984..460acaca57c6d4 100644 --- a/test/parallel/test-promises-unhandled-symbol-rejections.js +++ b/test/parallel/test-promises-unhandled-symbol-rejections.js @@ -23,5 +23,5 @@ common.expectWarning({ ], }); -// ensure this doesn't crash +// Ensure this doesn't crash Promise.reject(Symbol()); diff --git a/test/parallel/test-querystring-escape.js b/test/parallel/test-querystring-escape.js index 25a800a09a684c..fedc09812400fd 100644 --- a/test/parallel/test-querystring-escape.js +++ b/test/parallel/test-querystring-escape.js @@ -22,7 +22,7 @@ common.expectsError( } ); -// using toString for objects +// Using toString for objects assert.strictEqual( qs.escape({ test: 5, toString: () => 'test', valueOf: () => 10 }), 'test' diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index b26f41a4663c8b..de1768103d94cd 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -223,7 +223,7 @@ qsNoMungeTestCases.forEach((testCase) => { assert.deepStrictEqual(qs.stringify(testCase[1], '&', '='), testCase[0]); }); -// test the nested qs-in-qs case +// Test the nested qs-in-qs case { const f = qs.parse('a=b&q=x%3Dy%26y%3Dz'); check(f, createWithNoPrototype([ @@ -254,7 +254,7 @@ qsNoMungeTestCases.forEach((testCase) => { check(f.q, expectedInternal); } -// now test stringifying +// Now test stringifying // basic qsTestCases.forEach((testCase) => { @@ -279,7 +279,7 @@ common.expectsError( } ); -// coerce numbers to string +// Coerce numbers to string assert.strictEqual(qs.stringify({ foo: 0 }), 'foo=0'); assert.strictEqual(qs.stringify({ foo: -0 }), 'foo=0'); assert.strictEqual(qs.stringify({ foo: 3 }), 'foo=3'); @@ -434,7 +434,7 @@ qsUnescapeTestCases.forEach((testCase) => { assert.strictEqual(qs.unescapeBuffer(testCase[0]).toString(), testCase[1]); }); -// test overriding .unescape +// Test overriding .unescape { const prevUnescape = qs.unescape; qs.unescape = (str) => { diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index fba215e225b03d..5096198a71d9eb 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -73,7 +73,7 @@ function isWarned(emitter) { } { - // set crlfDelay to 5000ms + // Set crlfDelay to 5000ms const fi = new FakeInput(); const rli = new readline.Interface({ input: fi, @@ -98,7 +98,7 @@ function isWarned(emitter) { rli.close(); } - // default history size 30 + // Default history size 30 { const fi = new FakeInput(); const rli = new readline.Interface( @@ -126,7 +126,7 @@ function isWarned(emitter) { assert.ok(called); } - // sending a blank line + // Sending a blank line { const fi = new FakeInput(); const rli = new readline.Interface( @@ -531,7 +531,7 @@ function isWarned(emitter) { rli.close(); } - // calling the question callback + // Calling the question callback { let called = false; const fi = new FakeInput(); @@ -576,7 +576,7 @@ function isWarned(emitter) { rli.close(); } - // sending a multi-line question + // Sending a multi-line question { const fi = new FakeInput(); const rli = new readline.Interface( diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index f61c64043fecc1..0f5ca4d71443fd 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -82,7 +82,7 @@ const addKeyIntervalTest = (sequences, expectedKeys, interval = 550, return fn; }; -// regular alphanumerics +// Regular alphanumerics addTest('io.JS', [ { name: 'i', sequence: 'i' }, { name: 'o', sequence: 'o' }, @@ -91,14 +91,14 @@ addTest('io.JS', [ { name: 's', sequence: 'S', shift: true }, ]); -// named characters +// Named characters addTest('\n\r\t', [ { name: 'enter', sequence: '\n' }, { name: 'return', sequence: '\r' }, { name: 'tab', sequence: '\t' }, ]); -// space and backspace +// Space and backspace addTest('\b\x7f\x1b\b\x1b\x7f\x1b\x1b \x1b ', [ { name: 'backspace', sequence: '\b' }, { name: 'backspace', sequence: '\x7f' }, @@ -109,19 +109,19 @@ addTest('\b\x7f\x1b\b\x1b\x7f\x1b\x1b \x1b ', [ { name: 'space', sequence: '\x1b ', meta: true }, ]); -// escape key +// Escape key addTest('\x1b\x1b\x1b', [ { name: 'escape', sequence: '\x1b\x1b\x1b', meta: true }, ]); -// control keys +// Control keys addTest('\x01\x0b\x10', [ { name: 'a', sequence: '\x01', ctrl: true }, { name: 'k', sequence: '\x0b', ctrl: true }, { name: 'p', sequence: '\x10', ctrl: true }, ]); -// alt keys +// Alt keys addTest('a\x1baA\x1bA', [ { name: 'a', sequence: 'a' }, { name: 'a', sequence: '\x1ba', meta: true }, @@ -145,7 +145,7 @@ addTest('\x1b[11~\x1b[12~\x1b[13~\x1b[14~', [ { name: 'f4', sequence: '\x1b[14~', code: '[14~' }, ]); -// from Cygwin and used in libuv +// From Cygwin and used in libuv addTest('\x1b[[A\x1b[[B\x1b[[C\x1b[[D\x1b[[E', [ { name: 'f1', sequence: '\x1b[[A', code: '[[A' }, { name: 'f2', sequence: '\x1b[[B', code: '[[B' }, @@ -154,7 +154,7 @@ addTest('\x1b[[A\x1b[[B\x1b[[C\x1b[[D\x1b[[E', [ { name: 'f5', sequence: '\x1b[[E', code: '[[E' }, ]); -// common +// Common addTest('\x1b[15~\x1b[17~\x1b[18~\x1b[19~\x1b[20~\x1b[21~\x1b[23~\x1b[24~', [ { name: 'f5', sequence: '\x1b[15~', code: '[15~' }, { name: 'f6', sequence: '\x1b[17~', code: '[17~' }, @@ -188,7 +188,7 @@ addTest('\x1bOA\x1bOB\x1bOC\x1bOD\x1bOE\x1bOF\x1bOH', [ { name: 'home', sequence: '\x1bOH', code: 'OH' }, ]); -// old xterm shift-arrows +// Old xterm shift-arrows addTest('\x1bO2A\x1bO2B', [ { name: 'up', sequence: '\x1bO2A', code: 'OA', shift: true }, { name: 'down', sequence: '\x1bO2B', code: 'OB', shift: true }, @@ -224,7 +224,7 @@ addTest('\x1b[A\x1b[B\x1b[2A\x1b[2B', [ { name: 'down', sequence: '\x1b[2B', code: '[B', shift: true }, ]); -// rxvt keys with modifiers +// `rxvt` keys with modifiers. // eslint-disable-next-line max-len addTest('\x1b[20~\x1b[2$\x1b[2^\x1b[3$\x1b[3^\x1b[5$\x1b[5^\x1b[6$\x1b[6^\x1b[7$\x1b[7^\x1b[8$\x1b[8^', [ { name: 'f9', sequence: '\x1b[20~', code: '[20~' }, @@ -242,7 +242,7 @@ addTest('\x1b[20~\x1b[2$\x1b[2^\x1b[3$\x1b[3^\x1b[5$\x1b[5^\x1b[6$\x1b[6^\x1b[7$ { name: 'end', sequence: '\x1b[8^', code: '[8^', ctrl: true }, ]); -// misc +// Misc addTest('\x1b[Z', [ { name: 'tab', sequence: '\x1b[Z', code: '[Z', shift: true }, ]); @@ -277,7 +277,7 @@ addTest('\x1b[DD\x1b[2DD\x1b[2^D', [ { name: 'd', sequence: 'D', shift: true }, ]); -// color sequences +// Color sequences addTest('\x1b[31ma\x1b[39ma', [ { name: 'undefined', sequence: '\x1b[31m', code: '[31m' }, { name: 'a', sequence: 'a' }, @@ -285,7 +285,7 @@ addTest('\x1b[31ma\x1b[39ma', [ { name: 'a', sequence: 'a' }, ]); -// rxvt keys with modifiers +// `rxvt` keys with modifiers. addTest('\x1b[a\x1b[b\x1b[c\x1b[d\x1b[e', [ { name: 'up', sequence: '\x1b[a', code: '[a', shift: true }, { name: 'down', sequence: '\x1b[b', code: '[b', shift: true }, @@ -303,13 +303,13 @@ addTest('\x1bOa\x1bOb\x1bOc\x1bOd\x1bOe', [ ]); // Reduce array of addKeyIntervalTest(..) right to left -// with () => {} as initial function +// with () => {} as initial function. const runKeyIntervalTests = [ - // escape character + // Escape character addKeyIntervalTest('\x1b', [ { name: 'escape', sequence: '\x1b', meta: true } ]), - // chain of escape characters + // Chain of escape characters. addKeyIntervalTest('\x1b\x1b\x1b\x1b'.split(''), [ { name: 'escape', sequence: '\x1b', meta: true }, { name: 'escape', sequence: '\x1b', meta: 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-repl-autolibs.js b/test/parallel/test-repl-autolibs.js index 976cad84361d03..5cf3b1497221d0 100644 --- a/test/parallel/test-repl-autolibs.js +++ b/test/parallel/test-repl-autolibs.js @@ -55,7 +55,7 @@ function test2() { putIn.write = function(data) { gotWrite = true; if (data.length) { - // repl response error message + // REPL response error message assert.strictEqual(data, '{}\n'); // Original value wasn't overwritten assert.strictEqual(val, global.url); diff --git a/test/parallel/test-repl-context.js b/test/parallel/test-repl-context.js index 001e2ffd4e1ede..287d8adc295d7a 100644 --- a/test/parallel/test-repl-context.js +++ b/test/parallel/test-repl-context.js @@ -58,7 +58,7 @@ const stream = new ArrayStream(); assert.strictEqual(server.lines[0], '_ = 500;'); assert.strictEqual(server.last, 500); - // reset the server context + // Reset the server context server.resetContext(); assert.ok(!server.underscoreAssigned); assert.strictEqual(server.lines.length, 0); diff --git a/test/parallel/test-repl-end-emits-exit.js b/test/parallel/test-repl-end-emits-exit.js index 8de0a006dfc49b..4e1f3d84f5e056 100644 --- a/test/parallel/test-repl-end-emits-exit.js +++ b/test/parallel/test-repl-end-emits-exit.js @@ -38,7 +38,7 @@ function testTerminalMode() { }); process.nextTick(function() { - // manually fire a ^D keypress + // Manually fire a ^D keypress stream.emit('data', '\u0004'); }); diff --git a/test/parallel/test-repl-options.js b/test/parallel/test-repl-options.js index f6f6273f374034..cbb5a9a6e580ec 100644 --- a/test/parallel/test-repl-options.js +++ b/test/parallel/test-repl-options.js @@ -52,7 +52,7 @@ assert.strictEqual(r1.ignoreUndefined, false); assert.strictEqual(r1.replMode, repl.REPL_MODE_SLOPPY); assert.strictEqual(r1.historySize, 30); -// test r1 for backwards compact +// Test r1 for backwards compact assert.strictEqual(r1.rli.input, stream); assert.strictEqual(r1.rli.output, stream); assert.strictEqual(r1.rli.input, r1.inputStream); @@ -87,7 +87,7 @@ assert.strictEqual(r2.writer, writer); assert.strictEqual(r2.replMode, repl.REPL_MODE_STRICT); assert.strictEqual(r2.historySize, 50); -// test r2 for backwards compact +// Test r2 for backwards compact assert.strictEqual(r2.rli.input, stream); assert.strictEqual(r2.rli.output, stream); assert.strictEqual(r2.rli.input, r2.inputStream); diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js index 74841d86ff6ec0..d36a2b74d4373a 100644 --- a/test/parallel/test-repl-save-load.js +++ b/test/parallel/test-repl-save-load.js @@ -99,7 +99,7 @@ let loadFile = join(tmpdir.path, 'file.does.not.exist'); putIn.write = function(data) { // Make sure I get a failed to load message and not some crazy error assert.strictEqual(data, `Failed to load:${loadFile}\n`); - // eat me to avoid work + // Eat me to avoid work putIn.write = () => {}; }; putIn.run([`.load ${loadFile}`]); diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 558b6cab47e2ae..02cd06c9534bc5 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -528,7 +528,7 @@ testCustomCompleterAsyncMode.complete('a', common.mustCall((error, data) => { ]); })); -// tab completion in editor mode +// Tab completion in editor mode const editorStream = new ArrayStream(); const editor = repl.start({ stream: editorStream, diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 1426330e20ad85..ad674cb3ab00f4 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -35,7 +35,7 @@ const prompt_tcp = 'node via TCP socket> '; // Absolute path to test/fixtures/a.js const moduleFilename = fixtures.path('a'); -// function for REPL to run +// Function for REPL to run global.invoke_me = function(arg) { return `invoked ${arg}`; }; @@ -358,7 +358,7 @@ const errorTests = [ send: ')', expect: 'undefined' }, - // npm prompt error message + // `npm` prompt error message. { send: 'npm install foobar', expect: [ @@ -676,7 +676,7 @@ const errorTests = [ /^SyntaxError: / ] }, - // bring back the repl to prompt + // Bring back the repl to prompt { send: '.break', expect: '' diff --git a/test/parallel/test-require-extension-over-directory.js b/test/parallel/test-require-extension-over-directory.js index cc896d7b61b090..92258761513919 100644 --- a/test/parallel/test-require-extension-over-directory.js +++ b/test/parallel/test-require-extension-over-directory.js @@ -1,5 +1,5 @@ 'use strict'; -// fixes regression from v4 +// Fixes regression from v4 require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index c73fdcd41e6efa..5c9b0fbdef3595 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -63,12 +63,12 @@ function test() { fs.symlinkSync(linkTarget, linkDir, 'dir'); fs.symlinkSync(linkScriptTarget, linkScript); - // load symlinked-module + // Load symlinked-module const fooModule = require(path.join(tmpDirTarget, 'foo.js')); assert.strictEqual(fooModule.dep1.bar.version, 'CORRECT_VERSION'); assert.strictEqual(fooModule.dep2.bar.version, 'CORRECT_VERSION'); - // load symlinked-script as main + // Load symlinked-script as main const node = process.execPath; const child = spawn(node, ['--preserve-symlinks', linkScript]); child.on('close', function(code, signal) { diff --git a/test/parallel/test-stream-big-push.js b/test/parallel/test-stream-big-push.js index 5eabd4837e6b7c..f9e75edd3f89d1 100644 --- a/test/parallel/test-stream-big-push.js +++ b/test/parallel/test-stream-big-push.js @@ -51,10 +51,10 @@ r._read = common.mustCall(_read, 3); r.on('end', common.mustCall()); -// push some data in to start. -// we've never gotten any read event at this point. +// Push some data in to start. +// We've never gotten any read event at this point. const ret = r.push(str); -// should be false. > hwm +// Should be false. > hwm assert(!ret); let chunk = r.read(); assert.strictEqual(chunk, str); diff --git a/test/parallel/test-stream-finished.js b/test/parallel/test-stream-finished.js index e06017920c8a30..329b4ed42b0c43 100644 --- a/test/parallel/test-stream-finished.js +++ b/test/parallel/test-stream-finished.js @@ -104,7 +104,7 @@ const { promisify } = require('util'); })); rs.push(null); - rs.emit('close'); // should not trigger an error + rs.emit('close'); // Should not trigger an error rs.resume(); } @@ -115,7 +115,7 @@ const { promisify } = require('util'); assert(err, 'premature close error'); })); - rs.emit('close'); // should trigger error + rs.emit('close'); // Should trigger error rs.push(null); rs.resume(); } diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js index 9f56467e203dd5..05e7dd464ddca0 100644 --- a/test/parallel/test-stream-readable-destroy.js +++ b/test/parallel/test-stream-readable-destroy.js @@ -166,7 +166,7 @@ const assert = require('assert'); } { - // destroy and destroy callback + // Destroy and destroy callback const read = new Readable({ read() {} }); diff --git a/test/parallel/test-stream-readable-event.js b/test/parallel/test-stream-readable-event.js index e248bed4b5b3e3..4f2383508aa61c 100644 --- a/test/parallel/test-stream-readable-event.js +++ b/test/parallel/test-stream-readable-event.js @@ -118,7 +118,7 @@ const Readable = require('stream').Readable; // #20923 const r = new Readable(); r._read = function() { - // actually doing thing here + // Actually doing thing here }; r.on('data', function() {}); diff --git a/test/parallel/test-stream-readable-pause-and-resume.js b/test/parallel/test-stream-readable-pause-and-resume.js index 505327e247da38..3169023d90acaf 100644 --- a/test/parallel/test-stream-readable-pause-and-resume.js +++ b/test/parallel/test-stream-readable-pause-and-resume.js @@ -34,7 +34,7 @@ function readAndPause() { readAndPause(); rs.resume(); }); - }, 1); // only call ondata once + }, 1); // Only call ondata once rs.on('data', ondata); } diff --git a/test/parallel/test-stream-readable-reading-readingMore.js b/test/parallel/test-stream-readable-reading-readingMore.js index e57a808286619d..f616b460488e75 100644 --- a/test/parallel/test-stream-readable-reading-readingMore.js +++ b/test/parallel/test-stream-readable-reading-readingMore.js @@ -40,10 +40,10 @@ const Readable = require('stream').Readable; // If the stream has ended, we shouldn't be reading assert.strictEqual(state.ended, !state.reading); - // consume all the data + // Consume all the data while (readable.read() !== null) {} - if (expectedReadingMore.length === 0) // reached end of stream + if (expectedReadingMore.length === 0) // Reached end of stream process.nextTick(common.mustCall(onStreamEnd, 1)); }, 3)); @@ -94,7 +94,7 @@ const Readable = require('stream').Readable; readable.on('end', common.mustCall(onStreamEnd)); readable.push('pushed'); - // stop emitting 'data' events + // Stop emitting 'data' events assert.strictEqual(state.flowing, true); readable.pause(); @@ -152,7 +152,7 @@ const Readable = require('stream').Readable; process.nextTick(function() { readable.resume(); - // stop emitting 'data' events + // Stop emitting 'data' events assert.strictEqual(state.flowing, true); readable.pause(); diff --git a/test/parallel/test-stream-transform-split-highwatermark.js b/test/parallel/test-stream-transform-split-highwatermark.js index 7837b009cd6a0e..bcc33d26a6f665 100644 --- a/test/parallel/test-stream-transform-split-highwatermark.js +++ b/test/parallel/test-stream-transform-split-highwatermark.js @@ -12,7 +12,7 @@ function testTransform(expectedReadableHwm, expectedWritableHwm, options) { assert.strictEqual(t._writableState.highWaterMark, expectedWritableHwm); } -// test overriding defaultHwm +// Test overriding defaultHwm testTransform(666, DEFAULT, { readableHighWaterMark: 666 }); testTransform(DEFAULT, 777, { writableHighWaterMark: 777 }); testTransform(666, 777, { @@ -24,7 +24,7 @@ testTransform(666, 777, { testTransform(0, DEFAULT, { readableHighWaterMark: 0 }); testTransform(DEFAULT, 0, { writableHighWaterMark: 0 }); -// test highWaterMark overriding +// Test highWaterMark overriding testTransform(555, 555, { highWaterMark: 555, readableHighWaterMark: 666, @@ -54,7 +54,7 @@ testTransform(0, 0, { writableHighWaterMark: 777, }); -// test undefined, null +// Test undefined, null [undefined, null].forEach((v) => { testTransform(DEFAULT, DEFAULT, { readableHighWaterMark: v }); testTransform(DEFAULT, DEFAULT, { writableHighWaterMark: v }); diff --git a/test/parallel/test-stream-unshift-read-race.js b/test/parallel/test-stream-unshift-read-race.js index 69f966e05f4f36..f7b633338cb810 100644 --- a/test/parallel/test-stream-unshift-read-race.js +++ b/test/parallel/test-stream-unshift-read-race.js @@ -46,7 +46,7 @@ let pushedNull = false; r._read = function(n) { assert(!pushedNull, '_read after null push'); - // every third chunk is fast + // Every third chunk is fast push(!(chunks % 3)); function push(fast) { diff --git a/test/parallel/test-stream-writable-destroy.js b/test/parallel/test-stream-writable-destroy.js index 56e17990794a79..a431d6d48d1c8e 100644 --- a/test/parallel/test-stream-writable-destroy.js +++ b/test/parallel/test-stream-writable-destroy.js @@ -205,7 +205,7 @@ const assert = require('assert'); } { - // destroy and destroy callback + // Destroy and destroy callback const write = new Writable({ write(chunk, enc, cb) { cb(); } }); diff --git a/test/parallel/test-stream-writableState-ending.js b/test/parallel/test-stream-writableState-ending.js index 69afd1af5343dc..d301d355cc1417 100644 --- a/test/parallel/test-stream-writableState-ending.js +++ b/test/parallel/test-stream-writableState-ending.js @@ -32,6 +32,6 @@ const result = writable.end('testing function end()', () => { // End returns the writable instance assert.strictEqual(result, writable); -// ending, ended = true. +// Ending, ended = true. // finished = false. testStates(true, false, true); diff --git a/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js b/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js index 0cf9179ac49847..b7375b9fa2bae0 100644 --- a/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js +++ b/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js @@ -24,11 +24,11 @@ assert.strictEqual(writable._writableState.bufferedRequestCount, 0); writable.cork(); assert.strictEqual(writable._writableState.corked, 2); -// the first chunk is buffered +// The first chunk is buffered writable.write('first chunk'); assert.strictEqual(writable._writableState.bufferedRequestCount, 1); -// first uncork does nothing +// First uncork does nothing writable.uncork(); assert.strictEqual(writable._writableState.corked, 1); assert.strictEqual(writable._writableState.bufferedRequestCount, 1); diff --git a/test/parallel/test-stream2-push.js b/test/parallel/test-stream2-push.js index 9d209c18b9f489..748a77b9c496ba 100644 --- a/test/parallel/test-stream2-push.js +++ b/test/parallel/test-stream2-push.js @@ -97,7 +97,7 @@ writer._write = function(chunk, encoding, cb) { writer.on('finish', finish); -// now emit some chunks. +// Now emit some chunks. const chunk = 'asdfg'; diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js index 0210a1848df03a..0ab7c059d66a85 100644 --- a/test/parallel/test-stream2-readable-from-list.js +++ b/test/parallel/test-stream2-readable-from-list.js @@ -64,7 +64,7 @@ function bufferListFromArray(arr) { ret = fromList(2, { buffer: list, length: 8 }); assert.strictEqual(ret.toString(), 'ba'); - // read more than we have. + // Read more than we have. ret = fromList(100, { buffer: list, length: 6 }); assert.strictEqual(ret.toString(), 'zykuel'); @@ -92,7 +92,7 @@ function bufferListFromArray(arr) { ret = fromList(2, { buffer: list, length: 8, decoder: true }); assert.strictEqual(ret, 'ba'); - // read more than we have. + // Read more than we have. ret = fromList(100, { buffer: list, length: 6, decoder: true }); assert.strictEqual(ret, 'zykuel'); diff --git a/test/parallel/test-stream2-readable-non-empty-end.js b/test/parallel/test-stream2-readable-non-empty-end.js index 3c0b5eb4085e2e..ba289fb91275e3 100644 --- a/test/parallel/test-stream2-readable-non-empty-end.js +++ b/test/parallel/test-stream2-readable-non-empty-end.js @@ -59,11 +59,11 @@ test.on('readable', function() { test.read(0); function next() { - // now let's make 'end' happen + // Now let's make 'end' happen test.removeListener('end', thrower); test.on('end', common.mustCall()); - // one to get the last byte + // One to get the last byte let r = test.read(); assert(r); assert.strictEqual(r.length, 1); diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index b27b4116f3c84e..fa24ce152d71ed 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -178,7 +178,7 @@ const Transform = require('_stream_transform'); // Verify asymmetric transform (expand) const pt = new Transform(); - // emit each chunk 2 times. + // Emit each chunk 2 times. pt._transform = function(chunk, encoding, cb) { setTimeout(function() { pt.push(chunk); @@ -229,7 +229,7 @@ const Transform = require('_stream_transform'); }; pt._flush = function(cb) { - // just output whatever we have. + // Just output whatever we have. pt.push(Buffer.from(this.state)); this.state = ''; cb(); diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index af38df7e684aac..5b25da0b67c0b8 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -55,7 +55,7 @@ for (let i = 0; i < chunks.length; i++) { }); tw.on('finish', common.mustCall(function() { - // got chunks in the right order + // Got chunks in the right order assert.deepStrictEqual(tw.buffer, chunks); })); @@ -96,7 +96,7 @@ for (let i = 0; i < chunks.length; i++) { let drains = 0; tw.on('finish', common.mustCall(function() { - // got chunks in the right order + // Got chunks in the right order assert.deepStrictEqual(tw.buffer, chunks); assert.strictEqual(drains, 17); })); @@ -142,7 +142,7 @@ for (let i = 0; i < chunks.length; i++) { undefined ]; tw.on('finish', function() { - // got the expected chunks + // Got the expected chunks assert.deepStrictEqual(tw.buffer, chunks); }); @@ -181,7 +181,7 @@ for (let i = 0; i < chunks.length; i++) { undefined ]; tw.on('finish', function() { - // got the expected chunks + // Got the expected chunks assert.deepStrictEqual(tw.buffer, chunks); }); @@ -210,9 +210,9 @@ for (let i = 0; i < chunks.length; i++) { tw.on('finish', common.mustCall(function() { process.nextTick(common.mustCall(function() { - // got chunks in the right order + // Got chunks in the right order assert.deepStrictEqual(tw.buffer, chunks); - // called all callbacks + // Called all callbacks assert.deepStrictEqual(callbacks._called, chunks); })); })); diff --git a/test/parallel/test-stream3-pause-then-read.js b/test/parallel/test-stream3-pause-then-read.js index b86c0157062dfe..bfd8a2037323c7 100644 --- a/test/parallel/test-stream3-pause-then-read.js +++ b/test/parallel/test-stream3-pause-then-read.js @@ -56,7 +56,7 @@ function push() { read100(); -// first we read 100 bytes +// First we read 100 bytes. function read100() { readn(100, onData); } @@ -77,7 +77,7 @@ function readn(n, then) { })(); } -// Then we listen to some data events +// Then we listen to some data events. function onData() { expectEndingData -= 100; console.error('onData'); @@ -85,24 +85,24 @@ function onData() { r.on('data', function od(c) { seen += c.length; if (seen >= 100) { - // seen enough + // Seen enough r.removeListener('data', od); r.pause(); if (seen > 100) { - // oh no, seen too much! - // put the extra back. + // Oh no, seen too much! + // Put the extra back. const diff = seen - 100; r.unshift(c.slice(c.length - diff)); console.error('seen too much', seen, diff); } - // Nothing should be lost in between + // Nothing should be lost in-between. setImmediate(pipeLittle); } }); } -// Just pipe 200 bytes, then unshift the extra and unpipe +// Just pipe 200 bytes, then unshift the extra and unpipe. function pipeLittle() { expectEndingData -= 200; console.error('pipe a little'); @@ -130,14 +130,14 @@ function pipeLittle() { r.pipe(w); } -// now read 1234 more bytes +// Now read 1234 more bytes. function read1234() { readn(1234, resumePause); } function resumePause() { console.error('resumePause'); - // Don't read anything, just resume and re-pause a whole bunch + // Don't read anything, just resume and re-pause a whole bunch. r.resume(); r.pause(); r.resume(); diff --git a/test/parallel/test-string-decoder-end.js b/test/parallel/test-string-decoder-end.js index 0c0c072eb9d653..ee0a47e3572f6d 100644 --- a/test/parallel/test-string-decoder-end.js +++ b/test/parallel/test-string-decoder-end.js @@ -86,7 +86,7 @@ function testEncoding(encoding) { } function testBuf(encoding, buf) { - // write one byte at a time. + // Write one byte at a time. let s = new SD(encoding); let res1 = ''; for (let i = 0; i < buf.length; i++) { diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js index b66fb0960adf21..d64312f52540a7 100644 --- a/test/parallel/test-stringbytes-external.js +++ b/test/parallel/test-stringbytes-external.js @@ -30,7 +30,7 @@ let ucs2_control = 'a\u0000'; let write_str = 'a'; -// first do basic checks +// First do basic checks let b = Buffer.from(write_str, 'ucs2'); // first check latin1 let c = b.toString('latin1'); @@ -43,7 +43,7 @@ assert.strictEqual(b[0], 0x61); assert.strictEqual(b[1], 0); assert.strictEqual(ucs2_control, c); -// now create big strings +// Now create big strings const size = 1 << 20; write_str = write_str.repeat(size); ucs2_control = ucs2_control.repeat(size); @@ -76,7 +76,7 @@ assert.strictEqual(c_bin.length, c_ucs.length); for (let i = 0; i < c_bin.length; i++) { assert.strictEqual(c_bin[i], c_ucs[i]); } -// check resultant strings +// Check resultant strings assert.strictEqual(c_bin.toString('ucs2'), c_ucs.toString('ucs2')); assert.strictEqual(c_bin.toString('latin1'), ucs2_control); assert.strictEqual(c_ucs.toString('latin1'), ucs2_control); @@ -96,7 +96,7 @@ const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; const pumped_string2 = slice2.toString('hex'); const decoded = Buffer.from(pumped_string, 'hex'); - // the string are the same? + // The string are the same? for (let k = 0; k < pumped_string.length; ++k) { assert.strictEqual(pumped_string[k], pumped_string2[k]); } @@ -117,7 +117,7 @@ const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; const pumped_string2 = slice2.toString('base64'); const decoded = Buffer.from(pumped_string, 'base64'); - // the string are the same? + // The string are the same? for (let k = 0; k < pumped_string.length - 3; ++k) { assert.strictEqual(pumped_string[k], pumped_string2[k]); } diff --git a/test/parallel/test-timers-ordering.js b/test/parallel/test-timers-ordering.js index 1f2809ab4e1831..6c6daecef3a563 100644 --- a/test/parallel/test-timers-ordering.js +++ b/test/parallel/test-timers-ordering.js @@ -44,7 +44,7 @@ function f(i) { `current ts ${now} < prev ts ${last_ts} + 1`); last_ts = now; - // schedule next iteration + // Schedule next iteration setTimeout(f, 1, i + 1); } } diff --git a/test/parallel/test-timers-uncaught-exception.js b/test/parallel/test-timers-uncaught-exception.js index 0a0eabf4c14e5b..8bcf72e36c730f 100644 --- a/test/parallel/test-timers-uncaught-exception.js +++ b/test/parallel/test-timers-uncaught-exception.js @@ -24,7 +24,7 @@ const common = require('../common'); const assert = require('assert'); const errorMsg = 'BAM!'; -// the first timer throws... +// The first timer throws... setTimeout(common.mustCall(function() { throw new Error(errorMsg); }), 1); diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js index 76604e05875c65..3da24c67fbe522 100644 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js @@ -80,7 +80,7 @@ function Test1() { checkResults(results[1], { server: { ALPN: 'b' }, client: { ALPN: 'b' } }); - // nothing is selected by ALPN + // Nothing is selected by ALPN checkResults(results[2], { server: { ALPN: false }, client: { ALPN: false } }); @@ -98,15 +98,15 @@ function Test2() { const clientsOptions = [{}, {}, {}]; runTest(clientsOptions, serverOptions, function(results) { - // nothing is selected by ALPN + // Nothing is selected by ALPN checkResults(results[0], { server: { ALPN: false }, client: { ALPN: false } }); - // nothing is selected by ALPN + // Nothing is selected by ALPN checkResults(results[1], { server: { ALPN: false }, client: { ALPN: false } }); - // nothing is selected by ALPN + // Nothing is selected by ALPN checkResults(results[2], { server: { ALPN: false }, client: { ALPN: false } }); diff --git a/test/parallel/test-tls-client-renegotiation-limit.js b/test/parallel/test-tls-client-renegotiation-limit.js index 010fd8596aa0c8..38dcf5a80be5a6 100644 --- a/test/parallel/test-tls-client-renegotiation-limit.js +++ b/test/parallel/test-tls-client-renegotiation-limit.js @@ -34,7 +34,7 @@ const fixtures = require('../common/fixtures'); // Renegotiation as a protocol feature was dropped after TLS1.2. tls.DEFAULT_MAX_VERSION = 'TLSv1.2'; -// renegotiation limits to test +// Renegotiation limits to test const LIMITS = [0, 1, 2, 3, 5, 10, 16]; { @@ -87,7 +87,7 @@ function test(next) { assert.strictEqual(hadErr, false); }); - // simulate renegotiation attack + // Simulate renegotiation attack function spam() { client.write(''); client.renegotiate({}, (err) => { diff --git a/test/parallel/test-tls-connect-memleak.js b/test/parallel/test-tls-connect-memleak.js index 0278e6c7159a68..162d61fcdc7a66 100644 --- a/test/parallel/test-tls-connect-memleak.js +++ b/test/parallel/test-tls-connect-memleak.js @@ -50,7 +50,7 @@ const gcListener = { ongc() { collected = true; } }; server.address().port, { rejectUnauthorized: false }, common.mustCall(() => { - assert.strictEqual(gcObject, gcObject); // keep reference alive + assert.strictEqual(gcObject, gcObject); // Keep reference alive assert.strictEqual(collected, false); setImmediate(done, sock); })); diff --git a/test/parallel/test-tls-ecdh-auto.js b/test/parallel/test-tls-ecdh-auto.js index 840063229a60b7..7b535ecd3a18f0 100644 --- a/test/parallel/test-tls-ecdh-auto.js +++ b/test/parallel/test-tls-ecdh-auto.js @@ -26,7 +26,7 @@ const options = { ecdhCurve: 'auto' }; -const reply = 'I AM THE WALRUS'; // something recognizable +const reply = 'I AM THE WALRUS'; // Something recognizable const server = tls.createServer(options, function(conn) { conn.end(reply); diff --git a/test/parallel/test-tls-ecdh-multiple.js b/test/parallel/test-tls-ecdh-multiple.js index d5f27a5e464437..1fcfc041bd4050 100644 --- a/test/parallel/test-tls-ecdh-multiple.js +++ b/test/parallel/test-tls-ecdh-multiple.js @@ -26,7 +26,7 @@ const options = { ecdhCurve: 'secp256k1:prime256v1:secp521r1' }; -const reply = 'I AM THE WALRUS'; // something recognizable +const reply = 'I AM THE WALRUS'; // Something recognizable const server = tls.createServer(options, function(conn) { conn.end(reply); diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index e7d986cc9aec09..23767be92cf00c 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -41,7 +41,7 @@ const options = { ecdhCurve: 'prime256v1' }; -const reply = 'I AM THE WALRUS'; // something recognizable +const reply = 'I AM THE WALRUS'; // Something recognizable const server = tls.createServer(options, common.mustCall(function(conn) { conn.end(reply); diff --git a/test/parallel/test-tls-socket-close.js b/test/parallel/test-tls-socket-close.js index 73130768890550..839be2a888973b 100644 --- a/test/parallel/test-tls-socket-close.js +++ b/test/parallel/test-tls-socket-close.js @@ -38,7 +38,7 @@ const tlsServer = tls.createServer({ cert, key }, (socket) => { let netSocket; // plain tcp server const netServer = net.createServer((socket) => { - // if client wants to use tls + // If client wants to use tls tlsServer.emit('connection', socket); netSocket = socket; diff --git a/test/parallel/test-url-fileurltopath.js b/test/parallel/test-url-fileurltopath.js index f6a1fb4fdafd01..74a217e8b68bde 100644 --- a/test/parallel/test-url-fileurltopath.js +++ b/test/parallel/test-url-fileurltopath.js @@ -53,9 +53,9 @@ assert.throws(() => url.fileURLToPath('https://a/b/c'), { let testCases; if (isWindows) { testCases = [ - // lowercase ascii alpha + // Lowercase ascii alpha { path: 'C:\\foo', fileURL: 'file:///C:/foo' }, - // uppercase ascii alpha + // Uppercase ascii alpha { path: 'C:\\FOO', fileURL: 'file:///C:/FOO' }, // dir { path: 'C:\\dir\\foo', fileURL: 'file:///C:/dir/foo' }, @@ -91,16 +91,16 @@ assert.throws(() => url.fileURLToPath('https://a/b/c'), { { path: 'C:\\foo\rbar', fileURL: 'file:///C:/foo%0Dbar' }, // latin1 { path: 'C:\\fóóbàr', fileURL: 'file:///C:/f%C3%B3%C3%B3b%C3%A0r' }, - // euro sign (BMP code point) + // Euro sign (BMP code point) { path: 'C:\\€', fileURL: 'file:///C:/%E2%82%AC' }, // Rocket emoji (non-BMP code point) { path: 'C:\\🚀', fileURL: 'file:///C:/%F0%9F%9A%80' } ]; } else { testCases = [ - // lowercase ascii alpha + // Lowercase ascii alpha { path: '/foo', fileURL: 'file:///foo' }, - // uppercase ascii alpha + // Uppercase ascii alpha { path: '/FOO', fileURL: 'file:///FOO' }, // dir { path: '/dir/foo', fileURL: 'file:///dir/foo' }, @@ -136,7 +136,7 @@ assert.throws(() => url.fileURLToPath('https://a/b/c'), { { path: '/foo\rbar', fileURL: 'file:///foo%0Dbar' }, // latin1 { path: '/fóóbàr', fileURL: 'file:///f%C3%B3%C3%B3b%C3%A0r' }, - // euro sign (BMP code point) + // Euro sign (BMP code point) { path: '/€', fileURL: 'file:///%E2%82%AC' }, // Rocket emoji (non-BMP code point) { path: '/🚀', fileURL: 'file:///%F0%9F%9A%80' }, diff --git a/test/parallel/test-url-format.js b/test/parallel/test-url-format.js index d18ff6715b3ed0..2d0132eb38a0bb 100644 --- a/test/parallel/test-url-format.js +++ b/test/parallel/test-url-format.js @@ -203,7 +203,7 @@ const formatTests = { pathname: '/fooA100%mBr', }, - // multiple `#` in search + // Multiple `#` in search 'http://example.com/?foo=bar%231%232%233&abc=%234%23%235#frag': { href: 'http://example.com/?foo=bar%231%232%233&abc=%234%23%235#frag', protocol: 'http:', diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index b318658febbaea..d802b0f6dcc3f6 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -157,7 +157,7 @@ const parseTests = { path: '/Y' }, - // whitespace in the front + // Whitespace in the front ' http://www.example.com/': { href: 'http://www.example.com/', protocol: 'http:', @@ -861,7 +861,7 @@ const parseTests = { href: 'http://a%0D%22%20%09%0A%3C\'b:b@c/%0D%0Ad/e?f' }, - // git urls used by npm + // Git urls used by npm 'git+ssh://git@github.com:npm/npm': { protocol: 'git+ssh:', slashes: true, diff --git a/test/parallel/test-url-pathtofileurl.js b/test/parallel/test-url-pathtofileurl.js index 1beb69b7f38343..395447ab4cef0d 100644 --- a/test/parallel/test-url-pathtofileurl.js +++ b/test/parallel/test-url-pathtofileurl.js @@ -27,9 +27,9 @@ const url = require('url'); let testCases; if (isWindows) { testCases = [ - // lowercase ascii alpha + // Lowercase ascii alpha { path: 'C:\\foo', expected: 'file:///C:/foo' }, - // uppercase ascii alpha + // Uppercase ascii alpha { path: 'C:\\FOO', expected: 'file:///C:/FOO' }, // dir { path: 'C:\\dir\\foo', expected: 'file:///C:/dir/foo' }, @@ -65,16 +65,16 @@ const url = require('url'); { path: 'C:\\foo\rbar', expected: 'file:///C:/foo%0Dbar' }, // latin1 { path: 'C:\\fóóbàr', expected: 'file:///C:/f%C3%B3%C3%B3b%C3%A0r' }, - // euro sign (BMP code point) + // Euro sign (BMP code point) { path: 'C:\\€', expected: 'file:///C:/%E2%82%AC' }, // Rocket emoji (non-BMP code point) { path: 'C:\\🚀', expected: 'file:///C:/%F0%9F%9A%80' } ]; } else { testCases = [ - // lowercase ascii alpha + // Lowercase ascii alpha { path: '/foo', expected: 'file:///foo' }, - // uppercase ascii alpha + // Uppercase ascii alpha { path: '/FOO', expected: 'file:///FOO' }, // dir { path: '/dir/foo', expected: 'file:///dir/foo' }, @@ -110,7 +110,7 @@ const url = require('url'); { path: '/foo\rbar', expected: 'file:///foo%0Dbar' }, // latin1 { path: '/fóóbàr', expected: 'file:///f%C3%B3%C3%B3b%C3%A0r' }, - // euro sign (BMP code point) + // Euro sign (BMP code point) { path: '/€', expected: 'file:///%E2%82%AC' }, // Rocket emoji (non-BMP code point) { path: '/🚀', expected: 'file:///%F0%9F%9A%80' }, diff --git a/test/parallel/test-url-relative.js b/test/parallel/test-url-relative.js index dc0362df1a5662..d0c4b5f42c3e0c 100644 --- a/test/parallel/test-url-relative.js +++ b/test/parallel/test-url-relative.js @@ -4,7 +4,7 @@ const assert = require('assert'); const inspect = require('util').inspect; const url = require('url'); -// when source is false +// When source is false assert.strictEqual(url.resolveObject('', 'foo'), 'foo'); /* @@ -105,11 +105,11 @@ const relativeTests2 = [ ['g/', bases[0], 'http://a/b/c/g/'], ['/g', bases[0], 'http://a/g'], ['//g', bases[0], 'http://g/'], - // changed with RFC 2396bis + // Changed with RFC 2396bis // ('?y', bases[0], 'http://a/b/c/d;p?y'], ['?y', bases[0], 'http://a/b/c/d;p?y'], ['g?y', bases[0], 'http://a/b/c/g?y'], - // changed with RFC 2396bis + // Changed with RFC 2396bis // ('#s', bases[0], CURRENT_DOC_URI + '#s'], ['#s', bases[0], 'http://a/b/c/d;p?q#s'], ['g#s', bases[0], 'http://a/b/c/g#s'], @@ -117,7 +117,7 @@ const relativeTests2 = [ [';x', bases[0], 'http://a/b/c/;x'], ['g;x', bases[0], 'http://a/b/c/g;x'], ['g;x?y#s', bases[0], 'http://a/b/c/g;x?y#s'], - // changed with RFC 2396bis + // Changed with RFC 2396bis // ('', bases[0], CURRENT_DOC_URI], ['', bases[0], 'http://a/b/c/d;p?q'], ['.', bases[0], 'http://a/b/c/'], @@ -130,10 +130,10 @@ const relativeTests2 = [ ['../../g', bases[0], 'http://a/g'], ['../../../g', bases[0], ('http://a/../g', 'http://a/g')], ['../../../../g', bases[0], ('http://a/../../g', 'http://a/g')], - // changed with RFC 2396bis + // Changed with RFC 2396bis // ('/./g', bases[0], 'http://a/./g'], ['/./g', bases[0], 'http://a/g'], - // changed with RFC 2396bis + // Changed with RFC 2396bis // ('/../g', bases[0], 'http://a/../g'], ['/../g', bases[0], 'http://a/g'], ['g.', bases[0], 'http://a/b/c/g.'], @@ -162,7 +162,7 @@ const relativeTests2 = [ ['g/', bases[1], 'http://a/b/c/g/'], ['/g', bases[1], 'http://a/g'], ['//g', bases[1], 'http://g/'], - // changed in RFC 2396bis + // Changed in RFC 2396bis // ('?y', bases[1], 'http://a/b/c/?y'], ['?y', bases[1], 'http://a/b/c/d;p?y'], ['g?y', bases[1], 'http://a/b/c/g?y'], @@ -200,9 +200,9 @@ const relativeTests2 = [ ['g', bases[3], 'fred:///s//a/b/g'], ['./g', bases[3], 'fred:///s//a/b/g'], ['g/', bases[3], 'fred:///s//a/b/g/'], - ['/g', bases[3], 'fred:///g'], // may change to fred:///s//a/g - ['//g', bases[3], 'fred://g'], // may change to fred:///s//g - ['//g/x', bases[3], 'fred://g/x'], // may change to fred:///s//g/x + ['/g', bases[3], 'fred:///g'], // May change to fred:///s//a/g + ['//g', bases[3], 'fred://g'], // May change to fred:///s//g + ['//g/x', bases[3], 'fred://g/x'], // May change to fred:///s//g/x ['///g', bases[3], 'fred:///g'], ['./', bases[3], 'fred:///s//a/b/'], ['../', bases[3], 'fred:///s//a/'], @@ -220,9 +220,9 @@ const relativeTests2 = [ ['g', bases[4], 'http:///s//a/b/g'], ['./g', bases[4], 'http:///s//a/b/g'], ['g/', bases[4], 'http:///s//a/b/g/'], - ['/g', bases[4], 'http:///g'], // may change to http:///s//a/g - ['//g', bases[4], 'http://g/'], // may change to http:///s//g - ['//g/x', bases[4], 'http://g/x'], // may change to http:///s//g/x + ['/g', bases[4], 'http:///g'], // May change to http:///s//a/g + ['//g', bases[4], 'http://g/'], // May change to http:///s//g + ['//g/x', bases[4], 'http://g/x'], // May change to http:///s//g/x ['///g', bases[4], 'http:///g'], ['./', bases[4], 'http:///s//a/b/'], ['../', bases[4], 'http:///s//a/'], diff --git a/test/parallel/test-util-callbackify.js b/test/parallel/test-util-callbackify.js index 9be3b132f95172..c381924e1b5f9d 100644 --- a/test/parallel/test-util-callbackify.js +++ b/test/parallel/test-util-callbackify.js @@ -89,7 +89,7 @@ const values = [ } })); - // test a Promise factory + // Test a Promise factory function promiseFn() { return Promise.reject(value); } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index a474fd56e44b71..d8739de790d0ad 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1787,7 +1787,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); assert.strictEqual(util.inspect(date), '{ CustomDate 2010-02-14T11:48:40.000Z foo: \'bar\' }'); - // check for null prototype + // Check for null prototype Object.setPrototypeOf(date, null); assert.strictEqual(util.inspect(date), '{ [Date: null prototype] 2010-02-14T11:48:40.000Z' + @@ -1812,7 +1812,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); assert.strictEqual(util.inspect(date), '{ CustomDate Invalid Date foo: \'bar\' }'); - // check for null prototype + // Check for null prototype Object.setPrototypeOf(date, null); assert.strictEqual(util.inspect(date), '{ [Date: null prototype] Invalid Date foo: \'bar\' }'); diff --git a/test/parallel/test-util-isDeepStrictEqual.js b/test/parallel/test-util-isDeepStrictEqual.js index 071e612565938a..1ad64c2ff81a57 100644 --- a/test/parallel/test-util-isDeepStrictEqual.js +++ b/test/parallel/test-util-isDeepStrictEqual.js @@ -221,7 +221,7 @@ notUtilIsDeepStrict( new Map([['1', 5], [0, 5], ['0', 5]]) ); -// undefined value in Map +// Undefined value in Map utilIsDeepStrict( new Map([[1, undefined]]), new Map([[1, undefined]]) diff --git a/test/parallel/test-v8-coverage.js b/test/parallel/test-v8-coverage.js index f002604c48e594..02ace7af9cdd78 100644 --- a/test/parallel/test-v8-coverage.js +++ b/test/parallel/test-v8-coverage.js @@ -29,7 +29,7 @@ function nextdir() { assert.strictEqual(output.stderr.toString(), ''); const fixtureCoverage = getFixtureCoverage('basic.js', coverageDirectory); assert.ok(fixtureCoverage); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // Second branch did not execute. assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); @@ -48,7 +48,7 @@ function nextdir() { assert.strictEqual(output.stderr.toString(), ''); const fixtureCoverage = getFixtureCoverage('exit-1.js', coverageDirectory); assert.ok(fixtureCoverage, 'coverage not found for file'); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // Second branch did not execute. assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); @@ -69,7 +69,7 @@ function nextdir() { assert.strictEqual(output.stderr.toString(), ''); const fixtureCoverage = getFixtureCoverage('sigint.js', coverageDirectory); assert.ok(fixtureCoverage); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // Second branch did not execute. assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); @@ -89,13 +89,13 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('subprocess.js', coverageDirectory); assert.ok(fixtureCoverage); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); // Second branch did not execute. assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); } -// outputs coverage from worker. +// Outputs coverage from worker. { const coverageDirectory = path.join(tmpdir.path, nextdir()); const output = spawnSync(process.execPath, [ @@ -109,7 +109,7 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('subprocess.js', coverageDirectory); assert.ok(fixtureCoverage); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); // Second branch did not execute. assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); @@ -145,7 +145,7 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('async-hooks.js', coverageDirectory); assert.ok(fixtureCoverage); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); } @@ -167,7 +167,7 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('basic.js', absoluteCoverageDirectory); assert.ok(fixtureCoverage); - // first branch executed. + // First branch executed. assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // Second branch did not execute. assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); diff --git a/test/parallel/test-vm-global-property-interceptors.js b/test/parallel/test-vm-global-property-interceptors.js index 23c56018b62e1f..01ae72446047f9 100644 --- a/test/parallel/test-vm-global-property-interceptors.js +++ b/test/parallel/test-vm-global-property-interceptors.js @@ -60,7 +60,7 @@ assert.deepEqual(result, { g: undefined }); -// define new properties +// Define new properties vm.runInContext(` Object.defineProperty(this, 'h', {value: 'h'}); Object.defineProperty(this, 'i', {}); diff --git a/test/parallel/test-whatwg-url-custom-properties.js b/test/parallel/test-whatwg-url-custom-properties.js index ee51efd5390292..1fbc3ab6238ea3 100644 --- a/test/parallel/test-whatwg-url-custom-properties.js +++ b/test/parallel/test-whatwg-url-custom-properties.js @@ -9,7 +9,7 @@ const assert = require('assert'); const urlToOptions = require('internal/url').urlToOptions; const url = new URL('http://user:pass@foo.bar.com:21/aaa/zzz?l=24#test'); -const oldParams = url.searchParams; // for test of [SameObject] +const oldParams = url.searchParams; // For test of [SameObject] // To retrieve enumerable but not necessarily own properties, // we need to use the for-in loop. diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js index 9b22df477840cb..68fa3825b91ced 100644 --- a/test/parallel/test-zlib-invalid-input.js +++ b/test/parallel/test-zlib-invalid-input.js @@ -54,6 +54,6 @@ unzips.forEach(common.mustCall((uz, i) => { uz.on('error', common.mustCall()); uz.on('end', common.mustNotCall); - // this will trigger error event + // This will trigger error event uz.write('this is not valid compressed data.'); }, unzips.length)); diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js index 0816e047bb0eef..d8d039a6d65c4f 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -46,7 +46,7 @@ class RandomReadStream extends Stream { // base block size. opt.block = opt.block || 256 * 1024; - // total number of bytes to emit + // Total number of bytes to emit opt.total = opt.total || 256 * 1024 * 1024; this._remaining = opt.total; diff --git a/test/parallel/test-zlib-truncated.js b/test/parallel/test-zlib-truncated.js index d8a04d3c0cc0cf..304f76b9da8651 100644 --- a/test/parallel/test-zlib-truncated.js +++ b/test/parallel/test-zlib-truncated.js @@ -38,12 +38,12 @@ const errMessage = /unexpected end of file/; assert.strictEqual(toUTF8(result), inputString); }); - // sync truncated input test + // Sync truncated input test assert.throws(function() { zlib[methods.decompSync](truncated); }, errMessage); - // async truncated input test + // Async truncated input test zlib[methods.decomp](truncated, function(err, result) { assert(errMessage.test(err.message)); }); diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 1852ae33936452..509dcd2207e83e 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -44,7 +44,7 @@ let trickle = [128, 1024, 1024 * 1024]; // several different chunk sizes let chunkSize = [128, 1024, 1024 * 16, 1024 * 1024]; -// this is every possible value. +// This is every possible value. let level = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; let windowBits = [8, 9, 10, 11, 12, 13, 14, 15]; let memLevel = [1, 2, 3, 4, 5, 6, 7, 8, 9]; @@ -74,7 +74,7 @@ testFiles.forEach(common.mustCall((file) => { }, testFiles.length)); -// stream that saves everything +// Stream that saves everything class BufferStream extends stream.Stream { constructor() { super(); @@ -210,7 +210,7 @@ testKeys.forEach(common.mustCall((file) => { } })); - // the magic happens here. + // The magic happens here. ss.pipe(def).pipe(inf).pipe(buf); ss.end(test); }, zlibPairs.length)); diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js index 70e793938ac2d3..7a8854860c15f1 100644 --- a/test/pummel/test-fs-watch-file.js +++ b/test/pummel/test-fs-watch-file.js @@ -41,7 +41,7 @@ const filenameTwo = 'hasOwnProperty'; const filepathTwo = filenameTwo; const filepathTwoAbs = path.join(testDir, filenameTwo); -const filenameThree = 'charm'; // because the third time is +const filenameThree = 'charm'; // Because the third time is const filenameFour = 'get'; diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js index 8a8646b3237f90..60d6a7e6922836 100644 --- a/test/pummel/test-timers.js +++ b/test/pummel/test-timers.js @@ -43,7 +43,7 @@ setTimeout(common.mustCall(function() { assert.strictEqual(1000 - WINDOW < diff && diff < 1000 + WINDOW, true); }), 1000); -// this timer shouldn't execute +// This timer shouldn't execute const id = setTimeout(function() { assert.strictEqual(true, false); }, 500); clearTimeout(id); diff --git a/test/sequential/test-child-process-emfile.js b/test/sequential/test-child-process-emfile.js index e81b3a0ffec9cb..7e31792f9dfb31 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -64,7 +64,7 @@ proc.on('error', common.mustCall(function(err) { proc.on('exit', common.mustNotCall('"exit" event should not be emitted')); -// close one fd for LSan +// Close one fd for LSan if (openFds.length >= 1) { fs.closeSync(openFds.pop()); } diff --git a/test/sequential/test-cli-syntax-bad.js b/test/sequential/test-cli-syntax-bad.js index 1512d9df4f1605..8298157a57e16e 100644 --- a/test/sequential/test-cli-syntax-bad.js +++ b/test/sequential/test-cli-syntax-bad.js @@ -35,7 +35,7 @@ const syntaxErrorRE = /^SyntaxError: \b/m; assert.strictEqual(err.code, 1, `code ${err.code} !== 1 for error:\n\n${err}`); - // no stdout should be produced + // No stdout should be produced assert.strictEqual(stdout, ''); // Stderr should have a syntax error message diff --git a/test/sequential/test-cli-syntax-file-not-found.js b/test/sequential/test-cli-syntax-file-not-found.js index b3bb9723e2c78e..3e1f3ec56118b3 100644 --- a/test/sequential/test-cli-syntax-file-not-found.js +++ b/test/sequential/test-cli-syntax-file-not-found.js @@ -27,7 +27,7 @@ const notFoundRE = /^Error: Cannot find module/m; const _args = args.concat(file); const cmd = [node, ..._args].join(' '); exec(cmd, common.mustCall((err, stdout, stderr) => { - // no stdout should be produced + // No stdout should be produced assert.strictEqual(stdout, ''); // `stderr` should have a module not found error message. diff --git a/test/sequential/test-cli-syntax-require.js b/test/sequential/test-cli-syntax-require.js index d99dc2ff71a9f1..c309b1f4556c3f 100644 --- a/test/sequential/test-cli-syntax-require.js +++ b/test/sequential/test-cli-syntax-require.js @@ -11,7 +11,7 @@ const node = process.execPath; // depending on the JavaScript engine. const syntaxErrorRE = /^SyntaxError: \b/m; -// should work with -r flags +// Should work with -r flags ['-c', '--check'].forEach(function(checkFlag) { ['-r', '--require'].forEach(function(requireFlag) { const preloadFile = fixtures.path('no-wrapper.js'); @@ -23,7 +23,7 @@ const syntaxErrorRE = /^SyntaxError: \b/m; assert.strictEqual(err.code, 1, `code ${err.code} !== 1 for error:\n\n${err}`); - // no stdout should be produced + // No stdout should be produced assert.strictEqual(stdout, ''); // stderr should have a syntax error message diff --git a/test/sequential/test-http-keepalive-maxsockets.js b/test/sequential/test-http-keepalive-maxsockets.js index 53d67b24797770..9c98a140f6a134 100644 --- a/test/sequential/test-http-keepalive-maxsockets.js +++ b/test/sequential/test-http-keepalive-maxsockets.js @@ -47,7 +47,7 @@ server.listen(0, function() { assert.strictEqual(count(agent.sockets), 0); assert.strictEqual(serverSockets.length, 5); - // now make 10 more reqs. + // Now make 10 more reqs. // should use the 2 free reqs from the pool first. makeReqs(10, function(er) { assert.ifError(er); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index 68d35dbdbc6a91..7384cf6e74f502 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -53,7 +53,7 @@ function child0() { console.error('baz'); } -// using process.stderr +// Using process.stderr function child1() { process.stderr.write('child 1\n'); process.stderr.write('foo\n'); diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 5175d4d46d7e95..f22b14caac4183 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -11,7 +11,7 @@ const path = require('path'); //------------------------------------------------------------------------------ module.exports = function(context) { - // trim required module names + // Trim required module names const requiredModules = context.options; const isESM = context.parserOptions.sourceType === 'module'; diff --git a/tools/test-npm-package.js b/tools/test-npm-package.js index 0cf9700ef96e80..b34b8183677211 100755 --- a/tools/test-npm-package.js +++ b/tools/test-npm-package.js @@ -30,7 +30,7 @@ const nodePath = path.dirname(process.execPath); function spawnCopyDeepSync(source, destination) { if (common.isWindows) { - mkdirSync(destination); // prevent interactive prompt + mkdirSync(destination); // Prevent interactive prompt return spawnSync('xcopy.exe', ['/E', source, destination]); } else { return spawnSync('cp', ['-r', `${source}/`, destination]);