diff --git a/.eslintrc.js b/.eslintrc.js index cbadffded25aa0..5c4933101447f2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -224,6 +224,10 @@ module.exports = { 'space-in-parens': ['error', 'never'], 'space-infix-ops': 'error', 'space-unary-ops': 'error', + 'spaced-comment': ['error', 'always', { + 'block': { 'balanced': true }, + 'exceptions': ['-'] + }], 'strict': ['error', 'global'], 'symbol-description': 'error', 'template-curly-spacing': 'error', diff --git a/benchmark/buffers/buffer-swap.js b/benchmark/buffers/buffer-swap.js index 8f6e1f51d3a0f2..a85bcf32307313 100644 --- a/benchmark/buffers/buffer-swap.js +++ b/benchmark/buffers/buffer-swap.js @@ -4,7 +4,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { aligned: ['true', 'false'], - method: ['swap16', 'swap32', 'swap64'/*, 'htons', 'htonl', 'htonll'*/], + method: ['swap16', 'swap32', 'swap64'/* , 'htons', 'htonl', 'htonll' */], len: [8, 64, 128, 256, 512, 768, 1024, 1536, 2056, 4096, 8192], n: [5e7] }); diff --git a/doc/api/assert.md b/doc/api/assert.md index c26628bd84f670..d470cc80905243 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -456,7 +456,7 @@ assert.equal(1, '1'); assert.equal(1, 2); // AssertionError: 1 == 2 assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); -//AssertionError: { a: { b: 1 } } == { a: { b: 1 } } +// AssertionError: { a: { b: 1 } } == { a: { b: 1 } } ``` If the values are not equal, an `AssertionError` is thrown with a `message` diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 6def24c8a571b0..7a01038d58fb02 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -166,11 +166,11 @@ directly by the shell and special characters (vary based on need to be dealt with accordingly: ```js exec('"/path/to/test file/test.sh" arg1 arg2'); -//Double quotes are used so that the space in the path is not interpreted as -//multiple arguments +// Double quotes are used so that the space in the path is not interpreted as +// multiple arguments exec('echo "The \\$HOME variable is $HOME"'); -//The $HOME variable is escaped in the first instance, but not in the second +// The $HOME variable is escaped in the first instance, but not in the second ``` **Never pass unsanitized user input to this function. Any input containing shell diff --git a/doc/api/http2.md b/doc/api/http2.md index 3279fa6cf05ac3..193dd147d56265 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -203,7 +203,7 @@ settings do not take effect until the `'localSettings'` event is emitted. session.settings({ enablePush: false }); session.on('localSettings', (settings) => { - /** use the new settings **/ + /* Use the new settings */ }); ``` @@ -218,7 +218,7 @@ of the remote settings. ```js session.on('remoteSettings', (settings) => { - /** use the new settings **/ + /* Use the new settings */ }); ``` @@ -280,7 +280,7 @@ activity on the `Http2Session` after the configured number of milliseconds. ```js session.setTimeout(2000); -session.on('timeout', () => { /** .. **/ }); +session.on('timeout', () => { /* .. */ }); ``` #### http2session.alpnProtocol @@ -706,8 +706,8 @@ const { const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); req.on('response', (headers) => { console.log(headers[HTTP2_HEADER_STATUS]); - req.on('data', (chunk) => { /** .. **/ }); - req.on('end', () => { /** .. **/ }); + req.on('data', (chunk) => { /* .. */ }); + req.on('end', () => { /* .. */ }); }); ``` @@ -1928,7 +1928,7 @@ Returns a `ClientHttp2Session` instance. const http2 = require('http2'); const client = http2.connect('https://localhost:1234'); -/** use the client **/ +/* Use the client */ client.close(); ``` diff --git a/doc/api/net.md b/doc/api/net.md index 4b3897f61cb757..121dc552e843ec 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -914,7 +914,7 @@ in the [`net.createServer()`][] section: ```js const net = require('net'); const client = net.createConnection({ port: 8124 }, () => { - //'connect' listener + // 'connect' listener console.log('connected to server!'); client.write('world!\r\n'); }); diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 5a18e40b4f13b8..303f56bfe4ba21 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -134,8 +134,8 @@ Agent.prototype.getName = function getName(options) { return name; }; -Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/, - localAddress/*legacy*/) { +Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, + localAddress/* legacy */) { // Legacy API: addRequest(req, host, port, localAddress) if (typeof options === 'string') { options = { diff --git a/lib/_http_client.js b/lib/_http_client.js index 5ab6d0bdba74b0..a7df01bbf4f1a9 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -194,7 +194,7 @@ function ClientRequest(options, cb) { var posColon = hostHeader.indexOf(':'); if (posColon !== -1 && hostHeader.indexOf(':', posColon + 1) !== -1 && - hostHeader.charCodeAt(0) !== 91/*'['*/) { + hostHeader.charCodeAt(0) !== 91/* '[' */) { hostHeader = `[${hostHeader}]`; } diff --git a/lib/_http_common.js b/lib/_http_common.js index ffb90407c62175..b101c11911fa1e 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -237,7 +237,7 @@ const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; * Verifies that the given val is a valid HTTP token * per the rules defined in RFC 7230 * See https://tools.ietf.org/html/rfc7230#section-3.2.6 -**/ + */ function checkIsHttpToken(val) { return tokenRegExp.test(val); } @@ -248,7 +248,7 @@ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; * field-value = *( field-content / obs-fold ) * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] * field-vchar = VCHAR / obs-text - **/ + */ function checkInvalidHeaderChar(val) { return headerCharRegex.test(val); } diff --git a/lib/buffer.js b/lib/buffer.js index 45c1282f2d9503..09afc4d713bd9b 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -170,7 +170,7 @@ const doFlaggedDeprecation = * runtime deprecation would introduce too much breakage at this time. It's not * likely that the Buffer constructors would ever actually be removed. * Deprecation Code: DEP0005 - **/ + */ function Buffer(arg, encodingOrOffset, length) { doFlaggedDeprecation(); // Common case. @@ -196,7 +196,7 @@ Object.defineProperty(Buffer, Symbol.species, { * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ + */ Buffer.from = function from(value, encodingOrOffset, length) { if (typeof value === 'string') return fromString(value, encodingOrOffset); @@ -260,7 +260,7 @@ function assertSize(size) { /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) - **/ + */ Buffer.alloc = function alloc(size, fill, encoding) { assertSize(size); if (fill !== undefined && size > 0) { @@ -272,7 +272,7 @@ Buffer.alloc = function alloc(size, fill, encoding) { /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer * instance. If `--zero-fill-buffers` is set, will zero-fill the buffer. - **/ + */ Buffer.allocUnsafe = function allocUnsafe(size) { assertSize(size); return allocate(size); @@ -282,7 +282,7 @@ Buffer.allocUnsafe = function allocUnsafe(size) { * Equivalent to SlowBuffer(num), by default creates a non-zero-filled * Buffer instance that is not allocated off the pre-initialized pool. * If `--zero-fill-buffers` is set, will zero-fill the buffer. - **/ + */ Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) { assertSize(size); return createUnsafeBuffer(size); diff --git a/lib/child_process.js b/lib/child_process.js index 97b436cc0761c8..ee3752a817e781 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -59,7 +59,7 @@ function stdioStringToArray(option) { } } -exports.fork = function(modulePath /*, args, options*/) { +exports.fork = function(modulePath /* , args, options */) { // Get options and args arguments. var execArgv; @@ -143,7 +143,7 @@ function normalizeExecArgs(command, options, callback) { } -exports.exec = function(command /*, options, callback*/) { +exports.exec = function(command /* , options, callback */) { var opts = normalizeExecArgs.apply(null, arguments); return exports.execFile(opts.file, opts.options, @@ -172,7 +172,7 @@ Object.defineProperty(exports.exec, util.promisify.custom, { value: customPromiseExecFunction(exports.exec) }); -exports.execFile = function(file /*, args, options, callback*/) { +exports.execFile = function(file /* , args, options, callback */) { var args = []; var callback; var options = { @@ -511,7 +511,7 @@ function normalizeSpawnArguments(file, args, options) { } -var spawn = exports.spawn = function(/*file, args, options*/) { +var spawn = exports.spawn = function(/* file, args, options */) { var opts = normalizeSpawnArguments.apply(null, arguments); var options = opts.options; var child = new ChildProcess(); @@ -534,7 +534,7 @@ var spawn = exports.spawn = function(/*file, args, options*/) { return child; }; -function spawnSync(/*file, args, options*/) { +function spawnSync(/* file, args, options */) { var opts = normalizeSpawnArguments.apply(null, arguments); var options = opts.options; @@ -602,7 +602,7 @@ function checkExecSyncError(ret, args, cmd) { } -function execFileSync(/*command, args, options*/) { +function execFileSync(/* command, args, options */) { var opts = normalizeSpawnArguments.apply(null, arguments); var inheritStderr = !opts.options.stdio; @@ -621,7 +621,7 @@ function execFileSync(/*command, args, options*/) { exports.execFileSync = execFileSync; -function execSync(command /*, options*/) { +function execSync(command /* , options */) { var opts = normalizeExecArgs.apply(null, arguments); var inheritStderr = !opts.options.stdio; diff --git a/lib/dgram.js b/lib/dgram.js index 355e7d2fbe79e5..fcf9f00a105101 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -193,7 +193,7 @@ function bufferSize(self, size, buffer) { return ret; } -Socket.prototype.bind = function(port_, address_ /*, callback*/) { +Socket.prototype.bind = function(port_, address_ /* , callback */) { let port = port_; this._healthCheck(); diff --git a/lib/fs.js b/lib/fs.js index b767c8a3226008..2de5f8dd6e205b 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -160,7 +160,7 @@ fs.Stats = Stats; function isFileType(fileType) { // Use stats array directly to avoid creating an fs.Stats instance just for // our internal use. - return (statValues[1/*mode*/] & S_IFMT) === fileType; + return (statValues[1/* mode */] & S_IFMT) === fileType; } // Don't allow mode to accidentally be overwritten. @@ -1442,7 +1442,7 @@ function StatWatcher() { this._handle.onchange = function(newStatus) { if (oldStatus === -1 && newStatus === -1 && - statValues[2/*new nlink*/] === statValues[16/*old nlink*/]) return; + statValues[2/* new nlink */] === statValues[16/* old nlink */]) return; oldStatus = newStatus; self.emit('change', statsFromValues(), statsFromPrevValues()); diff --git a/lib/fs/promises.js b/lib/fs/promises.js index 8587321464c751..b4ee81c1a743bc 100644 --- a/lib/fs/promises.js +++ b/lib/fs/promises.js @@ -133,8 +133,8 @@ async function readFileHandle(filehandle, options) { const statFields = await binding.fstat(filehandle.fd, kUsePromises); let size; - if ((statFields[1/*mode*/] & S_IFMT) === S_IFREG) { - size = statFields[8/*size*/]; + if ((statFields[1/* mode */] & S_IFMT) === S_IFREG) { + size = statFields[8/* size */]; } else { size = 0; } diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 6fb14c6d10548e..652378ad5782fb 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -702,7 +702,7 @@ Module._extensions['.json'] = function(module, filename) { }; -//Native extension for .node +// Native extension for .node Module._extensions['.node'] = function(module, filename) { return process.dlopen(module, path.toNamespacedPath(filename)); }; diff --git a/lib/internal/url.js b/lib/internal/url.js index 239a17e483f4a6..1513b14e8297c3 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -712,7 +712,7 @@ function parseParams(qs) { const code = qs.charCodeAt(i); // Try matching key/value pair separator - if (code === 38/*&*/) { + if (code === 38/* & */) { if (pairStart === i) { // We saw an empty substring between pair separators lastPos = pairStart = i + 1; @@ -738,7 +738,7 @@ function parseParams(qs) { } // Try matching key/value separator (e.g. '=') if we haven't already - if (!seenSep && code === 61/*=*/) { + if (!seenSep && code === 61/* = */) { // Key/value separator match! if (lastPos < i) buf += qs.slice(lastPos, i); @@ -755,7 +755,7 @@ function parseParams(qs) { } // Handle + and percent decoding. - if (code === 43/*+*/) { + if (code === 43/* + */) { if (lastPos < i) buf += qs.slice(lastPos, i); buf += ' '; @@ -763,7 +763,7 @@ function parseParams(qs) { } else if (!encoded) { // Try to match an (valid) encoded byte (once) to minimize unnecessary // calls to string decoding functions - if (code === 37/*%*/) { + if (code === 37/* % */) { encodeCheck = 1; } else if (encodeCheck > 0) { // eslint-disable-next-line no-extra-boolean-cast @@ -799,7 +799,9 @@ function parseParams(qs) { // Adapted from querystring's implementation. // Ref: https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer const noEscape = [ -//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F +/* + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F +*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 - 0x0F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x10 - 0x1F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, // 0x20 - 0x2F diff --git a/lib/querystring.js b/lib/querystring.js index 3bedd493f4b34f..ba676d8c6d7fab 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -76,12 +76,12 @@ function unescapeBuffer(s, decodeSpaces) { var hasHex = false; while (index < s.length) { currentChar = s.charCodeAt(index); - if (currentChar === 43 /*'+'*/ && decodeSpaces) { + if (currentChar === 43 /* '+' */ && decodeSpaces) { out[outIndex++] = 32; // ' ' index++; continue; } - if (currentChar === 37 /*'%'*/ && index < maxLength) { + if (currentChar === 37 /* '%' */ && index < maxLength) { currentChar = s.charCodeAt(++index); hexHigh = unhexTable[currentChar]; if (!(hexHigh >= 0)) { @@ -365,7 +365,7 @@ function parse(qs, sep, eq, options) { if (!keyEncoded) { // Try to match an (valid) encoded byte once to minimize unnecessary // calls to string decoding functions - if (code === 37/*%*/) { + if (code === 37/* % */) { encodeCheck = 1; continue; } else if (encodeCheck > 0) { @@ -380,7 +380,7 @@ function parse(qs, sep, eq, options) { } } } - if (code === 43/*+*/) { + if (code === 43/* + */) { if (lastPos < i) key += qs.slice(lastPos, i); key += plusChar; @@ -388,7 +388,7 @@ function parse(qs, sep, eq, options) { continue; } } - if (code === 43/*+*/) { + if (code === 43/* + */) { if (lastPos < i) value += qs.slice(lastPos, i); value += plusChar; @@ -396,7 +396,7 @@ function parse(qs, sep, eq, options) { } else if (!valEncoded) { // Try to match an (valid) encoded byte (once) to minimize unnecessary // calls to string decoding functions - if (code === 37/*%*/) { + if (code === 37/* % */) { encodeCheck = 1; } else if (encodeCheck > 0) { // eslint-disable-next-line no-extra-boolean-cast diff --git a/lib/url.js b/lib/url.js index 78c0ea3d17b98f..ac9879a650fce6 100644 --- a/lib/url.js +++ b/lib/url.js @@ -482,19 +482,19 @@ function validateHostname(self, rest, hostname) { // Escaped characters. Use empty strings to fill up unused entries. // Using Array is faster than Object/Map const escapedCodes = [ - /*0 - 9*/ '', '', '', '', '', '', '', '', '', '%09', - /*10 - 19*/ '%0A', '', '', '%0D', '', '', '', '', '', '', - /*20 - 29*/ '', '', '', '', '', '', '', '', '', '', - /*30 - 39*/ '', '', '%20', '', '%22', '', '', '', '', '%27', - /*40 - 49*/ '', '', '', '', '', '', '', '', '', '', - /*50 - 59*/ '', '', '', '', '', '', '', '', '', '', - /*60 - 69*/ '%3C', '', '%3E', '', '', '', '', '', '', '', - /*70 - 79*/ '', '', '', '', '', '', '', '', '', '', - /*80 - 89*/ '', '', '', '', '', '', '', '', '', '', - /*90 - 99*/ '', '', '%5C', '', '%5E', '', '%60', '', '', '', - /*100 - 109*/ '', '', '', '', '', '', '', '', '', '', - /*110 - 119*/ '', '', '', '', '', '', '', '', '', '', - /*120 - 125*/ '', '', '', '%7B', '%7C', '%7D' + /* 0 - 9 */ '', '', '', '', '', '', '', '', '', '%09', + /* 10 - 19 */ '%0A', '', '', '%0D', '', '', '', '', '', '', + /* 20 - 29 */ '', '', '', '', '', '', '', '', '', '', + /* 30 - 39 */ '', '', '%20', '', '%22', '', '', '', '', '%27', + /* 40 - 49 */ '', '', '', '', '', '', '', '', '', '', + /* 50 - 59 */ '', '', '', '', '', '', '', '', '', '', + /* 60 - 69 */ '%3C', '', '%3E', '', '', '', '', '', '', '', + /* 70 - 79 */ '', '', '', '', '', '', '', '', '', '', + /* 80 - 89 */ '', '', '', '', '', '', '', '', '', '', + /* 90 - 99 */ '', '', '%5C', '', '%5E', '', '%60', '', '', '', + /* 100 - 109 */ '', '', '', '', '', '', '', '', '', '', + /* 110 - 119 */ '', '', '', '', '', '', '', '', '', '', + /* 120 - 125 */ '', '', '', '%7B', '%7C', '%7D' ]; // Automatically escape all delimiters and unwise characters from RFC 2396. @@ -592,7 +592,7 @@ Url.prototype.format = function format() { var search = this.search || (query && ('?' + query)) || ''; - if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/*:*/) + if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/* : */) protocol += ':'; var newPathname = ''; @@ -628,10 +628,10 @@ Url.prototype.format = function format() { pathname = '/' + pathname; host = '//' + host; } else if (protocol.length >= 4 && - protocol.charCodeAt(0) === 102/*f*/ && - protocol.charCodeAt(1) === 105/*i*/ && - protocol.charCodeAt(2) === 108/*l*/ && - protocol.charCodeAt(3) === 101/*e*/) { + protocol.charCodeAt(0) === 102/* f */ && + protocol.charCodeAt(1) === 105/* i */ && + protocol.charCodeAt(2) === 108/* l */ && + protocol.charCodeAt(3) === 101/* e */) { host = '//'; } } @@ -693,7 +693,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result[rkey] = relative[rkey]; } - //urlParse appends trailing / to urls like http://www.example.com + // urlParse appends trailing / to urls like http://www.example.com if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) { result.path = result.pathname = '/'; @@ -819,9 +819,9 @@ Url.prototype.resolveObject = function resolveObject(relative) { // Put this after the other two cases because it simplifies the booleans if (noLeadingSlashes) { result.hostname = result.host = srcPath.shift(); - //occasionally the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + // Occasionally the auth can get stuck only in host. + // This especially happens in cases like + // url.resolveObject('mailto:local1@domain1', 'local2@domain2') const authInHost = result.host && result.host.indexOf('@') > 0 && result.host.split('@'); if (authInHost) { @@ -831,7 +831,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { } result.search = relative.search; result.query = relative.query; - //to support http.request + // To support http.request if (result.pathname !== null || result.search !== null) { result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); @@ -844,7 +844,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { // no path at all. easy. // we've already handled the other stuff above. result.pathname = null; - //to support http.request + // To support http.request if (result.search) { result.path = '/' + result.search; } else { @@ -901,9 +901,9 @@ Url.prototype.resolveObject = function resolveObject(relative) { if (noLeadingSlashes) { result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; - //occasionally the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + // Occasionally the auth can get stuck only in host. + // This especially happens in cases like + // url.resolveObject('mailto:local1@domain1', 'local2@domain2') const authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false; if (authInHost) { @@ -925,7 +925,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result.pathname = srcPath.join('/'); } - //to support request.http + // To support request.http if (result.pathname !== null || result.search !== null) { result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); diff --git a/lib/util.js b/lib/util.js index a9be7cbda4f2a0..003d2dfa68a127 100644 --- a/lib/util.js +++ b/lib/util.js @@ -284,7 +284,7 @@ function debuglog(set) { * @param {any} value The value to print out. * @param {Object} opts Optional options object that alters the output. */ -/* Legacy: value, showHidden, depth, colors*/ +/* Legacy: value, showHidden, depth, colors */ function inspect(value, opts) { // Default options const ctx = { diff --git a/test/common/index.mjs b/test/common/index.mjs index 52cbd763637211..49b9e56bd9a10b 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -27,7 +27,7 @@ export function allowGlobals(...whitelist) { } export function leakedGlobals() { - //add possible expected globals + // Add possible expected globals if (global.gc) { knownGlobals.push(global.gc); } diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 40868d219acc4e..58e13c65e1baf1 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -64,7 +64,7 @@ if (process.argv[2] !== 'child') { let done = 0; let timer = null; - //exit the test if it doesn't succeed within TIMEOUT + // Exit the test if it doesn't succeed within TIMEOUT timer = setTimeout(function() { console.error('[PARENT] Responses were not received within %d ms.', TIMEOUT); @@ -75,7 +75,7 @@ if (process.argv[2] !== 'child') { process.exit(1); }, TIMEOUT); - //launch child processes + // Launch child processes for (let x = 0; x < listeners; x++) { (function() { const worker = fork(process.argv[1], ['child']); @@ -83,7 +83,7 @@ if (process.argv[2] !== 'child') { worker.messagesReceived = []; - //handle the death of workers + // Handle the death of workers worker.on('exit', function(code, signal) { // don't consider this the true death if the worker // has finished successfully @@ -113,7 +113,7 @@ if (process.argv[2] !== 'child') { listening += 1; if (listening === listeners) { - //all child process are listening, so start sending + // All child process are listening, so start sending sendSocket.sendNext(); } } else if (msg.message) { @@ -239,9 +239,9 @@ if (process.argv[2] === 'child') { }); listenSocket.on('close', function() { - //HACK: Wait to exit the process to ensure that the parent - //process has had time to receive all messages via process.send() - //This may be indicative of some other issue. + // HACK: Wait to exit the process to ensure that the parent + // process has had time to receive all messages via process.send() + // This may be indicative of some other issue. setTimeout(function() { process.exit(); }, 1000); diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 30baa30319f116..bce0ad83814435 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -646,7 +646,7 @@ assert.strictEqual('', x.inspect()); { const buf = Buffer.allocUnsafe(2); - assert.strictEqual(buf.write(''), 0); //0bytes + assert.strictEqual(buf.write(''), 0); // 0bytes assert.strictEqual(buf.write('\0'), 1); // 1byte (v8 adds null terminator) assert.strictEqual(buf.write('a\0'), 2); // 1byte * 2 assert.strictEqual(buf.write('あ'), 0); // 3bytes diff --git a/test/parallel/test-buffer-arraybuffer.js b/test/parallel/test-buffer-arraybuffer.js index b7f9359a00489c..24fb5969baec4e 100644 --- a/test/parallel/test-buffer-arraybuffer.js +++ b/test/parallel/test-buffer-arraybuffer.js @@ -132,7 +132,7 @@ assert.throws(function() { // If length can be converted to a number, it will be. assert.deepStrictEqual(Buffer.from(ab, 0, [1]), Buffer.from(ab, 0, 1)); - //If length is Infinity, throw. + // If length is Infinity, throw. common.expectsError(() => { Buffer.from(ab, 0, Infinity); }, { diff --git a/test/parallel/test-buffer-sharedarraybuffer.js b/test/parallel/test-buffer-sharedarraybuffer.js index 0252847c054c1d..ce3241ec0e7a0f 100644 --- a/test/parallel/test-buffer-sharedarraybuffer.js +++ b/test/parallel/test-buffer-sharedarraybuffer.js @@ -1,4 +1,4 @@ -/*global SharedArrayBuffer*/ +/* global SharedArrayBuffer */ 'use strict'; require('../common'); diff --git a/test/parallel/test-child-process-internal.js b/test/parallel/test-child-process-internal.js index c99010aeb8935a..c6ce0a8e04718c 100644 --- a/test/parallel/test-child-process-internal.js +++ b/test/parallel/test-child-process-internal.js @@ -23,16 +23,16 @@ const common = require('../common'); const assert = require('assert'); -//messages +// Messages const PREFIX = 'NODE_'; const normal = { cmd: `foo${PREFIX}` }; const internal = { cmd: `${PREFIX}bar` }; if (process.argv[2] === 'child') { - //send non-internal message containing PREFIX at a non prefix position + // Send non-internal message containing PREFIX at a non prefix position process.send(normal); - //send internal message + // Send internal message process.send(internal); process.exit(0); diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js index 20ad9683dfa622..ce916306d14e42 100644 --- a/test/parallel/test-child-process-silent.js +++ b/test/parallel/test-child-process-silent.js @@ -56,7 +56,7 @@ if (process.argv[2] === 'pipe') { const args = [process.argv[1], 'parent']; const parent = childProcess.spawn(process.execPath, args); - //got any stderr or std data + // Got any stderr or std data let stdoutData = false; parent.stdout.on('data', function() { stdoutData = true; diff --git a/test/parallel/test-child-process-spawnsync-validation-errors.js b/test/parallel/test-child-process-spawnsync-validation-errors.js index e52f04b04adda7..c12476c0422d0f 100644 --- a/test/parallel/test-child-process-spawnsync-validation-errors.js +++ b/test/parallel/test-child-process-spawnsync-validation-errors.js @@ -79,7 +79,7 @@ if (!common.isWindows) { fail('uid', 3.1, invalidArgTypeError); fail('uid', -3.1, invalidArgTypeError); } else { - //Decrement invalidArgTypeErrorCount if validation isn't possible + // Decrement invalidArgTypeErrorCount if validation isn't possible invalidArgTypeErrorCount -= 10; } } @@ -101,7 +101,7 @@ if (!common.isWindows) { fail('gid', 3.1, invalidArgTypeError); fail('gid', -3.1, invalidArgTypeError); } else { - //Decrement invalidArgTypeErrorCount if validation isn't possible + // Decrement invalidArgTypeErrorCount if validation isn't possible invalidArgTypeErrorCount -= 10; } } diff --git a/test/parallel/test-cluster-basic.js b/test/parallel/test-cluster-basic.js index 8a0a41f90c59d9..0d51a18607f6bf 100644 --- a/test/parallel/test-cluster-basic.js +++ b/test/parallel/test-cluster-basic.js @@ -78,45 +78,45 @@ if (cluster.isWorker) { const stateNames = Object.keys(checks.worker.states); - //Check events, states, and emit arguments + // Check events, states, and emit arguments forEach(checks.cluster.events, (bool, name, index) => { - //Listen on event + // Listen on event cluster.on(name, common.mustCall(function(/* worker */) { - //Set event + // Set event checks.cluster.events[name] = true; - //Check argument + // Check argument checks.cluster.equal[name] = worker === arguments[0]; - //Check state + // Check state const state = stateNames[index]; checks.worker.states[state] = (state === worker.state); })); }); - //Kill worker when listening + // Kill worker when listening cluster.on('listening', common.mustCall(() => { worker.kill(); })); - //Kill process when worker is killed + // Kill process when worker is killed cluster.on('exit', common.mustCall()); - //Create worker + // Create worker const worker = cluster.fork(); assert.strictEqual(worker.id, 1); assert(worker instanceof cluster.Worker, 'the worker is not a instance of the Worker constructor'); - //Check event + // Check event forEach(checks.worker.events, function(bool, name, index) { worker.on(name, common.mustCall(function() { - //Set event + // Set event checks.worker.events[name] = true; - //Check argument + // Check argument checks.worker.equal[name] = (worker === this); switch (name) { @@ -146,33 +146,33 @@ if (cluster.isWorker) { })); }); - //Check all values + // Check all values process.once('exit', () => { - //Check cluster events + // Check cluster events forEach(checks.cluster.events, (check, name) => { assert(check, `The cluster event "${name}" on the cluster object did not fire`); }); - //Check cluster event arguments + // Check cluster event arguments forEach(checks.cluster.equal, (check, name) => { assert(check, `The cluster event "${name}" did not emit with correct argument`); }); - //Check worker states + // Check worker states forEach(checks.worker.states, (check, name) => { assert(check, `The worker state "${name}" was not set to true`); }); - //Check worker events + // Check worker events forEach(checks.worker.events, (check, name) => { assert(check, `The worker event "${name}" on the worker object did not fire`); }); - //Check worker event arguments + // Check worker event arguments forEach(checks.worker.equal, (check, name) => { assert(check, `The worker event "${name}" did not emit with correct argument`); diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js index e35e45768850ca..219c084a7e7073 100644 --- a/test/parallel/test-cluster-disconnect.js +++ b/test/parallel/test-cluster-disconnect.js @@ -86,11 +86,11 @@ if (cluster.isWorker) { }; const test = (again) => { - //1. start cluster + // 1. start cluster startCluster(common.mustCall(() => { - //2. test cluster + // 2. test cluster testCluster(common.mustCall(() => { - //3. disconnect cluster + // 3. disconnect cluster cluster.disconnect(common.mustCall(() => { // run test again to confirm cleanup if (again) { diff --git a/test/parallel/test-cluster-rr-domain-listen.js b/test/parallel/test-cluster-rr-domain-listen.js index 45e1200a3d65d1..0f94eb8e6b8060 100644 --- a/test/parallel/test-cluster-rr-domain-listen.js +++ b/test/parallel/test-cluster-rr-domain-listen.js @@ -36,16 +36,16 @@ if (cluster.isWorker) { } else if (cluster.isMaster) { - //Kill worker when listening + // Kill worker when listening cluster.on('listening', function() { worker.kill(); }); - //Kill process when worker is killed + // Kill process when worker is killed cluster.on('exit', function() { process.exit(0); }); - //Create worker + // Create worker const worker = cluster.fork(); } diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js index 7810d572ade56a..2003c390b94c5b 100644 --- a/test/parallel/test-crypto-fips.js +++ b/test/parallel/test-crypto-fips.js @@ -78,7 +78,7 @@ testHelper( 'require("crypto").getFips()', process.env); -//--force-fips should turn FIPS mode on +// --force-fips should turn FIPS mode on testHelper( compiledWithFips() ? 'stdout' : 'stderr', ['--force-fips'], @@ -234,7 +234,7 @@ testHelper( 'require("crypto").setFips(false)', process.env); -//--enable-fips and --force-fips order does not matter +// --enable-fips and --force-fips order does not matter testHelper( 'stderr', ['--enable-fips', '--force-fips'], diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 1fc3db74828ca6..3047d37c962cff 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -260,7 +260,7 @@ assert.throws(function() { /** * Check if the stream function uses utf8 as a default encoding. - **/ + */ function testEncoding(options, assertionHash) { const hash = crypto.createHash('sha256', options); diff --git a/test/parallel/test-dgram-multicast-setTTL.js b/test/parallel/test-dgram-multicast-setTTL.js index 8cfa759ad9f382..2e3aad63fe3012 100644 --- a/test/parallel/test-dgram-multicast-setTTL.js +++ b/test/parallel/test-dgram-multicast-setTTL.js @@ -30,7 +30,7 @@ socket.on('listening', common.mustCall(() => { const result = socket.setMulticastTTL(16); assert.strictEqual(result, 16); - //Try to set an invalid TTL (valid ttl is > 0 and < 256) + // Try to set an invalid TTL (valid ttl is > 0 and < 256) assert.throws(() => { socket.setMulticastTTL(1000); }, /^Error: setMulticastTTL EINVAL$/); @@ -43,6 +43,6 @@ socket.on('listening', common.mustCall(() => { message: 'The "ttl" argument must be of type number. Received type string' }); - //close the socket + // Close the socket socket.close(); })); diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index b836d81bd5985c..90e3f97d8cf252 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -100,7 +100,7 @@ const fileData5 = fs.readFileSync(filename5); assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, fileData5.length); -//exit logic for cleanup +// Exit logic for cleanup process.on('exit', function() { fs.unlinkSync(filename); diff --git a/test/parallel/test-http-agent-destroyed-socket.js b/test/parallel/test-http-agent-destroyed-socket.js index 39f4ebef5374c1..137292cce66916 100644 --- a/test/parallel/test-http-agent-destroyed-socket.js +++ b/test/parallel/test-http-agent-destroyed-socket.js @@ -47,7 +47,6 @@ const server = http.createServer(common.mustCall((req, res) => { request1.socket.on('close', common.mustCall()); response.resume(); response.on('end', common.mustCall(() => { - ///////////////////////////////// // // THE IMPORTANT PART // diff --git a/test/parallel/test-http-agent-error-on-idle.js b/test/parallel/test-http-agent-error-on-idle.js index 7cf494816ae266..8edfa24811417a 100644 --- a/test/parallel/test-http-agent-error-on-idle.js +++ b/test/parallel/test-http-agent-error-on-idle.js @@ -27,10 +27,10 @@ server.listen(0, () => { res.on('end', common.mustCall(() => { process.nextTick(common.mustCall(() => { const freeSockets = agent.freeSockets[socketKey]; - //expect a free socket on socketKey + // Expect a free socket on socketKey assert.strictEqual(freeSockets.length, 1); - //generate a random error on the free socket + // Generate a random error on the free socket const freeSocket = freeSockets[0]; freeSocket.emit('error', new Error('ECONNRESET: test')); @@ -40,7 +40,7 @@ server.listen(0, () => { })); function done() { - //expect the freeSockets pool to be empty + // Expect the freeSockets pool to be empty assert.strictEqual(Object.keys(agent.freeSockets).length, 0); agent.destroy(); diff --git a/test/parallel/test-http-allow-req-after-204-res.js b/test/parallel/test-http-allow-req-after-204-res.js index 8de53a9e539a66..84dd876985e2e6 100644 --- a/test/parallel/test-http-allow-req-after-204-res.js +++ b/test/parallel/test-http-allow-req-after-204-res.js @@ -48,8 +48,9 @@ function nextRequest() { if (countdown.dec()) { // throws error: nextRequest(); + // TODO: investigate why this does not work fine even though it should. // works just fine: - //process.nextTick(nextRequest); + // process.nextTick(nextRequest); } })); response.resume(); diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index 2779c21394ae44..55397cf0577b86 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -32,8 +32,6 @@ const options = { host: '127.0.0.1', }; -//http.globalAgent.maxSockets = 15; - const server = http.createServer(function(req, res) { const m = /\/(.*)/.exec(req.url); const reqid = parseInt(m[1], 10); diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js index c4a9151862ee6b..bb0fe0eaca57a9 100644 --- a/test/parallel/test-http-server-multiheaders2.js +++ b/test/parallel/test-http-server-multiheaders2.js @@ -66,7 +66,7 @@ const multipleForbidden = [ 'Max-Forwards', // special case, tested differently - //'Content-Length', + // 'Content-Length', ]; const srv = http.createServer(function(req, res) { diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index 204207dfa8dcb6..21c5d604363a36 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -24,6 +24,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); const net = require('net'); +const util = require('util'); let outstanding_reqs = 0; @@ -48,7 +49,6 @@ server.on('listening', function() { }); c.on('data', function(chunk) { - //console.log(chunk); res_buffer += chunk; }); @@ -78,7 +78,6 @@ server.on('listening', function() { }); c.on('data', function(chunk) { - //console.log(chunk); res_buffer += chunk; if (/0\r\n/.test(res_buffer)) { // got the end. outstanding_reqs--; @@ -103,8 +102,8 @@ server.on('listening', function() { headers: {} }, function(res) { res.on('end', function() { - //console.log(res.trailers); - assert.ok('x-foo' in res.trailers, 'Client doesn\'t see trailers.'); + assert.ok('x-foo' in res.trailers, + `${util.inspect(res.trailers)} misses the 'x-foo' property`); outstanding_reqs--; if (outstanding_reqs === 0) { server.close(); diff --git a/test/parallel/test-http-url.parse-post.js b/test/parallel/test-http-url.parse-post.js index d8803cbfd267db..91a567d1560f1a 100644 --- a/test/parallel/test-http-url.parse-post.js +++ b/test/parallel/test-http-url.parse-post.js @@ -28,11 +28,11 @@ const url = require('url'); let testURL; function check(request) { - //url.parse should not mess with the method + // url.parse should not mess with the method assert.strictEqual(request.method, 'POST'); - //everything else should be right + // Everything else should be right assert.strictEqual(request.url, '/asdf?qwer=zxcv'); - //the host header should use the url.parse.hostname + // The host header should use the url.parse.hostname assert.strictEqual(request.headers.host, `${testURL.hostname}:${testURL.port}`); } diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js index eb0e8b896a85ca..a1330ad73a199c 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -24,7 +24,6 @@ function reqHandler(req, res) { `Wrong host header for req[${req.url}]: ${req.headers.host}`); } res.writeHead(200, {}); - //process.nextTick(function() { res.end('ok'); }); res.end('ok'); } @@ -55,7 +54,6 @@ function testHttps() { method: 'GET', path: `/${counter++}`, host: 'localhost', - //agent: false, port: this.address().port, rejectUnauthorized: false }, cb).on('error', thrower); @@ -64,7 +62,6 @@ function testHttps() { method: 'GET', path: `/${counter++}`, host: 'localhost', - //agent: false, port: this.address().port, rejectUnauthorized: false }, cb).on('error', thrower).end(); @@ -73,7 +70,6 @@ function testHttps() { method: 'POST', path: `/${counter++}`, host: 'localhost', - //agent: false, port: this.address().port, rejectUnauthorized: false }, cb).on('error', thrower).end(); @@ -82,7 +78,6 @@ function testHttps() { method: 'PUT', path: `/${counter++}`, host: 'localhost', - //agent: false, port: this.address().port, rejectUnauthorized: false }, cb).on('error', thrower).end(); @@ -91,7 +86,6 @@ function testHttps() { method: 'DELETE', path: `/${counter++}`, host: 'localhost', - //agent: false, port: this.address().port, rejectUnauthorized: false }, cb).on('error', thrower).end(); diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 47d4209c36a20b..62a50e6fe706a7 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -100,7 +100,7 @@ assert.ok(type.length > 0); const release = os.release(); is.string(release); assert.ok(release.length > 0); -//TODO: Check format on more than just AIX +// TODO: Check format on more than just AIX if (common.isAIX) assert.ok(/^\d+\.\d+$/.test(release)); diff --git a/test/parallel/test-stream2-basic.js b/test/parallel/test-stream2-basic.js index 21bd1f69313f66..0694adb5c5905e 100644 --- a/test/parallel/test-stream2-basic.js +++ b/test/parallel/test-stream2-basic.js @@ -65,8 +65,6 @@ class TestReader extends R { } } -///// - class TestWriter extends EE { constructor() { super(); diff --git a/test/parallel/test-tcp-wrap-connect.js b/test/parallel/test-tcp-wrap-connect.js index 9f5560a385086a..36f87d1863ef36 100644 --- a/test/parallel/test-tcp-wrap-connect.js +++ b/test/parallel/test-tcp-wrap-connect.js @@ -33,8 +33,6 @@ function makeConnection() { }; } -///// - let connectCount = 0; let endCount = 0; let shutdownCount = 0; diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index eeea8b030da719..b8291af8d69f07 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -227,12 +227,7 @@ function runClient(prefix, port, options, cb) { } }); - //client.stdout.pipe(process.stdout); - client.on('exit', function(code) { - //assert.strictEqual( - // 0, code, - // `${prefix}${options.name}: s_client exited with error code ${code}`); if (options.shouldReject) { assert.strictEqual( true, rejected, diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index 0e12fe52516f16..f4e72ee5ef4896 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -581,17 +581,17 @@ const parseTests = { href: 'git+http://github.com/joyent/node.git' }, - //if local1@domain1 is uses as a relative URL it may - //be parse into auth@hostname, but here there is no - //way to make it work in url.parse, I add the test to be explicit + // If local1@domain1 is uses as a relative URL it may + // be parse into auth@hostname, but here there is no + // way to make it work in url.parse, I add the test to be explicit 'local1@domain1': { pathname: 'local1@domain1', path: 'local1@domain1', href: 'local1@domain1' }, - //While this may seem counter-intuitive, a browser will parse - // as a path. + // While this may seem counter-intuitive, a browser will parse + // as a path. 'www.example.com': { href: 'www.example.com', pathname: 'www.example.com', diff --git a/test/parallel/test-url-relative.js b/test/parallel/test-url-relative.js index bd690c27afc777..d8532fcfee0ed6 100644 --- a/test/parallel/test-url-relative.js +++ b/test/parallel/test-url-relative.js @@ -81,7 +81,7 @@ const bases = [ 'http:///s//a/b/c' ]; -//[to, from, result] +// [to, from, result] const relativeTests2 = [ // http://lists.w3.org/Archives/Public/uri/2004Feb/0114.html ['../c', 'foo:a/b', 'foo:c'], @@ -106,11 +106,11 @@ const relativeTests2 = [ ['/g', bases[0], 'http://a/g'], ['//g', bases[0], 'http://g/'], // changed with RFC 2396bis - //('?y', bases[0], 'http://a/b/c/d;p?y'], + // ('?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 - //('#s', bases[0], CURRENT_DOC_URI + '#s'], + // ('#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'], ['g?y#s', bases[0], 'http://a/b/c/g?y#s'], @@ -118,7 +118,7 @@ const relativeTests2 = [ ['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 - //('', bases[0], CURRENT_DOC_URI], + // ('', bases[0], CURRENT_DOC_URI], ['', bases[0], 'http://a/b/c/d;p?q'], ['.', bases[0], 'http://a/b/c/'], ['./', bases[0], 'http://a/b/c/'], @@ -131,10 +131,10 @@ const relativeTests2 = [ ['../../../g', bases[0], ('http://a/../g', 'http://a/g')], ['../../../../g', bases[0], ('http://a/../../g', 'http://a/g')], // changed with RFC 2396bis - //('/./g', bases[0], 'http://a/./g'], + // ('/./g', bases[0], 'http://a/./g'], ['/./g', bases[0], 'http://a/g'], // changed with RFC 2396bis - //('/../g', bases[0], 'http://a/../g'], + // ('/../g', bases[0], 'http://a/../g'], ['/../g', bases[0], 'http://a/g'], ['g.', bases[0], 'http://a/b/c/g.'], ['.g', bases[0], 'http://a/b/c/.g'], @@ -163,7 +163,7 @@ const relativeTests2 = [ ['/g', bases[1], 'http://a/g'], ['//g', bases[1], 'http://g/'], // changed in RFC 2396bis - //('?y', bases[1], 'http://a/b/c/?y'], + // ('?y', bases[1], 'http://a/b/c/?y'], ['?y', bases[1], 'http://a/b/c/d;p?y'], ['g?y', bases[1], 'http://a/b/c/g?y'], ['g?y/./x', bases[1], 'http://a/b/c/g?y/./x'], @@ -345,7 +345,7 @@ const relativeTests2 = [ 'file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/mini1.xml'], ['../b/c', 'foo:a/y/z', 'foo:a/b/c'], - //changeing auth + // changeing auth ['http://diff:auth@www.example.com', 'http://asdf:qwer@www.example.com', 'http://diff:auth@www.example.com/'], @@ -383,10 +383,10 @@ relativeTests2.forEach(function(relativeTest) { ` == ${e}\n actual=${a}`); }); -//if format and parse are inverse operations then -//resolveObject(parse(x), y) == parse(resolve(x, y)) +// If format and parse are inverse operations then +// resolveObject(parse(x), y) == parse(resolve(x, y)) -//format: [from, path, expected] +// format: [from, path, expected] relativeTests.forEach(function(relativeTest) { let actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]); let expected = url.parse(relativeTest[2]); @@ -402,7 +402,7 @@ relativeTests.forEach(function(relativeTest) { `actual: ${actual}`); }); -//format: [to, from, result] +// format: [to, from, result] // the test: ['.//g', 'f:/a', 'f://g'] is a fundamental problem // url.parse('f:/a') does not have a host // url.resolve('f:/a', './/g') does not have a host because you have moved diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js index f9211ddf4209b4..ac2f0349ec2620 100644 --- a/test/parallel/test-util-types.js +++ b/test/parallel/test-util-types.js @@ -1,4 +1,4 @@ -/*global SharedArrayBuffer*/ +/* global SharedArrayBuffer */ 'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-v8-serdes-sharedarraybuffer.js b/test/parallel/test-v8-serdes-sharedarraybuffer.js index 6ba12e38d85894..01db30818153b8 100644 --- a/test/parallel/test-v8-serdes-sharedarraybuffer.js +++ b/test/parallel/test-v8-serdes-sharedarraybuffer.js @@ -1,4 +1,4 @@ -/*global SharedArrayBuffer*/ +/* global SharedArrayBuffer */ 'use strict'; const common = require('../common'); diff --git a/test/parallel/test-vm-global-property-interceptors.js b/test/parallel/test-vm-global-property-interceptors.js index e946b3fc5e463c..8571fbe19fcb60 100644 --- a/test/parallel/test-vm-global-property-interceptors.js +++ b/test/parallel/test-vm-global-property-interceptors.js @@ -44,7 +44,7 @@ const result = { result; `, ctx); -//eslint-disable-next-line no-restricted-properties +// eslint-disable-next-line no-restricted-properties assert.deepEqual(result, { a: { value: 'a', writable: true, enumerable: true, configurable: true }, b: { value: 'b', writable: false, enumerable: false, configurable: false }, diff --git a/test/parallel/test-vm-new-script-new-context.js b/test/parallel/test-vm-new-script-new-context.js index dfb43e42d1cc82..b0ef06756bee6d 100644 --- a/test/parallel/test-vm-new-script-new-context.js +++ b/test/parallel/test-vm-new-script-new-context.js @@ -54,7 +54,7 @@ const Script = require('vm').Script; script.runInNewContext(); assert.strictEqual(5, global.hello); - // cleanup + // Cleanup delete global.hello; } @@ -72,7 +72,7 @@ const Script = require('vm').Script; assert.strictEqual(2, global.obj.bar); assert.strictEqual(2, global.foo); - //cleanup + // cleanup delete global.code; delete global.foo; delete global.obj; diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index 9e132b7df9a488..9411d24e077097 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -69,9 +69,6 @@ function test(next) { const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' '); const child = spawn(common.opensslCli, args); - //child.stdout.pipe(process.stdout); - //child.stderr.pipe(process.stderr); - child.stdout.resume(); child.stderr.resume(); diff --git a/test/pummel/test-regress-GH-814.js b/test/pummel/test-regress-GH-814.js index a62df944863062..d7af574e0ab87e 100644 --- a/test/pummel/test-regress-GH-814.js +++ b/test/pummel/test-regress-GH-814.js @@ -32,7 +32,6 @@ function newBuffer(size, value) { while (size--) { buffer[size] = value; } - //buffer[buffer.length-2]= 0x0d; buffer[buffer.length - 1] = 0x0a; return buffer; } @@ -45,7 +44,7 @@ console.log(testFileName); const kBufSize = 128 * 1024; let PASS = true; -const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); //0x2e === '.' +const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); // 0x2e === '.' const bufPool = []; @@ -57,7 +56,7 @@ function tailCB(data) { } -const timeToQuit = Date.now() + 8e3; //Test during no more than this seconds. +const timeToQuit = Date.now() + 8e3; // Test during no more than this seconds. (function main() { if (PASS) { diff --git a/test/pummel/test-regress-GH-814_2.js b/test/pummel/test-regress-GH-814_2.js index a183e082f86aa6..1b40ca7b37cdfa 100644 --- a/test/pummel/test-regress-GH-814_2.js +++ b/test/pummel/test-regress-GH-814_2.js @@ -38,9 +38,7 @@ tailProc.stdout.on('data', tailCB); function tailCB(data) { PASS = !data.toString().includes('.'); - if (PASS) { - //console.error('i'); - } else { + if (!PASS) { console.error('[FAIL]\n DATA -> '); console.error(data); console.error('\n'); @@ -52,9 +50,9 @@ function tailCB(data) { let PASS = true; const bufPool = []; const kBufSize = 16 * 1024 * 1024; -const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); //0x2e === '.' +const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); // 0x2e === '.' -const timeToQuit = Date.now() + 5e3; //Test should last no more than this. +const timeToQuit = Date.now() + 5e3; // Test should last no more than this. writer(); function writer() { @@ -79,14 +77,12 @@ function writer() { bufPool.length = 0; } process.nextTick(writer); - //console.error('o'); } } } function writerCB(err, written) { - //console.error('cb.'); assert.ifError(err); } diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index dede8ec9db7056..528ebe4516c71d 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -67,9 +67,6 @@ function test(next) { const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' '); const child = spawn(common.opensslCli, args); - //child.stdout.pipe(process.stdout); - //child.stderr.pipe(process.stderr); - child.stdout.resume(); child.stderr.resume(); diff --git a/test/sequential/test-child-process-exit.js b/test/sequential/test-child-process-exit.js index 303f015cf0aebd..64e188fbf87efc 100644 --- a/test/sequential/test-child-process-exit.js +++ b/test/sequential/test-child-process-exit.js @@ -56,7 +56,6 @@ var timer = setTimeout(function() { child.on('exit', function(code) { console.error('exit %d from gen %d', code, gen + 1); - //clearTimeout(timer); }); child.stdout.pipe(process.stdout); diff --git a/test/sequential/test-next-tick-error-spin.js b/test/sequential/test-next-tick-error-spin.js index 8bc323510a4da6..565cdb458cfdbf 100644 --- a/test/sequential/test-next-tick-error-spin.js +++ b/test/sequential/test-next-tick-error-spin.js @@ -26,7 +26,7 @@ const assert = require('assert'); if (process.argv[2] !== 'child') { const spawn = require('child_process').spawn; const child = spawn(process.execPath, [__filename, 'child'], { - stdio: 'pipe'//'inherit' + stdio: 'pipe'// 'inherit' }); const timer = setTimeout(function() { throw new Error('child is hung'); diff --git a/test/sequential/test-performance.js b/test/sequential/test-performance.js index 770ca7bf6407be..037168dffb9aac 100644 --- a/test/sequential/test-performance.js +++ b/test/sequential/test-performance.js @@ -102,7 +102,7 @@ assert(inited < 20000); assert.strictEqual(entry.entryType, 'measure'); assert.strictEqual(entry.startTime, markA.startTime); // TODO(jasnell): This comparison is too imprecise on some systems - //assert.strictEqual(entry.duration.toPrecision(3), + // assert.strictEqual(entry.duration.toPrecision(3), // (markB.startTime - markA.startTime).toPrecision(3)); }); }