tools: capitalize sentences

This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.

PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
Ruben Bridgewater 2018-12-03 17:15:45 +01:00
parent cc8250fab8
commit 1f85ea979c
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
155 changed files with 256 additions and 244 deletions

View File

@ -58,6 +58,18 @@ module.exports = {
'arrow-spacing': ['error', { before: true, after: true }],
'block-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'capitalized-comments': ['error', 'always', {
line: {
// Ignore all lines that have less characters than 62 and all lines that
// start with something that looks like a variable name or code.
ignorePattern: '^.{0,62}$|^ [a-z]+ ?[0-9A-Z_.(/=:-]',
ignoreInlineComments: true,
ignoreConsecutiveComments: true
},
block: {
ignorePattern: '.*'
}
}],
'comma-dangle': ['error', 'only-multiline'],
'comma-spacing': 'error',
'comma-style': 'error',

View File

@ -49,7 +49,7 @@ function CLI(usage, settings) {
this.optional[currentOptional] = true;
mode = 'both';
} else {
// expect the next value to be option related (either -- or the value)
// Expect the next value to be option related (either -- or the value)
mode = 'option';
}
} else if (mode === 'option') {

View File

@ -31,7 +31,7 @@ function childProcessExecStdout({ dur, len }) {
try {
execSync(`taskkill /f /t /pid ${child.pid}`);
} catch {
// this is a best effort kill. stderr is piped to parent for tracing.
// This is a best effort kill. stderr is piped to parent for tracing.
}
} else {
child.kill();

View File

@ -146,7 +146,7 @@ Benchmark.prototype._run = function() {
(function recursive(queueIndex) {
const config = self.queue[queueIndex];
// set NODE_RUN_BENCHMARK_FN to indicate that the child shouldn't construct
// Set NODE_RUN_BENCHMARK_FN to indicate that the child shouldn't construct
// a configuration queue, but just execute the benchmark function.
const childEnv = Object.assign({}, process.env);
childEnv.NODE_RUN_BENCHMARK_FN = '';
@ -187,7 +187,7 @@ Benchmark.prototype.start = function() {
};
Benchmark.prototype.end = function(operations) {
// get elapsed time now and do error checking later for accuracy.
// Get elapsed time now and do error checking later for accuracy.
const elapsed = process.hrtime(this._time);
if (!this._started) {

View File

@ -58,7 +58,7 @@ function main({ api, cipher, type, len, writes }) {
const fn = api === 'stream' ? streamWrite : legacyWrite;
// write data as fast as possible to alice, and have bob decrypt.
// Write data as fast as possible to alice, and have bob decrypt.
// use old API for comparison to v0.8
bench.start();
fn(alice_cipher, bob_cipher, message, encoding, writes);

View File

@ -1,4 +1,4 @@
// test UDP send throughput with the multi buffer API against Buffer.concat
// Test UDP send throughput with the multi buffer API against Buffer.concat
'use strict';
const common = require('../common.js');

View File

@ -1,4 +1,4 @@
// test UDP send/recv throughput with the "old" offset/length API
// Test UDP send/recv throughput with the "old" offset/length API
'use strict';
const common = require('../common.js');

View File

@ -7,7 +7,7 @@
const assert = require('assert');
const common = require('../../common.js');
// this fails when we try to open with a different version of node,
// This fails when we try to open with a different version of node,
// which is quite common for benchmarks. so in that case, just
// abort quietly.

View File

@ -1,4 +1,4 @@
// test the speed of .pipe() with JSStream wrapping for PassThrough streams
// Test the speed of .pipe() with JSStream wrapping for PassThrough streams
'use strict';
const common = require('../common.js');

View File

@ -61,12 +61,12 @@ asyncHook.disable();
// resource referenced by "asyncId" may not have been populated.
function init(asyncId, type, triggerAsyncId, resource) { }
// before is called just before the resource's callback is called. It can be
// Before is called just before the resource's callback is called. It can be
// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1
// time for requests (e.g. FSReqCallback).
function before(asyncId) { }
// after is called just after the resource's callback has finished.
// After is called just after the resource's callback has finished.
function after(asyncId) { }
// destroy is called when an AsyncWrap instance is destroyed.
@ -159,7 +159,7 @@ const fs = require('fs');
const util = require('util');
function debug(...args) {
// use a function like this one when debugging inside an AsyncHooks callback
// Use a function like this one when debugging inside an AsyncHooks callback
fs.writeFileSync('log.out', `${util.format(...args)}\n`, { flag: 'a' });
}
```

View File

@ -772,7 +772,7 @@ const uncompressedKey = ECDH.convertKey(compressedKey,
'hex',
'uncompressed');
// the converted key and the uncompressed public key should be the same
// The converted key and the uncompressed public key should be the same
console.log(uncompressedKey === ecdh.getPublicKey('hex'));
```

View File

@ -143,7 +143,7 @@ if (cluster.isMaster) {
// a new worker.
cluster.worker.disconnect();
// try to send an error to the request that triggered the problem
// Try to send an error to the request that triggered the problem
res.statusCode = 500;
res.setHeader('content-type', 'text/plain');
res.end('Oops, there was a problem!\n');

View File

@ -371,7 +371,7 @@ range, or outside the set of options for a given function parameter.
```js
require('net').connect(-1);
// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
// Throws "RangeError: "port" option should be >= 0 and < 65536: -1"
```
Node.js will generate and throw `RangeError` instances *immediately* as a form
@ -388,7 +388,7 @@ will do so.
```js
doesNotExist;
// throws ReferenceError, doesNotExist is not a variable in this program.
// Throws ReferenceError, doesNotExist is not a variable in this program.
```
Unless an application is dynamically generating and running code,

View File

@ -638,14 +638,14 @@ emitter.once('log', () => console.log('log once'));
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// logs "log once" to the console and does not unbind the `once` event
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// will return a new Array with a single function bound by `.on()` above
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// logs "log persistently" twice

View File

@ -1926,7 +1926,7 @@ console.log(fs.readFileSync('temp.txt', 'utf8'));
// get the file descriptor of the file to be truncated
const fd = fs.openSync('temp.txt', 'r+');
// truncate the file to 10 bytes, whereas the actual size is 7 bytes
// Truncate the file to 10 bytes, whereas the actual size is 7 bytes
fs.ftruncate(fd, 10, (err) => {
assert.ifError(err);
console.log(fs.readFileSync('temp.txt'));

View File

@ -49,7 +49,7 @@ console.log(`The area of mySquare is ${mySquare.area()}`);
The `square` module is defined in `square.js`:
```js
// assigning to exports will not modify module, must use module.exports
// Assigning to exports will not modify module, must use module.exports
module.exports = class Square {
constructor(width) {
this.width = width;

View File

@ -286,7 +286,7 @@ The listener function is called with the following arguments:
```js
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at:', p, 'reason:', reason);
// application specific logging, throwing an error, or other logic here
// Application specific logging, throwing an error, or other logic here
});
somePromise.then((res) => {

View File

@ -131,7 +131,7 @@ const server = http.createServer((req, res) => {
body += chunk;
});
// the 'end' event indicates that the entire body has been received
// The 'end' event indicates that the entire body has been received
req.on('end', () => {
try {
const data = JSON.parse(body);

View File

@ -159,7 +159,7 @@ const util = require('util');
const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
fn1(); // emits a deprecation warning with code DEP0001
fn2(); // does not emit a deprecation warning because it has the same code
fn2(); // Does not emit a deprecation warning because it has the same code
```
If either the `--no-deprecation` or `--no-warnings` command line flags are

View File

@ -109,7 +109,7 @@ const { MessageChannel } = require('worker_threads');
const { port1, port2 } = new MessageChannel();
port1.on('message', (message) => console.log('received', message));
port2.postMessage({ foo: 'bar' });
// prints: received { foo: 'bar' } from the `port1.on('message')` listener
// Prints: received { foo: 'bar' } from the `port1.on('message')` listener
```
## Class: MessagePort

View File

@ -50,7 +50,7 @@ function Agent(options) {
this.options = util._extend({}, options);
// don't confuse net and make it think that we're connecting to a pipe
// Don't confuse net and make it think that we're connecting to a pipe
this.options.path = null;
this.requests = {};
this.sockets = {};

View File

@ -388,7 +388,7 @@ function _storeHeader(firstLine, headers) {
this._header = header + CRLF;
this._headerSent = false;
// wait until the first body chunk, or close(), is sent to flush,
// Wait until the first body chunk, or close(), is sent to flush,
// UNLESS we're sending Expect: 100-continue.
if (state.expect) this._send('');
}

View File

@ -263,7 +263,7 @@ function writeHead(statusCode, reason, obj) {
this._hasBody = false;
}
// don't keep alive connections where the client expects 100 Continue
// Don't keep alive connections where the client expects 100 Continue
// but we sent a final status; they may put extra bytes on the wire.
if (this._expect_continue && !this._sent100) {
this.shouldKeepAlive = false;

View File

@ -86,7 +86,7 @@ function ReadableState(options, stream, isDuplex) {
if (isDuplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
// the point at which it stops calling _read() to fill the buffer
// The point at which it stops calling _read() to fill the buffer
// Note: 0 is a valid value, means "don't call _read preemptively ever"
this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark',
isDuplex);
@ -103,7 +103,7 @@ function ReadableState(options, stream, isDuplex) {
this.endEmitted = false;
this.reading = false;
// a flag to be able to tell if the event 'readable'/'data' is emitted
// A flag to be able to tell if the event 'readable'/'data' is emitted
// immediately, or on a later tick. We set this to true at first, because
// any actions that shouldn't happen until "later" should generally also
// not happen before the first read call.
@ -131,7 +131,7 @@ function ReadableState(options, stream, isDuplex) {
// Everything else in the universe uses 'utf8', though.
this.defaultEncoding = options.defaultEncoding || 'utf8';
// the number of writers that are awaiting a drain event in .pipe()s
// The number of writers that are awaiting a drain event in .pipe()s
this.awaitDrain = 0;
// if true, a maybeReadMore has been scheduled
@ -374,7 +374,7 @@ function howMuchToRead(n, state) {
return state.length;
}
// you can override either this method, or the async _read(n) below.
// You can override either this method, or the async _read(n) below.
Readable.prototype.read = function(n) {
debug('read', n);
n = parseInt(n, 10);
@ -436,13 +436,13 @@ Readable.prototype.read = function(n) {
var doRead = state.needReadable;
debug('need readable', doRead);
// if we currently have less than the highWaterMark, then also read some
// If we currently have less than the highWaterMark, then also read some
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug('length less than watermark', doRead);
}
// however, if we've ended, then there's no point, and if we're already
// However, if we've ended, then there's no point, and if we're already
// reading, then it's unnecessary.
if (state.ended || state.reading) {
doRead = false;
@ -451,7 +451,7 @@ Readable.prototype.read = function(n) {
debug('do read');
state.reading = true;
state.sync = true;
// if the length is currently zero, then we *need* a readable event.
// If the length is currently zero, then we *need* a readable event.
if (state.length === 0)
state.needReadable = true;
// call internal read method
@ -554,7 +554,7 @@ function emitReadable_(stream) {
}
// at this point, the user has presumably seen the 'readable' event,
// At this point, the user has presumably seen the 'readable' event,
// and called read() to consume some data. that may have triggered
// in turn another _read(n) call, in which case reading = true if
// it's in progress.
@ -582,7 +582,7 @@ function maybeReadMore_(stream, state) {
state.readingMore = false;
}
// abstract method. to be overridden in specific implementation classes.
// Abstract method. to be overridden in specific implementation classes.
// call cb(er, data) where data is <= n in length.
// for virtual (non-string, non-buffer) streams, "length" is somewhat
// arbitrary, and perhaps not very meaningful.

View File

@ -116,10 +116,10 @@ function Transform(options) {
writeencoding: null
};
// start out asking for a readable event once data is transformed.
// Start out asking for a readable event once data is transformed.
this._readableState.needReadable = true;
// we have implemented the _read method, and done the other things
// We have implemented the _read method, and done the other things
// that Readable wants before the first _read call, so unset the
// sync guard flag.
this._readableState.sync = false;

View File

@ -90,7 +90,7 @@ function WritableState(options, stream, isDuplex) {
// has it been destroyed
this.destroyed = false;
// should we decode strings into buffers before passing to _write?
// Should we decode strings into buffers before passing to _write?
// this is here so that some node-core streams can optimize string
// handling at a lower level.
var noDecode = options.decodeStrings === false;
@ -112,13 +112,13 @@ function WritableState(options, stream, isDuplex) {
// when true all writes will be buffered until .uncork() call
this.corked = 0;
// a flag to be able to tell if the onwrite cb is called immediately,
// A flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, because any
// actions that shouldn't happen until "later" should generally also
// not happen before the first write call.
this.sync = true;
// a flag to know if we're processing previously buffered items, which
// A flag to know if we're processing previously buffered items, which
// may call the _write() callback in the same tick, so that we don't
// end up in an overlapped onwrite situation.
this.bufferProcessing = false;
@ -126,7 +126,7 @@ function WritableState(options, stream, isDuplex) {
// the callback that's passed to _write(chunk,cb)
this.onwrite = onwrite.bind(undefined, stream);
// the callback that the user supplies to write(chunk,encoding,cb)
// The callback that the user supplies to write(chunk,encoding,cb)
this.writecb = null;
// the amount that is being written when _write is called.
@ -139,7 +139,7 @@ function WritableState(options, stream, isDuplex) {
// this must be 0 before 'finish' can be emitted
this.pendingcb = 0;
// emit prefinish if the only thing we're waiting for is _write cbs
// Emit prefinish if the only thing we're waiting for is _write cbs
// This is relevant for synchronous Transform streams
this.prefinished = false;
@ -376,7 +376,7 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
state.length += len;
var ret = state.length < state.highWaterMark;
// we must ensure that previous needDrain will not be reset to false.
// We must ensure that previous needDrain will not be reset to false.
if (!ret)
state.needDrain = true;

View File

@ -916,7 +916,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) {
if (string.length > 0 && (length < 0 || offset < 0))
throw new ERR_BUFFER_OUT_OF_BOUNDS();
} else {
// if someone is still calling the obsolete form of write(), tell them.
// If someone is still calling the obsolete form of write(), tell them.
// we don't want eg buf.write("foo", "utf8", 10) to silently turn into
// buf.write("foo", "utf8"), so we can't ignore extra args
throw new ERR_NO_LONGER_SUPPORTED(

View File

@ -313,7 +313,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
};
// thin wrapper around `send`, here for compatibility with dgram_legacy.js
// Thin wrapper around `send`, here for compatibility with dgram_legacy.js
Socket.prototype.sendto = function(buffer,
offset,
length,

View File

@ -35,7 +35,7 @@ const {
} = require('internal/errors').codes;
const { createHook } = require('async_hooks');
// overwrite process.domain with a getter/setter that will allow for more
// Overwrite process.domain with a getter/setter that will allow for more
// effective optimizations
var _domain = [null];
Object.defineProperty(process, 'domain', {

View File

@ -1452,7 +1452,7 @@ function realpathSync(p, options) {
let pos;
// the partial path so far, including a trailing slash if any
let current;
// the partial path without a trailing slash (except when pointing at a root)
// The partial path without a trailing slash (except when pointing at a root)
let base;
// the partial path scanned in the previous round, with slash
let previous;
@ -1469,7 +1469,7 @@ function realpathSync(p, options) {
knownHard[base] = true;
}
// walk down the path, swapping out linked path parts for their real
// Walk down the path, swapping out linked path parts for their real
// values
// NB: p.length changes.
while (pos < p.length) {
@ -1592,7 +1592,7 @@ function realpath(p, options, callback) {
let pos;
// the partial path so far, including a trailing slash if any
let current;
// the partial path without a trailing slash (except when pointing at a root)
// The partial path without a trailing slash (except when pointing at a root)
let base;
// the partial path scanned in the previous round, with slash
let previous;
@ -1611,7 +1611,7 @@ function realpath(p, options, callback) {
process.nextTick(LOOP);
}
// walk down the path, swapping out linked path parts for their real
// Walk down the path, swapping out linked path parts for their real
// values
function LOOP() {
// stop if scanned past end of path

View File

@ -62,7 +62,7 @@ let HTTPParser;
const MAX_HANDLE_RETRANSMISSIONS = 3;
// this object contain function to convert TCP objects to native handle objects
// This object contain function to convert TCP objects to native handle objects
// and back again.
const handleConversion = {
'net.Native': {
@ -117,7 +117,7 @@ const handleConversion = {
var handle = socket._handle;
// remove handle from socket object, it will be closed when the socket
// Remove handle from socket object, it will be closed when the socket
// will be sent
if (!options.keepOpen) {
handle.onread = nop;
@ -166,7 +166,7 @@ const handleConversion = {
writable: true
});
// if the socket was created by net.Server we will track the socket
// If the socket was created by net.Server we will track the socket
if (message.key) {
// add socket to connections list
@ -663,7 +663,7 @@ function setupChannel(target, channel) {
// package messages with a handle object
if (handle) {
// this message will be handled by an internalMessage event handler
// This message will be handled by an internalMessage event handler
message = {
cmd: 'NODE_HANDLE',
type: null,
@ -768,7 +768,7 @@ function setupChannel(target, channel) {
return channel.writeQueueSize < (65536 * 2);
};
// connected will be set to false immediately when a disconnect() is
// Connected will be set to false immediately when a disconnect() is
// requested, even though the channel might still be alive internally to
// process queued messages. The three states are distinguished as follows:
// - disconnect() never requested: channel is not null and connected

View File

@ -223,7 +223,7 @@ Console.prototype[kWriteToConsole] = function(streamSymbol, string) {
stream.write(string, errorHandler);
} catch (e) {
// console is a debugging utility, so it swallowing errors is not desirable
// Console is a debugging utility, so it swallowing errors is not desirable
// even in edge cases such as low stack space.
if (isStackOverflowError(e))
throw e;

View File

@ -231,7 +231,7 @@ function onStreamCloseRequest() {
state.closed = true;
req.push(null);
// if the user didn't interact with incoming data and didn't pipe it,
// If the user didn't interact with incoming data and didn't pipe it,
// dump it for compatibility with http1
if (!state.didRead && !req._readableState.resumeScheduled)
req.resume();

View File

@ -266,7 +266,7 @@ function onSessionHeaders(handle, id, cat, flags, headers) {
if (stream === undefined) {
if (session.closed) {
// we are not accepting any new streams at this point. This callback
// We are not accepting any new streams at this point. This callback
// should not be invoked at this point in time, but just in case it is,
// refuse the stream using an RST_STREAM and destroy the handle.
handle.rstStream(NGHTTP2_REFUSED_STREAM);
@ -1112,7 +1112,7 @@ class Http2Session extends EventEmitter {
return this[kState].goawayLastStreamID || 0;
}
// true if the Http2Session is waiting for a settings acknowledgement
// True if the Http2Session is waiting for a settings acknowledgement
get pendingSettingsAck() {
return this[kState].pendingAck > 0;
}
@ -2235,7 +2235,7 @@ class ServerHttp2Stream extends Http2Stream {
this[kSession].remoteSettings.enablePush;
}
// create a push stream, call the given callback with the created
// Create a push stream, call the given callback with the created
// Http2Stream for the push stream.
pushStream(headers, options, callback) {
if (!this.pushAllowed)

View File

@ -290,7 +290,7 @@ function getDefaultSettings() {
return holder;
}
// remote is a boolean. true to fetch remote settings, false to fetch local.
// Remote is a boolean. true to fetch remote settings, false to fetch local.
// this is only called internally
function getSettings(session, remote) {
if (remote)

View File

@ -138,7 +138,7 @@ const debug = util.debuglog('module');
Module._debug = util.deprecate(debug, 'Module._debug is deprecated.',
'DEP0077');
// given a module name, and a list of paths to test, returns the first
// Given a module name, and a list of paths to test, returns the first
// matching file in the following precedence.
//
// require("a.<ext>")
@ -207,7 +207,7 @@ function toRealPath(requestPath) {
});
}
// given a path, check if the file exists with any of the set extensions
// Given a path, check if the file exists with any of the set extensions
function tryExtensions(p, exts, isMain) {
for (var i = 0; i < exts.length; i++) {
const filename = tryFile(p + exts[i], isMain);
@ -452,7 +452,7 @@ Module._resolveLookupPaths = function(request, parent, newReturn) {
// with --eval, parent.id is not set and parent.filename is null
if (!parent || !parent.id || !parent.filename) {
// make require('./path/to/foo') work - normally the path is taken
// Make require('./path/to/foo') work - normally the path is taken
// from realpath(__filename) but with eval there is no filename
var mainPaths = ['.'].concat(Module._nodeModulePaths('.'), modulePaths);
@ -498,7 +498,7 @@ Module._resolveLookupPaths = function(request, parent, newReturn) {
}
var id = path.resolve(parentIdPath, request);
// make sure require('./path') and require('path') get distinct ids, even
// Make sure require('./path') and require('path') get distinct ids, even
// when called from the toplevel js file
if (parentIdPath === '.' &&
id.indexOf('/') === -1 &&
@ -625,7 +625,7 @@ Module.prototype.load = function(filename) {
const ESMLoader = asyncESM.ESMLoader;
const url = `${pathToFileURL(filename)}`;
const module = ESMLoader.moduleMap.get(url);
// create module entry at load time to snapshot exports correctly
// Create module entry at load time to snapshot exports correctly
const exports = this.exports;
if (module !== undefined) { // called from cjs translator
module.reflect.onReady((reflect) => {

View File

@ -67,7 +67,7 @@ translators.set('cjs', async (url, isMain) => {
}
return createDynamicModule(['default'], url, () => {
debug(`Loading CJSModule ${url}`);
// we don't care about the return val of _load here because Module#load
// We don't care about the return val of _load here because Module#load
// will handle it for us by checking the loader registry and filling the
// exports like above
CJSModule._load(pathname, undefined, isMain);

View File

@ -45,7 +45,7 @@ function isRecoverableError(e, code) {
case 'Unterminated string constant':
const token = this.input.slice(this.lastTokStart, this.pos);
// see https://www.ecma-international.org/ecma-262/#sec-line-terminators
// See https://www.ecma-international.org/ecma-262/#sec-line-terminators
recoverable = /\\(?:\r\n?|\n|\u2028|\u2029)$/.test(token);
}

View File

@ -17,14 +17,14 @@ function destroy(err, cb) {
return this;
}
// we set destroyed to true before firing error callbacks in order
// We set destroyed to true before firing error callbacks in order
// to make it re-entrance safe in case destroy() is called within callbacks
if (this._readableState) {
this._readableState.destroyed = true;
}
// if this is a duplex stream mark the writable part as destroyed as well
// If this is a duplex stream mark the writable part as destroyed as well
if (this._writableState) {
this._writableState.destroyed = true;
}

View File

@ -123,7 +123,7 @@ function setUnrefTimeout(callback, after, arg1, arg2, arg3) {
default:
args = [arg1, arg2, arg3];
for (i = 5; i < arguments.length; i++) {
// extend array dynamically, makes .apply run much faster in v6.0.0
// Extend array dynamically, makes .apply run much faster in v6.0.0
args[i - 2] = arguments[i];
}
break;

View File

@ -209,7 +209,7 @@ function normalizeArgs(args) {
}
// called when creating new Socket, or when re-using a closed Socket
// Called when creating new Socket, or when re-using a closed Socket
function initSocketHandle(self) {
self._undestroy();
self._sockname = null;
@ -1266,10 +1266,10 @@ function setupListenHandle(address, port, addressType, backlog, fd, flags) {
return;
}
// generate connection key, this should be unique to the connection
// Generate connection key, this should be unique to the connection
this._connectionKey = addressType + ':' + address + ':' + port;
// unref the handle if the server was unref'ed prior to listening
// Unref the handle if the server was unref'ed prior to listening
if (this._unref)
this.unref();

View File

@ -357,7 +357,7 @@ Interface.prototype._refreshLine = function() {
// cursor position
var cursorPos = this._getCursorPos();
// first move to the bottom of the current line, based on cursor pos
// First move to the bottom of the current line, based on cursor pos
var prevRows = this.prevRows || 0;
if (prevRows > 0) {
moveCursor(this.output, 0, -prevRows);
@ -445,7 +445,7 @@ Interface.prototype._normalWrite = function(b) {
// got one or more newlines; process into "line" events
var lines = string.split(lineEnding);
// either '' or (conceivably) the unfinished portion of the next line
// Either '' or (conceivably) the unfinished portion of the next line
string = lines.pop();
this._line_buffer = string;
for (var n = 0; n < lines.length; n++)

View File

@ -389,7 +389,7 @@ function unenroll(item) {
}
item[kRefed] = null;
// if active is called later, then we want to make sure not to insert again
// If active is called later, then we want to make sure not to insert again
item._idleTimeout = -1;
}
@ -444,7 +444,7 @@ function setTimeout(callback, after, arg1, arg2, arg3) {
default:
args = [arg1, arg2, arg3];
for (i = 5; i < arguments.length; i++) {
// extend array dynamically, makes .apply run much faster in v6.0.0
// Extend array dynamically, makes .apply run much faster in v6.0.0
args[i - 2] = arguments[i];
}
break;
@ -493,7 +493,7 @@ exports.setInterval = function setInterval(callback, repeat, arg1, arg2, arg3) {
default:
args = [arg1, arg2, arg3];
for (i = 5; i < arguments.length; i++) {
// extend array dynamically, makes .apply run much faster in v6.0.0
// Extend array dynamically, makes .apply run much faster in v6.0.0
args[i - 2] = arguments[i];
}
break;
@ -712,7 +712,7 @@ function setImmediate(callback, arg1, arg2, arg3) {
default:
args = [arg1, arg2, arg3];
for (i = 4; i < arguments.length; i++) {
// extend array dynamically, makes .apply run much faster in v6.0.0
// Extend array dynamically, makes .apply run much faster in v6.0.0
args[i - 1] = arguments[i];
}
break;

View File

@ -461,7 +461,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
this.path = p + s;
}
// finally, reconstruct the href based on what has been validated.
// Finally, reconstruct the href based on what has been validated.
this.href = this.format();
return this;
};
@ -629,7 +629,7 @@ Url.prototype.format = function format() {
pathname = newPathname;
}
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
// Only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
// unless they had them to begin with.
if (this.slashes || slashedProtocol.has(protocol)) {
if (this.slashes || host) {
@ -686,7 +686,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
// even href="" will remove it.
result.hash = relative.hash;
// if the relative url is empty, then there's nothing left to do here.
// If the relative url is empty, then there's nothing left to do here.
if (relative.href === '') {
result.href = result.format();
return result;
@ -888,7 +888,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
}
}
// if the path is allowed to go above the root, restore leading ..s
// If the path is allowed to go above the root, restore leading ..s
if (!mustEndAbs && !removeAllDots) {
while (up--) {
srcPath.unshift('..');

View File

@ -292,7 +292,7 @@ function timestamp() {
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
// Log is just a thin wrapper to console.log that prepends a timestamp
function log() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
}

View File

@ -510,7 +510,7 @@ function processChunkSync(self, chunk, flushFlag) {
assert(have === 0, 'have should not go down');
}
// exhausted the output buffer, or used all the input create a new one.
// Exhausted the output buffer, or used all the input create a new one.
if (availOutAfter === 0 || offset >= chunkSize) {
availOutBefore = chunkSize;
offset = 0;
@ -599,7 +599,7 @@ function processCallback() {
return;
}
// exhausted the output buffer, or used all the input create a new one.
// Exhausted the output buffer, or used all the input create a new one.
if (availOutAfter === 0 || self._outOffset >= self._chunkSize) {
handle.availOutBefore = self._chunkSize;
self._outOffset = 0;

View File

@ -10,7 +10,7 @@ if (process.argv[2] === 'child') {
const stderr = child.stderr.toString();
assert.strictEqual(child.stdout.toString(), '');
// stderr will be empty for systems that don't support backtraces.
// Stderr will be empty for systems that don't support backtraces.
if (stderr !== '') {
const frames = stderr.trimRight().split('\n').map((s) => s.trim());

View File

@ -14,7 +14,7 @@ const util = require('util');
const sleep = util.promisify(setTimeout);
// either 'inited' or 'resolved'
const promisesInitState = new Map();
// either 'before' or 'after' AND asyncId must be present in the other map
// Either 'before' or 'after' AND asyncId must be present in the other map
const promisesExecutionState = new Map();
const hooks = initHooks({

View File

@ -14,7 +14,7 @@ if (process.argv[2] === 'child') {
const hooks = initHooks();
hooks.enable();
// once 'destroy' has been emitted, we can no longer emit 'after'
// Once 'destroy' has been emitted, we can no longer emit 'after'
// Emitting 'before', 'after' and then 'destroy'
const event1 = new AsyncResource('event1', async_hooks.executionAsyncId());

View File

@ -14,7 +14,7 @@ if (process.argv[2] === 'child') {
const hooks = initHooks();
hooks.enable();
// once 'destroy' has been emitted, we can no longer emit 'before'
// Once 'destroy' has been emitted, we can no longer emit 'before'
// Emitting 'before', 'after' and then 'destroy'
const event1 = new AsyncResource('event1', async_hooks.executionAsyncId());

View File

@ -14,7 +14,7 @@ if (process.argv[2] === 'child') {
const hooks = initHooks();
hooks.enable();
// async hooks enforce proper order of 'before' and 'after' invocations
// Async hooks enforce proper order of 'before' and 'after' invocations
// Proper ordering
const event1 = new AsyncResource('event1', async_hooks.executionAsyncId());

View File

@ -29,13 +29,13 @@ assert.strictEqual(
async_hooks.executionAsyncId()
);
// create first custom event 'alcazares' with triggerAsyncId derived
// Create first custom event 'alcazares' with triggerAsyncId derived
// from async_hooks executionAsyncId
const alcaTriggerId = async_hooks.executionAsyncId();
const alcaEvent = new AsyncResource('alcazares', alcaTriggerId);
const alcazaresActivities = hooks.activitiesOfTypes([ 'alcazares' ]);
// alcazares event was constructed and thus only has an `init` call
// Alcazares event was constructed and thus only has an `init` call
assert.strictEqual(alcazaresActivities.length, 1);
const alcazares = alcazaresActivities[0];
assert.strictEqual(alcazares.type, 'alcazares');
@ -83,7 +83,7 @@ function tick1() {
checkInvocations(poblado, { init: 1, before: 1, after: 1 },
'poblado emitted after');
// after we disable the hooks we shouldn't receive any events anymore
// After we disable the hooks we shouldn't receive any events anymore
hooks.disable();
alcaEvent.emitDestroy();
tick(1, common.mustCall(tick2));

View File

@ -261,7 +261,7 @@ function onexit() {
'hook2Second: when process exits');
checkInvocations(hook3First, { init: 1, before: 1, after: 1, destroy: 1 },
'hook3First: when process exits');
// we don't see a "destroy" invocation here since hook3 disabled itself
// We don't see a "destroy" invocation here since hook3 disabled itself
// during its "after" invocation
checkInvocations(hook3Second, { init: 1, before: 1, after: 1 },
'hook3Second: when process exits');

View File

@ -32,7 +32,7 @@ function onread() {
checkInvocations(as[2], { init: 1, before: 1, after: 1, destroy: 1 },
'reqwrap[2]: while in onread callback');
// this callback is called from within the last fs req callback therefore
// This callback is called from within the last fs req callback therefore
// the last req is still going and after/destroy haven't been called yet
checkInvocations(as[3], { init: 1, before: 1 },
'reqwrap[3]: while in onread callback');

View File

@ -53,7 +53,7 @@ function onlisten() {
const awaitOnconnectCalls = new Set(['server', 'client']);
function maybeOnconnect(source) {
// both server and client must call onconnect. On most OS's waiting for
// Both server and client must call onconnect. On most OS's waiting for
// the client is sufficient, but on CentOS 5 the sever needs to respond too.
assert.ok(awaitOnconnectCalls.size > 0);
awaitOnconnectCalls.delete(source);

View File

@ -22,7 +22,7 @@ nodeVersionSpawn
.on('exit', common.mustCall(onsleepExit))
.on('close', common.mustCall(onsleepClose));
// a process wrap and 3 pipe wraps for std{in,out,err} are initialized
// A process wrap and 3 pipe wraps for std{in,out,err} are initialized
// synchronously
const processes = hooks.activitiesOfTypes('PROCESSWRAP');
const pipes = hooks.activitiesOfTypes('PIPEWRAP');

View File

@ -32,7 +32,7 @@ process.on('exit', function onexit() {
const a0 = as[0];
assert.strictEqual(a0.type, 'PROMISE');
assert.strictEqual(typeof a0.uid, 'number');
// we can't get the asyncId from the parent dynamically, since init was
// We can't get the asyncId from the parent dynamically, since init was
// never called. However, it is known that the parent promise was created
// immediately before the child promise, thus there should only be one
// difference in id.

View File

@ -92,7 +92,7 @@ function onexit() {
checkInvocations(
signal1, { init: 1, before: 2, after: 2, destroy: 1 },
'signal1: when second SIGUSR2 process exits');
// second signal not destroyed yet since its event listener is still active
// Second signal not destroyed yet since its event listener is still active
checkInvocations(
signal2, { init: 1, before: 1, after: 1 },
'signal2: when second SIGUSR2 process exits');

View File

@ -336,7 +336,7 @@ function _mustCallInner(fn, criteria = 1, field) {
name: fn.name || '<anonymous>'
};
// add the exit listener only once to avoid listener leak warnings
// Add the exit listener only once to avoid listener leak warnings
if (mustCallChecks.length === 0) process.on('exit', runCallChecks);
mustCallChecks.push(context);
@ -392,7 +392,7 @@ function getCallSite(top) {
`${stack[0].getFileName()}:${stack[0].getLineNumber()}`;
const err = new Error();
Error.captureStackTrace(err, top);
// with the V8 Error API, the stack is not formatted until it is accessed
// With the V8 Error API, the stack is not formatted until it is accessed
err.stack;
Error.prepareStackTrace = originalStackFormatter;
return err.stack;
@ -507,7 +507,7 @@ function expectWarningByMap(warningMap) {
process.on('warning', (warning) => catchWarning[warning.name](warning));
}
// accepts a warning name and description or array of descriptions or a map
// Accepts a warning name and description or array of descriptions or a map
// of warning names to description(s)
// ensures a warning is generated for each name/description pair
function expectWarning(nameOrMap, expected, code) {

View File

@ -35,7 +35,7 @@ try {
}
function doTest(flags, done) {
// invoke the main file via a symlink. In this case --preserve-symlinks-main
// Invoke the main file via a symlink. In this case --preserve-symlinks-main
// dictates that it'll resolve relative imports in the main file relative to
// the symlink, and not relative to the symlink target; the file structure set
// up above requires this to not crash when loading ./submodule_link.js

View File

@ -48,7 +48,7 @@ assert.strictEqual(test_general.testGetVersion(), 3);
assert.strictEqual(test_general.testNapiTypeof(val), typeof val);
});
// since typeof in js return object need to validate specific case
// Since typeof in js return object need to validate specific case
// for null
assert.strictEqual(test_general.testNapiTypeof(null), 'null');

View File

@ -49,7 +49,7 @@ testUint32(4294967296, 0);
testUint32(4294967297, 1);
testUint32(17 * 4294967296 + 1, 1);
// validate documented behavior when value is retrieved as 32-bit integer with
// Validate documented behavior when value is retrieved as 32-bit integer with
// `napi_get_value_int32`
function testInt32(input, expected = input) {
assert.strictEqual(expected, test_number.TestInt32Truncation(input));
@ -92,7 +92,7 @@ testInt32(Number.POSITIVE_INFINITY, 0);
testInt32(Number.NEGATIVE_INFINITY, 0);
testInt32(Number.NaN, 0);
// validate documented behavior when value is retrieved as 64-bit integer with
// Validate documented behavior when value is retrieved as 64-bit integer with
// `napi_get_value_int64`
function testInt64(input, expected = input) {
assert.strictEqual(expected, test_number.TestInt64Truncation(input));

View File

@ -45,7 +45,7 @@ if (cluster.isMaster) {
// worker code
process.on('message', (msg) => msg === BYE && process.exit(0));
// first worker will bind to '0', second will try the assigned port and fail
// First worker will bind to '0', second will try the assigned port and fail
const PRT1 = process.env.PRT1 || 0;
const socket1 = dgram.createSocket('udp4', () => {});
socket1.on('error', PRT1 === 0 ? () => {} : assert.fail);

View File

@ -36,7 +36,7 @@ const keepAliveAgent = new http.Agent({
const countdown = new Countdown(N, () => {
server.close(() => {
// give the server sockets time to close (which will also free their
// Give the server sockets time to close (which will also free their
// associated parser objects) after the server has been closed.
setTimeout(() => {
createdIds.forEach((createdAsyncId) => {

View File

@ -106,7 +106,7 @@ b.copy(Buffer.alloc(1), 1, 1, 1);
// try to copy 0 bytes from past the end of the source buffer
b.copy(Buffer.alloc(1), 0, 2048, 2048);
// testing for smart defaults and ability to pass string values as offset
// Testing for smart defaults and ability to pass string values as offset
{
const writeTest = Buffer.from('abcdes');
writeTest.write('n', 'ascii');
@ -799,7 +799,7 @@ common.expectsError(
outOfRangeError
);
// attempt to overflow buffers, similar to previous bug in array buffers
// Attempt to overflow buffers, similar to previous bug in array buffers
common.expectsError(
() => Buffer.allocUnsafe(8).writeFloatLE(0.0, 0xffffffff),
outOfRangeError

View File

@ -54,7 +54,7 @@ assert.strictEqual(a.compare(b, 0, { valueOf: () => 5 }), -1);
// zero length target
assert.strictEqual(a.compare(b, Infinity, -Infinity), 1);
// zero length target because default for targetEnd <= targetSource
// Zero length target because default for targetEnd <= targetSource
assert.strictEqual(a.compare(b, '0xff'), 1);
const oor = common.expectsError({ code: 'ERR_OUT_OF_RANGE' }, 7);

View File

@ -108,7 +108,7 @@ common.expectsError(
errorProperty);
{
// check sourceEnd resets to targetEnd if former is greater than the latter
// Check sourceEnd resets to targetEnd if former is greater than the latter
b.fill(++cntr);
c.fill(++cntr);
b.copy(c, 0, 0, 1025);

View File

@ -13,22 +13,22 @@ function read(buff, funx, args, expected) {
);
}
// testing basic functionality of readDoubleBE() and readDoubleLE()
// Testing basic functionality of readDoubleBE() and readDoubleLE()
read(buf, 'readDoubleBE', [1], -3.1827727774563287e+295);
read(buf, 'readDoubleLE', [1], -6.966010051009108e+144);
// testing basic functionality of readFloatBE() and readFloatLE()
// Testing basic functionality of readFloatBE() and readFloatLE()
read(buf, 'readFloatBE', [1], -1.6691549692541768e+37);
read(buf, 'readFloatLE', [1], -7861303808);
// testing basic functionality of readInt8()
read(buf, 'readInt8', [1], -3);
// testing basic functionality of readInt16BE() and readInt16LE()
// Testing basic functionality of readInt16BE() and readInt16LE()
read(buf, 'readInt16BE', [1], -696);
read(buf, 'readInt16LE', [1], 0x48fd);
// testing basic functionality of readInt32BE() and readInt32LE()
// Testing basic functionality of readInt32BE() and readInt32LE()
read(buf, 'readInt32BE', [1], -45552945);
read(buf, 'readInt32LE', [1], -806729475);
@ -39,11 +39,11 @@ read(buf, 'readIntLE', [2, 1], 0x48);
// testing basic functionality of readUInt8()
read(buf, 'readUInt8', [1], 0xfd);
// testing basic functionality of readUInt16BE() and readUInt16LE()
// Testing basic functionality of readUInt16BE() and readUInt16LE()
read(buf, 'readUInt16BE', [2], 0x48ea);
read(buf, 'readUInt16LE', [2], 0xea48);
// testing basic functionality of readUInt32BE() and readUInt32LE()
// Testing basic functionality of readUInt32BE() and readUInt32LE()
read(buf, 'readUInt32BE', [1], 0xfd48eacf);
read(buf, 'readUInt32LE', [1], 0xcfea48fd);

View File

@ -35,7 +35,7 @@ assert.strictEqual(rangeBuffer.toString('ascii', undefined, 3), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', false, 3), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', '', 3), 'abc');
// but, if start is an integer when coerced, then it will be coerced and used.
// But, if start is an integer when coerced, then it will be coerced and used.
assert.strictEqual(rangeBuffer.toString('ascii', '-1', 3), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', '1', 3), 'bc');
assert.strictEqual(rangeBuffer.toString('ascii', '-Infinity', 3), 'abc');
@ -47,7 +47,7 @@ assert.strictEqual(rangeBuffer.toString('ascii', '-1.99', 3), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', 1.99, 3), 'bc');
assert.strictEqual(rangeBuffer.toString('ascii', true, 3), 'bc');
// if end > buffer's length, end will be taken as buffer's length
// If end > buffer's length, end will be taken as buffer's length
assert.strictEqual(rangeBuffer.toString('ascii', 0, 5), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', 0, 6.99), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', 0, Infinity), 'abc');
@ -55,7 +55,7 @@ assert.strictEqual(rangeBuffer.toString('ascii', 0, '5'), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', 0, '6.99'), 'abc');
assert.strictEqual(rangeBuffer.toString('ascii', 0, 'Infinity'), 'abc');
// if end is an invalid integer, end will be taken as buffer's length
// If end is an invalid integer, end will be taken as buffer's length
assert.strictEqual(rangeBuffer.toString('ascii', 0, 'node.js'), '');
assert.strictEqual(rangeBuffer.toString('ascii', 0, {}), '');
assert.strictEqual(rangeBuffer.toString('ascii', 0, NaN), '');
@ -66,7 +66,7 @@ assert.strictEqual(rangeBuffer.toString('ascii', 0, []), '');
assert.strictEqual(rangeBuffer.toString('ascii', 0, false), '');
assert.strictEqual(rangeBuffer.toString('ascii', 0, ''), '');
// but, if end is an integer when coerced, then it will be coerced and used.
// But, if end is an integer when coerced, then it will be coerced and used.
assert.strictEqual(rangeBuffer.toString('ascii', 0, '-1'), '');
assert.strictEqual(rangeBuffer.toString('ascii', 0, '1'), 'a');
assert.strictEqual(rangeBuffer.toString('ascii', 0, '-Infinity'), '');

View File

@ -91,7 +91,7 @@ const s = 'string';
const u = undefined;
const n = null;
// function spawn(file=f [,args=a] [, options=o]) has valid combinations:
// Function spawn(file=f [,args=a] [, options=o]) has valid combinations:
// (f)
// (f, a)
// (f, a, o)

View File

@ -45,7 +45,7 @@ if (process.argv[2] === 'child') {
assert.fail(`Unexpected parent stderr: ${data}`);
});
// check if we receive both 'hello' at start and 'goodbye' at end
// Check if we receive both 'hello' at start and 'goodbye' at end
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(data) {
stdout += data;

View File

@ -62,7 +62,7 @@ execs.forEach((v, i) => {
}, i * 100);
});
// cluster emits 'setup' asynchronously, so we must stay alive long
// Cluster emits 'setup' asynchronously, so we must stay alive long
// enough for that to happen
setTimeout(() => {
console.log('cluster setup complete');

View File

@ -26,7 +26,7 @@ const cluster = require('cluster');
const SENTINEL = 42;
// workers forcibly exit when control channel is disconnected, if
// Workers forcibly exit when control channel is disconnected, if
// their .exitedAfterDisconnect flag isn't set
//
// test this by:

View File

@ -30,7 +30,7 @@ let success;
let worker;
let server;
// workers do not exit on disconnect, they exit under normal node rules: when
// Workers do not exit on disconnect, they exit under normal node rules: when
// they have nothing keeping their loop alive, like an active connection
//
// test this by:

View File

@ -174,7 +174,7 @@ console.timeEnd();
console.time(NaN);
console.timeEnd(NaN);
// make sure calling time twice without timeEnd doesn't reset the timer.
// Make sure calling time twice without timeEnd doesn't reset the timer.
console.time('test');
const time = console._times.get('test');
setTimeout(() => {
@ -248,7 +248,7 @@ assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^constructor: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^hasOwnProperty: \d+\.\d{3}ms$/.test(strings.shift().trim()));
// verify that console.time() coerces label values to strings as expected
// Verify that console.time() coerces label values to strings as expected
assert.ok(/^: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^\[object Object\]: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^\[object Object\]: \d+\.\d{3}ms$/.test(strings.shift().trim()));

View File

@ -122,7 +122,7 @@ for (const test of TEST_CASES) {
hex += encrypt.final('hex');
const auth_tag = encrypt.getAuthTag();
// only test basic encryption run if output is marked as tampered.
// Only test basic encryption run if output is marked as tampered.
if (!test.tampered) {
assert.strictEqual(hex, test.ct);
assert.strictEqual(auth_tag.toString('hex'), test.tag);
@ -170,7 +170,7 @@ for (const test of TEST_CASES) {
let hex = encrypt.update(test.plain, 'ascii', 'hex');
hex += encrypt.final('hex');
const auth_tag = encrypt.getAuthTag();
// only test basic encryption run if output is marked as tampered.
// Only test basic encryption run if output is marked as tampered.
if (!test.tampered) {
assert.strictEqual(hex, test.ct);
assert.strictEqual(auth_tag.toString('hex'), test.tag);

View File

@ -21,7 +21,7 @@
'use strict';
const common = require('../common');
// skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface
// Skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface
if (common.inFreeBSDJail)
common.skip('In a FreeBSD jail');

View File

@ -92,7 +92,7 @@ source.on('close', function() {
if (process.env.BOUND === 'y') {
source.bind(0);
} else {
// cluster doesn't know about exclusive sockets, so it won't close them. This
// Cluster doesn't know about exclusive sockets, so it won't close them. This
// is expected, its the same situation for timers, outgoing tcp connections,
// etc, which also keep workers alive after disconnect was requested.
source.unref();

View File

@ -23,7 +23,7 @@
const common = require('../common');
const dgram = require('dgram');
// should not hang, see https://github.com/nodejs/node-v0.x-archive/issues/1282
// Should not hang, see https://github.com/nodejs/node-v0.x-archive/issues/1282
dgram.createSocket('udp4');
dgram.createSocket('udp6');

View File

@ -33,7 +33,7 @@ common.allowGlobals(require('domain'));
// See https://github.com/nodejs/node/commit/d1eff9ab
global.domain = require('domain');
// should not throw a 'TypeError: undefined is not a function' exception
// Should not throw a 'TypeError: undefined is not a function' exception
crypto.randomBytes(8);
crypto.randomBytes(8, common.mustCall());
const buf = Buffer.alloc(8);

View File

@ -25,7 +25,7 @@
require('../common');
const assert = require('assert');
// timeouts call the callback directly from cc, so need to make sure the
// Timeouts call the callback directly from cc, so need to make sure the
// domain will be used regardless
setTimeout(() => {
const domain = require('domain');

View File

@ -88,7 +88,7 @@ const events = require('events');
assert.ok(e._events.fortytwo.hasOwnProperty('warned'));
}
// but _maxListeners still has precedence over defaultMaxListeners
// But _maxListeners still has precedence over defaultMaxListeners
{
events.EventEmitter.defaultMaxListeners = 42;
const e = new events.EventEmitter();

View File

@ -3,7 +3,7 @@ require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
// spawn a node child process in "interactive" mode (force the repl) and eval
// Spawn a node child process in "interactive" mode (force the repl) and eval
const cp = spawn(process.execPath, ['-i', '-e', 'console.log("42")']);
let gotToEnd = false;

View File

@ -42,7 +42,7 @@ tmpdir.refresh();
const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
// test that empty file will be created and have content added (callback API)
// Test that empty file will be created and have content added (callback API)
{
const filename = join(tmpdir.path, 'append.txt');
@ -56,7 +56,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
}));
}
// test that empty file will be created and have content added (promise API)
// Test that empty file will be created and have content added (promise API)
{
const filename = join(tmpdir.path, 'append-promise.txt');

View File

@ -13,7 +13,7 @@ const fs = require('fs');
{
const s = fs.createReadStream(__filename);
// this is a private API, but it is worth testing. close calls this
// This is a private API, but it is worth testing. close calls this
s.destroy(null, common.mustCall());
s.destroy(null, common.mustCall());
}

View File

@ -251,7 +251,7 @@ function test_relative_input_cwd(realpath, realpathSync, callback) {
return callback();
}
// we need to calculate the relative path to the tmp dir from cwd
// We need to calculate the relative path to the tmp dir from cwd
const entrydir = process.cwd();
const entry = path.relative(entrydir,
path.join(`${tmpDir}/cycles/realpath-3a`));

View File

@ -27,7 +27,7 @@ const fs = require('fs');
const { internalBinding } = require('internal/test/binding');
const { UV_EBADF } = internalBinding('uv');
// ensure that (read|write|append)FileSync() closes the file descriptor
// Ensure that (read|write|append)FileSync() closes the file descriptor
fs.openSync = function() {
return 42;
};

View File

@ -186,7 +186,7 @@ process.on('exit', () => {
const path = `${tmpdir.path}/test-utimes-precision`;
fs.writeFileSync(path, '');
// test Y2K38 for all platforms [except 'arm', 'OpenBSD' and 'SunOS']
// Test Y2K38 for all platforms [except 'arm', 'OpenBSD' and 'SunOS']
if (!process.arch.includes('arm') && !common.isOpenBSD && !common.isSunOS) {
// because 2 ** 31 doesn't look right
// eslint-disable-next-line space-infix-ops

View File

@ -35,7 +35,7 @@ const stream = fs.WriteStream(file);
const _fs_close = fs.close;
const _fs_open = fs.open;
// change the fs.open with an identical function after the WriteStream
// Change the fs.open with an identical function after the WriteStream
// has pushed it onto its internal action queue, but before it's
// returned. This simulates AOP-style extension of the fs lib.
fs.open = function() {

View File

@ -13,7 +13,7 @@ const snapshotNode = {
]
};
// starts with no JSBindingsConnection (or 1 if coverage enabled).
// Starts with no JSBindingsConnection (or 1 if coverage enabled).
{
const expected = [];
if (process.env.NODE_V8_COVERAGE) {

View File

@ -23,7 +23,7 @@
const common = require('../common');
const http = require('http');
// sending `agent: false` when `port: null` is also passed in (i.e. the result
// Sending `agent: false` when `port: null` is also passed in (i.e. the result
// of a `url.parse()` call with the default port used, 80 or 443), should not
// result in an assertion error...
const opts = {
@ -34,7 +34,7 @@ const opts = {
agent: false
};
// we just want an "error" (no local HTTP server on port 80) or "response"
// We just want an "error" (no local HTTP server on port 80) or "response"
// to happen (user happens ot have HTTP server running on port 80).
// As long as the process doesn't crash from a C++ assertion then we're good.
const req = http.request(opts);

View File

@ -29,7 +29,7 @@ const server = http.createServer(common.mustCall((req, res) => {
})).listen(0, '127.0.0.1', common.mustCall(() => {
const opts = url.parse(`http://127.0.0.1:${server.address().port}/`);
// remove the `protocol` field… the `http` module should fall back
// Remove the `protocol` field… the `http` module should fall back
// to "http:", as defined by the global, default `http.Agent` instance.
opts.agent = new http.Agent();
opts.agent.protocol = null;

View File

@ -39,7 +39,7 @@ function execute(options) {
});
}
// should be the same except for implicit Host header on the first two
// Should be the same except for implicit Host header on the first two
execute({ headers: { 'x-foo': 'boom', 'cookie': 'a=1; b=2; c=3' } });
execute({ headers: { 'x-foo': 'boom', 'cookie': [ 'a=1', 'b=2', 'c=3' ] } });
execute({ headers: [[ 'x-foo', 'boom' ], [ 'cookie', 'a=1; b=2; c=3' ]] });

View File

@ -31,7 +31,7 @@ const options = {
};
process.env.NODE_DEBUG = 'http';
// start a tcp server that closes incoming connections immediately
// Start a tcp server that closes incoming connections immediately
const server = net.createServer(function(client) {
client.destroy();
server.close();

View File

@ -5,7 +5,7 @@ const { OutgoingMessage } = require('http');
const { Writable } = require('stream');
const assert = require('assert');
// check that OutgoingMessage can be used without a proper Socket
// Check that OutgoingMessage can be used without a proper Socket
// Fixes: https://github.com/nodejs/node/issues/14386
// Fixes: https://github.com/nodejs/node/issues/14381

View File

@ -26,7 +26,7 @@ const assert = require('assert');
const http = require('http');
const server = http.createServer(function(request, response) {
// removed headers should stay removed, even if node automatically adds them
// Removed headers should stay removed, even if node automatically adds them
// to the output:
response.removeHeader('connection');
response.removeHeader('transfer-encoding');

View File

@ -41,7 +41,7 @@ const server = http.createServer(function(request, response) {
server.listen(0, function() {
const testURL =
url.parse(`http://asdf:qwer@localhost:${this.address().port}`);
// the test here is if you set a specific authorization header in the
// The test here is if you set a specific authorization header in the
// request we should not override that with basic auth
testURL.headers = {
Authorization: 'NoAuthForYOU'

View File

@ -65,7 +65,7 @@ const tests = specificTests.concat(genericTests);
let currentError;
// mock submitRequest because we only care about testing error handling
// Mock submitRequest because we only care about testing error handling
Http2Session.prototype.request = () => currentError;
const server = http2.createServer(common.mustNotCall());

View File

@ -37,7 +37,7 @@ server.listen(0, common.mustCall(() => {
}
);
// should throw if something other than number is passed to setNextStreamID
// Should throw if something other than number is passed to setNextStreamID
Object.entries(types).forEach(([type, value]) => {
if (type === 'number') {
return;

View File

@ -6,7 +6,7 @@ if (!common.hasCrypto)
const assert = require('assert');
const h2 = require('http2');
// makes sure that Http2ServerResponse setHeader & removeHeader, do not throw
// Makes sure that Http2ServerResponse setHeader & removeHeader, do not throw
// any errors if the stream was destroyed before headers were sent
const server = h2.createServer();

Some files were not shown because too many files have changed in this diff Show More