mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
tools: enable no-else-return lint rule
Refs: https://github.com/nodejs/node/pull/32644 Refs: https://github.com/nodejs/node/pull/32662 PR-URL: https://github.com/nodejs/node/pull/32667 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
1cb80d1e05
commit
b533fb3508
42 changed files with 161 additions and 217 deletions
|
@ -129,6 +129,7 @@ module.exports = {
|
||||||
'no-dupe-else-if': 'error',
|
'no-dupe-else-if': 'error',
|
||||||
'no-duplicate-case': 'error',
|
'no-duplicate-case': 'error',
|
||||||
'no-duplicate-imports': 'error',
|
'no-duplicate-imports': 'error',
|
||||||
|
'no-else-return': ['error', { allowElseIf: true }],
|
||||||
'no-empty-character-class': 'error',
|
'no-empty-character-class': 'error',
|
||||||
'no-ex-assign': 'error',
|
'no-ex-assign': 'error',
|
||||||
'no-extra-boolean-cast': 'error',
|
'no-extra-boolean-cast': 'error',
|
||||||
|
|
|
@ -16,11 +16,10 @@ function makeTest(count, rest) {
|
||||||
return function test(...args) {
|
return function test(...args) {
|
||||||
assert.strictEqual(count, args.length);
|
assert.strictEqual(count, args.length);
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
return function test() {
|
|
||||||
assert.strictEqual(count, arguments.length);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return function test() {
|
||||||
|
assert.strictEqual(count, arguments.length);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function main({ n, context, count, rest, method }) {
|
function main({ n, context, count, rest, method }) {
|
||||||
|
|
|
@ -30,9 +30,8 @@ let printHeader = true;
|
||||||
function csvEncodeValue(value) {
|
function csvEncodeValue(value) {
|
||||||
if (typeof value === 'number') {
|
if (typeof value === 'number') {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
} else {
|
|
||||||
return `"${value.replace(/"/g, '""')}"`;
|
|
||||||
}
|
}
|
||||||
|
return `"${value.replace(/"/g, '""')}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
(function recursive(i) {
|
(function recursive(i) {
|
||||||
|
|
|
@ -249,9 +249,8 @@ function matchKnownFields(field, lowercased) {
|
||||||
}
|
}
|
||||||
if (lowercased) {
|
if (lowercased) {
|
||||||
return '\u0000' + field;
|
return '\u0000' + field;
|
||||||
} else {
|
|
||||||
return matchKnownFields(field.toLowerCase(), true);
|
|
||||||
}
|
}
|
||||||
|
return matchKnownFields(field.toLowerCase(), true);
|
||||||
}
|
}
|
||||||
// Add the given (field, value) pair to the message
|
// Add the given (field, value) pair to the message
|
||||||
//
|
//
|
||||||
|
|
|
@ -375,8 +375,7 @@ function howMuchToRead(n, state) {
|
||||||
// Only flow one buffer at a time.
|
// Only flow one buffer at a time.
|
||||||
if (state.flowing && state.length)
|
if (state.flowing && state.length)
|
||||||
return state.buffer.first().length;
|
return state.buffer.first().length;
|
||||||
else
|
return state.length;
|
||||||
return state.length;
|
|
||||||
}
|
}
|
||||||
if (n <= state.length)
|
if (n <= state.length)
|
||||||
return n;
|
return n;
|
||||||
|
|
|
@ -304,10 +304,9 @@ Writable.prototype.write = function(chunk, encoding, cb) {
|
||||||
process.nextTick(cb, err);
|
process.nextTick(cb, err);
|
||||||
errorOrDestroy(this, err, true);
|
errorOrDestroy(this, err, true);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
state.pendingcb++;
|
|
||||||
return writeOrBuffer(this, state, chunk, encoding, cb);
|
|
||||||
}
|
}
|
||||||
|
state.pendingcb++;
|
||||||
|
return writeOrBuffer(this, state, chunk, encoding, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
Writable.prototype.cork = function() {
|
Writable.prototype.cork = function() {
|
||||||
|
|
|
@ -1503,13 +1503,12 @@ function onConnectSecure() {
|
||||||
if (options.rejectUnauthorized) {
|
if (options.rejectUnauthorized) {
|
||||||
this.destroy(verifyError);
|
this.destroy(verifyError);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
debug('client emit secureConnect. rejectUnauthorized: %s, ' +
|
|
||||||
'authorizationError: %s', options.rejectUnauthorized,
|
|
||||||
this.authorizationError);
|
|
||||||
this.secureConnecting = false;
|
|
||||||
this.emit('secureConnect');
|
|
||||||
}
|
}
|
||||||
|
debug('client emit secureConnect. rejectUnauthorized: %s, ' +
|
||||||
|
'authorizationError: %s', options.rejectUnauthorized,
|
||||||
|
this.authorizationError);
|
||||||
|
this.secureConnecting = false;
|
||||||
|
this.emit('secureConnect');
|
||||||
} else {
|
} else {
|
||||||
this.authorized = true;
|
this.authorized = true;
|
||||||
debug('client emit secureConnect. authorized:', this.authorized);
|
debug('client emit secureConnect. authorized:', this.authorized);
|
||||||
|
|
|
@ -261,9 +261,8 @@ function resolve(hostname, rrtype, callback) {
|
||||||
|
|
||||||
if (typeof resolver === 'function') {
|
if (typeof resolver === 'function') {
|
||||||
return resolver.call(this, hostname, callback);
|
return resolver.call(this, hostname, callback);
|
||||||
} else {
|
|
||||||
throw new ERR_INVALID_OPT_VALUE('rrtype', rrtype);
|
|
||||||
}
|
}
|
||||||
|
throw new ERR_INVALID_OPT_VALUE('rrtype', rrtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
function defaultResolverSetServers(servers) {
|
function defaultResolverSetServers(servers) {
|
||||||
|
|
|
@ -577,9 +577,8 @@ EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
||||||
EventEmitter.listenerCount = function(emitter, type) {
|
EventEmitter.listenerCount = function(emitter, type) {
|
||||||
if (typeof emitter.listenerCount === 'function') {
|
if (typeof emitter.listenerCount === 'function') {
|
||||||
return emitter.listenerCount(type);
|
return emitter.listenerCount(type);
|
||||||
} else {
|
|
||||||
return listenerCount.call(emitter, type);
|
|
||||||
}
|
}
|
||||||
|
return listenerCount.call(emitter, type);
|
||||||
};
|
};
|
||||||
|
|
||||||
EventEmitter.prototype.listenerCount = listenerCount;
|
EventEmitter.prototype.listenerCount = listenerCount;
|
||||||
|
|
|
@ -1545,9 +1545,8 @@ function encodeRealpathResult(result, options) {
|
||||||
const asBuffer = Buffer.from(result);
|
const asBuffer = Buffer.from(result);
|
||||||
if (options.encoding === 'buffer') {
|
if (options.encoding === 'buffer') {
|
||||||
return asBuffer;
|
return asBuffer;
|
||||||
} else {
|
|
||||||
return asBuffer.toString(options.encoding);
|
|
||||||
}
|
}
|
||||||
|
return asBuffer.toString(options.encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finds the next portion of a (partial) path, up to the next path delimiter
|
// Finds the next portion of a (partial) path, up to the next path delimiter
|
||||||
|
|
|
@ -277,14 +277,13 @@ function prepareAsymmetricKey(key, ctx) {
|
||||||
const isPublic =
|
const isPublic =
|
||||||
(ctx === kConsumePrivate || ctx === kCreatePrivate) ? false : undefined;
|
(ctx === kConsumePrivate || ctx === kCreatePrivate) ? false : undefined;
|
||||||
return { data, ...parseKeyEncoding(key, undefined, isPublic) };
|
return { data, ...parseKeyEncoding(key, undefined, isPublic) };
|
||||||
} else {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(
|
|
||||||
'key',
|
|
||||||
['string', 'Buffer', 'TypedArray', 'DataView',
|
|
||||||
...(ctx !== kCreatePrivate ? ['KeyObject'] : [])],
|
|
||||||
key
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
throw new ERR_INVALID_ARG_TYPE(
|
||||||
|
'key',
|
||||||
|
['string', 'Buffer', 'TypedArray', 'DataView',
|
||||||
|
...(ctx !== kCreatePrivate ? ['KeyObject'] : [])],
|
||||||
|
key
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function preparePrivateKey(key) {
|
function preparePrivateKey(key) {
|
||||||
|
@ -301,13 +300,12 @@ function prepareSecretKey(key, bufferOnly = false) {
|
||||||
if (key.type !== 'secret')
|
if (key.type !== 'secret')
|
||||||
throw new ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE(key.type, 'secret');
|
throw new ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE(key.type, 'secret');
|
||||||
return key[kHandle];
|
return key[kHandle];
|
||||||
} else {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(
|
|
||||||
'key',
|
|
||||||
['Buffer', 'TypedArray', 'DataView',
|
|
||||||
...(bufferOnly ? [] : ['string', 'KeyObject'])],
|
|
||||||
key);
|
|
||||||
}
|
}
|
||||||
|
throw new ERR_INVALID_ARG_TYPE(
|
||||||
|
'key',
|
||||||
|
['Buffer', 'TypedArray', 'DataView',
|
||||||
|
...(bufferOnly ? [] : ['string', 'KeyObject'])],
|
||||||
|
key);
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,7 @@ function getDSASignatureEncoding(options) {
|
||||||
return kSigEncDER;
|
return kSigEncDER;
|
||||||
else if (dsaEncoding === 'ieee-p1363')
|
else if (dsaEncoding === 'ieee-p1363')
|
||||||
return kSigEncP1363;
|
return kSigEncP1363;
|
||||||
else
|
throw new ERR_INVALID_OPT_VALUE('dsaEncoding', dsaEncoding);
|
||||||
throw new ERR_INVALID_OPT_VALUE('dsaEncoding', dsaEncoding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return kSigEncDER;
|
return kSigEncDER;
|
||||||
|
@ -89,9 +88,8 @@ function getIntOption(name, options) {
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
if (value === value >> 0) {
|
if (value === value >> 0) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
|
||||||
throw new ERR_INVALID_OPT_VALUE(name, value);
|
|
||||||
}
|
}
|
||||||
|
throw new ERR_INVALID_OPT_VALUE(name, value);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1090,10 +1090,9 @@ E('ERR_INVALID_MODULE_SPECIFIER', (pkgPath, subpath, base = undefined) => {
|
||||||
assert(subpath !== '.');
|
assert(subpath !== '.');
|
||||||
return `Package subpath '${subpath}' is not a valid module request for ` +
|
return `Package subpath '${subpath}' is not a valid module request for ` +
|
||||||
`the "exports" resolution of ${pkgPath}${sep}package.json`;
|
`the "exports" resolution of ${pkgPath}${sep}package.json`;
|
||||||
} else {
|
|
||||||
return `Package subpath '${subpath}' is not a valid module request for ` +
|
|
||||||
`the "exports" resolution of ${pkgPath} imported from ${base}`;
|
|
||||||
}
|
}
|
||||||
|
return `Package subpath '${subpath}' is not a valid module request for ` +
|
||||||
|
`the "exports" resolution of ${pkgPath} imported from ${base}`;
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
E('ERR_INVALID_OPT_VALUE', (name, value) =>
|
E('ERR_INVALID_OPT_VALUE', (name, value) =>
|
||||||
`The value "${String(value)}" is invalid for option "${name}"`,
|
`The value "${String(value)}" is invalid for option "${name}"`,
|
||||||
|
@ -1104,8 +1103,7 @@ E('ERR_INVALID_OPT_VALUE_ENCODING',
|
||||||
E('ERR_INVALID_PACKAGE_CONFIG', (path, message, hasMessage = true) => {
|
E('ERR_INVALID_PACKAGE_CONFIG', (path, message, hasMessage = true) => {
|
||||||
if (hasMessage)
|
if (hasMessage)
|
||||||
return `Invalid package config ${path}${sep}package.json, ${message}`;
|
return `Invalid package config ${path}${sep}package.json, ${message}`;
|
||||||
else
|
return `Invalid JSON in ${path} imported from ${message}`;
|
||||||
return `Invalid JSON in ${path} imported from ${message}`;
|
|
||||||
}, Error);
|
}, Error);
|
||||||
E('ERR_INVALID_PACKAGE_TARGET',
|
E('ERR_INVALID_PACKAGE_TARGET',
|
||||||
(pkgPath, key, subpath, target, base = undefined) => {
|
(pkgPath, key, subpath, target, base = undefined) => {
|
||||||
|
@ -1116,11 +1114,10 @@ E('ERR_INVALID_PACKAGE_TARGET',
|
||||||
return `Invalid "exports" target ${JSONStringify(target)} defined ` +
|
return `Invalid "exports" target ${JSONStringify(target)} defined ` +
|
||||||
`for '${subpath}' in the package config ${pkgPath} imported from ` +
|
`for '${subpath}' in the package config ${pkgPath} imported from ` +
|
||||||
`${base}.${relError ? '; targets must start with "./"' : ''}`;
|
`${base}.${relError ? '; targets must start with "./"' : ''}`;
|
||||||
} else {
|
|
||||||
return `Invalid "exports" main target ${target} defined in the ` +
|
|
||||||
`package config ${pkgPath} imported from ${base}${relError ?
|
|
||||||
'; targets must start with "./"' : ''}`;
|
|
||||||
}
|
}
|
||||||
|
return `Invalid "exports" main target ${target} defined in the ` +
|
||||||
|
`package config ${pkgPath} imported from ${base}${relError ?
|
||||||
|
'; targets must start with "./"' : ''}`;
|
||||||
} else if (key === '.') {
|
} else if (key === '.') {
|
||||||
return `Invalid "exports" main target ${JSONStringify(target)} defined ` +
|
return `Invalid "exports" main target ${JSONStringify(target)} defined ` +
|
||||||
`in the package config ${pkgPath}${sep}package.json${relError ?
|
`in the package config ${pkgPath}${sep}package.json${relError ?
|
||||||
|
@ -1130,11 +1127,10 @@ E('ERR_INVALID_PACKAGE_TARGET',
|
||||||
StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` +
|
StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` +
|
||||||
`package config ${pkgPath}${sep}package.json; ` +
|
`package config ${pkgPath}${sep}package.json; ` +
|
||||||
'targets must start with "./"';
|
'targets must start with "./"';
|
||||||
} else {
|
|
||||||
return `Invalid "exports" target ${JSONStringify(target)} defined for '${
|
|
||||||
StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` +
|
|
||||||
`package config ${pkgPath}${sep}package.json`;
|
|
||||||
}
|
}
|
||||||
|
return `Invalid "exports" target ${JSONStringify(target)} defined for '${
|
||||||
|
StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` +
|
||||||
|
`package config ${pkgPath}${sep}package.json`;
|
||||||
}, Error);
|
}, Error);
|
||||||
E('ERR_INVALID_PERFORMANCE_MARK',
|
E('ERR_INVALID_PERFORMANCE_MARK',
|
||||||
'The "%s" performance mark has not been set', Error);
|
'The "%s" performance mark has not been set', Error);
|
||||||
|
@ -1289,10 +1285,9 @@ E('ERR_PACKAGE_PATH_NOT_EXPORTED', (pkgPath, subpath, base = undefined) => {
|
||||||
} else if (base === undefined) {
|
} else if (base === undefined) {
|
||||||
return `Package subpath '${subpath}' is not defined by "exports" in ${
|
return `Package subpath '${subpath}' is not defined by "exports" in ${
|
||||||
pkgPath}${sep}package.json`;
|
pkgPath}${sep}package.json`;
|
||||||
} else {
|
|
||||||
return `Package subpath '${subpath}' is not defined by "exports" in ${
|
|
||||||
pkgPath} imported from ${base}`;
|
|
||||||
}
|
}
|
||||||
|
return `Package subpath '${subpath}' is not defined by "exports" in ${
|
||||||
|
pkgPath} imported from ${base}`;
|
||||||
}, Error);
|
}, Error);
|
||||||
E('ERR_REQUIRE_ESM',
|
E('ERR_REQUIRE_ESM',
|
||||||
(filename, parentPath = null, packageJsonPath = null) => {
|
(filename, parentPath = null, packageJsonPath = null) => {
|
||||||
|
|
|
@ -478,9 +478,8 @@ WriteStream.prototype.close = function(cb) {
|
||||||
if (this.closed) {
|
if (this.closed) {
|
||||||
process.nextTick(cb);
|
process.nextTick(cb);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
this.on('close', cb);
|
|
||||||
}
|
}
|
||||||
|
this.on('close', cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are not autoClosing, we should call
|
// If we are not autoClosing, we should call
|
||||||
|
|
|
@ -301,10 +301,9 @@ function preprocessSymlinkDestination(path, type, linkPath) {
|
||||||
// A relative target is relative to the link's parent directory.
|
// A relative target is relative to the link's parent directory.
|
||||||
path = pathModule.resolve(linkPath, '..', path);
|
path = pathModule.resolve(linkPath, '..', path);
|
||||||
return pathModule.toNamespacedPath(path);
|
return pathModule.toNamespacedPath(path);
|
||||||
} else {
|
|
||||||
// Windows symlinks don't tolerate forward slashes.
|
|
||||||
return ('' + path).replace(/\//g, '\\');
|
|
||||||
}
|
}
|
||||||
|
// Windows symlinks don't tolerate forward slashes.
|
||||||
|
return ('' + path).replace(/\//g, '\\');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor for file stats.
|
// Constructor for file stats.
|
||||||
|
|
|
@ -28,8 +28,7 @@ async function defaultGetSource(url, { format } = {}, defaultGetSource) {
|
||||||
return {
|
return {
|
||||||
source: Buffer.from(body, base64 ? 'base64' : 'utf8')
|
source: Buffer.from(body, base64 ? 'base64' : 'utf8')
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
throw new ERR_INVALID_URL_SCHEME(['file', 'data']);
|
|
||||||
}
|
}
|
||||||
|
throw new ERR_INVALID_URL_SCHEME(['file', 'data']);
|
||||||
}
|
}
|
||||||
exports.defaultGetSource = defaultGetSource;
|
exports.defaultGetSource = defaultGetSource;
|
||||||
|
|
|
@ -455,10 +455,9 @@ function packageMainResolve(packageJSONUrl, packageConfig, base, conditions) {
|
||||||
if (packageConfig.main !== undefined) {
|
if (packageConfig.main !== undefined) {
|
||||||
return finalizeResolution(
|
return finalizeResolution(
|
||||||
new URL(packageConfig.main, packageJSONUrl), base);
|
new URL(packageConfig.main, packageJSONUrl), base);
|
||||||
} else {
|
|
||||||
return finalizeResolution(
|
|
||||||
new URL('index', packageJSONUrl), base);
|
|
||||||
}
|
}
|
||||||
|
return finalizeResolution(
|
||||||
|
new URL('index', packageJSONUrl), base);
|
||||||
}
|
}
|
||||||
return legacyMainResolve(packageJSONUrl, packageConfig);
|
return legacyMainResolve(packageJSONUrl, packageConfig);
|
||||||
}
|
}
|
||||||
|
@ -578,10 +577,9 @@ function packageResolve(specifier, base, conditions) {
|
||||||
} else if (packageSubpath === '') {
|
} else if (packageSubpath === '') {
|
||||||
return packageMainResolve(packageJSONUrl, packageConfig, base,
|
return packageMainResolve(packageJSONUrl, packageConfig, base,
|
||||||
conditions);
|
conditions);
|
||||||
} else {
|
|
||||||
return packageExportsResolve(
|
|
||||||
packageJSONUrl, packageSubpath, packageConfig, base, conditions);
|
|
||||||
}
|
}
|
||||||
|
return packageExportsResolve(
|
||||||
|
packageJSONUrl, packageSubpath, packageConfig, base, conditions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,10 +609,9 @@ function packageResolve(specifier, base, conditions) {
|
||||||
} else if (packageConfig.exports !== undefined) {
|
} else if (packageConfig.exports !== undefined) {
|
||||||
return packageExportsResolve(
|
return packageExportsResolve(
|
||||||
packageJSONUrl, packageSubpath, packageConfig, base, conditions);
|
packageJSONUrl, packageSubpath, packageConfig, base, conditions);
|
||||||
} else {
|
|
||||||
return finalizeResolution(
|
|
||||||
new URL(packageSubpath, packageJSONUrl), base);
|
|
||||||
}
|
}
|
||||||
|
return finalizeResolution(
|
||||||
|
new URL(packageSubpath, packageJSONUrl), base);
|
||||||
// Cross-platform root check.
|
// Cross-platform root check.
|
||||||
} while (packageJSONPath.length !== lastPath.length);
|
} while (packageJSONPath.length !== lastPath.length);
|
||||||
|
|
||||||
|
|
|
@ -145,32 +145,31 @@ class Manifest {
|
||||||
const dependencyRedirectList = (toSpecifier) => {
|
const dependencyRedirectList = (toSpecifier) => {
|
||||||
if (toSpecifier in dependencyMap !== true) {
|
if (toSpecifier in dependencyMap !== true) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
}
|
||||||
const to = dependencyMap[toSpecifier];
|
const to = dependencyMap[toSpecifier];
|
||||||
if (to === true) {
|
if (to === true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (parsedURLs.has(to)) {
|
if (parsedURLs.has(to)) {
|
||||||
return parsedURLs.get(to);
|
return parsedURLs.get(to);
|
||||||
} else if (canBeRequiredByUsers(to)) {
|
} else if (canBeRequiredByUsers(to)) {
|
||||||
const href = `node:${to}`;
|
const href = `node:${to}`;
|
||||||
const resolvedURL = new URL(href);
|
const resolvedURL = new URL(href);
|
||||||
parsedURLs.set(to, resolvedURL);
|
parsedURLs.set(to, resolvedURL);
|
||||||
parsedURLs.set(href, resolvedURL);
|
parsedURLs.set(href, resolvedURL);
|
||||||
return resolvedURL;
|
return resolvedURL;
|
||||||
} else if (RegExpPrototypeTest(kRelativeURLStringPattern, to)) {
|
} else if (RegExpPrototypeTest(kRelativeURLStringPattern, to)) {
|
||||||
const resolvedURL = new URL(to, manifestURL);
|
const resolvedURL = new URL(to, manifestURL);
|
||||||
const href = resourceURL.href;
|
|
||||||
parsedURLs.set(to, resolvedURL);
|
|
||||||
parsedURLs.set(href, resolvedURL);
|
|
||||||
return resolvedURL;
|
|
||||||
}
|
|
||||||
const resolvedURL = new URL(to);
|
|
||||||
const href = resourceURL.href;
|
const href = resourceURL.href;
|
||||||
parsedURLs.set(to, resolvedURL);
|
parsedURLs.set(to, resolvedURL);
|
||||||
parsedURLs.set(href, resolvedURL);
|
parsedURLs.set(href, resolvedURL);
|
||||||
return resolvedURL;
|
return resolvedURL;
|
||||||
}
|
}
|
||||||
|
const resolvedURL = new URL(to);
|
||||||
|
const href = resourceURL.href;
|
||||||
|
parsedURLs.set(to, resolvedURL);
|
||||||
|
parsedURLs.set(href, resolvedURL);
|
||||||
|
return resolvedURL;
|
||||||
};
|
};
|
||||||
dependencies.set(resourceHREF, dependencyRedirectList);
|
dependencies.set(resourceHREF, dependencyRedirectList);
|
||||||
} else if (dependencyMap === true) {
|
} else if (dependencyMap === true) {
|
||||||
|
|
|
@ -196,15 +196,14 @@ class SourceMap {
|
||||||
return {};
|
return {};
|
||||||
} else if (!entry) {
|
} else if (!entry) {
|
||||||
return {};
|
return {};
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
generatedLine: entry[0],
|
|
||||||
generatedColumn: entry[1],
|
|
||||||
originalSource: entry[2],
|
|
||||||
originalLine: entry[3],
|
|
||||||
originalColumn: entry[4]
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
generatedLine: entry[0],
|
||||||
|
generatedColumn: entry[1],
|
||||||
|
originalSource: entry[2],
|
||||||
|
originalLine: entry[3],
|
||||||
|
originalColumn: entry[4]
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -192,9 +192,8 @@ function sourceMapCacheToObject() {
|
||||||
|
|
||||||
if (ObjectKeys(obj).length === 0) {
|
if (ObjectKeys(obj).length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
} else {
|
|
||||||
return obj;
|
|
||||||
}
|
}
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since WeakMap can't be iterated over, we use Module._cache's
|
// Since WeakMap can't be iterated over, we use Module._cache's
|
||||||
|
@ -243,9 +242,8 @@ function findSourceMap(uri, error) {
|
||||||
}
|
}
|
||||||
if (sourceMap && sourceMap.data) {
|
if (sourceMap && sourceMap.data) {
|
||||||
return new SourceMap(sourceMap.data);
|
return new SourceMap(sourceMap.data);
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -107,10 +107,9 @@ function makeAsyncIterable(val) {
|
||||||
} else if (isReadable(val)) {
|
} else if (isReadable(val)) {
|
||||||
// Legacy streams are not Iterable.
|
// Legacy streams are not Iterable.
|
||||||
return fromReadable(val);
|
return fromReadable(val);
|
||||||
} else {
|
|
||||||
throw new ERR_INVALID_ARG_TYPE(
|
|
||||||
'val', ['Readable', 'Iterable', 'AsyncIterable'], val);
|
|
||||||
}
|
}
|
||||||
|
throw new ERR_INVALID_ARG_TYPE(
|
||||||
|
'val', ['Readable', 'Iterable', 'AsyncIterable'], val);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function* fromReadable(val) {
|
async function* fromReadable(val) {
|
||||||
|
|
|
@ -228,9 +228,8 @@ class URLSearchParams {
|
||||||
return `${this.constructor.name} {\n ${output.join(',\n ')} }`;
|
return `${this.constructor.name} {\n ${output.join(',\n ')} }`;
|
||||||
} else if (output.length) {
|
} else if (output.length) {
|
||||||
return `${this.constructor.name} { ${output.join(separator)} }`;
|
return `${this.constructor.name} { ${output.join(separator)} }`;
|
||||||
} else {
|
|
||||||
return `${this.constructor.name} {}`;
|
|
||||||
}
|
}
|
||||||
|
return `${this.constructor.name} {}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1315,16 +1314,15 @@ function getPathFromURLWin32(url) {
|
||||||
// already taken care of that for us. Note that this only
|
// already taken care of that for us. Note that this only
|
||||||
// causes IDNs with an appropriate `xn--` prefix to be decoded.
|
// causes IDNs with an appropriate `xn--` prefix to be decoded.
|
||||||
return `\\\\${domainToUnicode(hostname)}${pathname}`;
|
return `\\\\${domainToUnicode(hostname)}${pathname}`;
|
||||||
} else {
|
|
||||||
// Otherwise, it's a local path that requires a drive letter
|
|
||||||
const letter = pathname.codePointAt(1) | 0x20;
|
|
||||||
const sep = pathname[2];
|
|
||||||
if (letter < CHAR_LOWERCASE_A || letter > CHAR_LOWERCASE_Z || // a..z A..Z
|
|
||||||
(sep !== ':')) {
|
|
||||||
throw new ERR_INVALID_FILE_URL_PATH('must be absolute');
|
|
||||||
}
|
|
||||||
return pathname.slice(1);
|
|
||||||
}
|
}
|
||||||
|
// Otherwise, it's a local path that requires a drive letter
|
||||||
|
const letter = pathname.codePointAt(1) | 0x20;
|
||||||
|
const sep = pathname[2];
|
||||||
|
if (letter < CHAR_LOWERCASE_A || letter > CHAR_LOWERCASE_Z || // a..z A..Z
|
||||||
|
(sep !== ':')) {
|
||||||
|
throw new ERR_INVALID_FILE_URL_PATH('must be absolute');
|
||||||
|
}
|
||||||
|
return pathname.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPathFromURLPosix(url) {
|
function getPathFromURLPosix(url) {
|
||||||
|
|
|
@ -526,9 +526,8 @@ ObjectDefineProperty(Socket.prototype, 'readyState', {
|
||||||
return 'readOnly';
|
return 'readOnly';
|
||||||
} else if (!this.readable && this.writable) {
|
} else if (!this.readable && this.writable) {
|
||||||
return 'writeOnly';
|
return 'writeOnly';
|
||||||
} else {
|
|
||||||
return 'closed';
|
|
||||||
}
|
}
|
||||||
|
return 'closed';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1500,9 +1499,8 @@ Server.prototype.address = function() {
|
||||||
return out;
|
return out;
|
||||||
} else if (this._pipeName) {
|
} else if (this._pipeName) {
|
||||||
return this._pipeName;
|
return this._pipeName;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function onconnection(err, clientHandle) {
|
function onconnection(err, clientHandle) {
|
||||||
|
|
|
@ -786,9 +786,8 @@ function REPLServer(prompt,
|
||||||
self[kBufferedCommandSymbol] += cmd + '\n';
|
self[kBufferedCommandSymbol] += cmd + '\n';
|
||||||
self.displayPrompt();
|
self.displayPrompt();
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
self._domain.emit('error', e.err || e);
|
|
||||||
}
|
}
|
||||||
|
self._domain.emit('error', e.err || e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear buffer if no SyntaxErrors
|
// Clear buffer if no SyntaxErrors
|
||||||
|
|
13
lib/v8.js
13
lib/v8.js
|
@ -240,14 +240,13 @@ class DefaultDeserializer extends Deserializer {
|
||||||
return new ctor(this.buffer.buffer,
|
return new ctor(this.buffer.buffer,
|
||||||
offset,
|
offset,
|
||||||
byteLength / BYTES_PER_ELEMENT);
|
byteLength / BYTES_PER_ELEMENT);
|
||||||
} else {
|
|
||||||
// Copy to an aligned buffer first.
|
|
||||||
const buffer_copy = Buffer.allocUnsafe(byteLength);
|
|
||||||
copy(this.buffer, buffer_copy, 0, byteOffset, byteOffset + byteLength);
|
|
||||||
return new ctor(buffer_copy.buffer,
|
|
||||||
buffer_copy.byteOffset,
|
|
||||||
byteLength / BYTES_PER_ELEMENT);
|
|
||||||
}
|
}
|
||||||
|
// Copy to an aligned buffer first.
|
||||||
|
const buffer_copy = Buffer.allocUnsafe(byteLength);
|
||||||
|
copy(this.buffer, buffer_copy, 0, byteOffset, byteOffset + byteLength);
|
||||||
|
return new ctor(buffer_copy.buffer,
|
||||||
|
buffer_copy.byteOffset,
|
||||||
|
byteLength / BYTES_PER_ELEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,9 +127,8 @@ class Script extends ContextifyScript {
|
||||||
const { breakOnSigint, args } = getRunInContextArgs(options);
|
const { breakOnSigint, args } = getRunInContextArgs(options);
|
||||||
if (breakOnSigint && process.listenerCount('SIGINT') > 0) {
|
if (breakOnSigint && process.listenerCount('SIGINT') > 0) {
|
||||||
return sigintHandlersWrap(super.runInThisContext, this, args);
|
return sigintHandlersWrap(super.runInThisContext, this, args);
|
||||||
} else {
|
|
||||||
return super.runInThisContext(...args);
|
|
||||||
}
|
}
|
||||||
|
return super.runInThisContext(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
runInContext(contextifiedObject, options) {
|
runInContext(contextifiedObject, options) {
|
||||||
|
@ -138,9 +137,8 @@ class Script extends ContextifyScript {
|
||||||
if (breakOnSigint && process.listenerCount('SIGINT') > 0) {
|
if (breakOnSigint && process.listenerCount('SIGINT') > 0) {
|
||||||
return sigintHandlersWrap(super.runInContext, this,
|
return sigintHandlersWrap(super.runInContext, this,
|
||||||
[contextifiedObject, ...args]);
|
[contextifiedObject, ...args]);
|
||||||
} else {
|
|
||||||
return super.runInContext(contextifiedObject, ...args);
|
|
||||||
}
|
}
|
||||||
|
return super.runInContext(contextifiedObject, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
runInNewContext(contextObject, options) {
|
runInNewContext(contextObject, options) {
|
||||||
|
|
15
lib/zlib.js
15
lib/zlib.js
|
@ -762,15 +762,14 @@ function createConvenienceMethod(ctor, sync) {
|
||||||
return function syncBufferWrapper(buffer, opts) {
|
return function syncBufferWrapper(buffer, opts) {
|
||||||
return zlibBufferSync(new ctor(opts), buffer);
|
return zlibBufferSync(new ctor(opts), buffer);
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
return function asyncBufferWrapper(buffer, opts, callback) {
|
|
||||||
if (typeof opts === 'function') {
|
|
||||||
callback = opts;
|
|
||||||
opts = {};
|
|
||||||
}
|
|
||||||
return zlibBuffer(new ctor(opts), buffer, callback);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return function asyncBufferWrapper(buffer, opts, callback) {
|
||||||
|
if (typeof opts === 'function') {
|
||||||
|
callback = opts;
|
||||||
|
opts = {};
|
||||||
|
}
|
||||||
|
return zlibBuffer(new ctor(opts), buffer, callback);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const kMaxBrotliParam = MathMax(...ObjectKeys(constants).map((key) => {
|
const kMaxBrotliParam = MathMax(...ObjectKeys(constants).map((key) => {
|
||||||
|
|
|
@ -38,9 +38,8 @@ assert.throws(() => {
|
||||||
name: 'Error'
|
name: 'Error'
|
||||||
})(e);
|
})(e);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
|
|
|
@ -165,14 +165,13 @@ class ActivityCollector {
|
||||||
// Worker threads start main script execution inside of an AsyncWrap
|
// Worker threads start main script execution inside of an AsyncWrap
|
||||||
// callback, so we don't yield errors for these.
|
// callback, so we don't yield errors for these.
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
const err = new Error(`Found a handle whose ${hook}` +
|
|
||||||
' hook was invoked but not its init hook');
|
|
||||||
// Don't throw if we see invocations due to an assertion in a test
|
|
||||||
// failing since we want to list the assertion failure instead
|
|
||||||
if (/process\._fatalException/.test(err.stack)) return null;
|
|
||||||
throw err;
|
|
||||||
}
|
}
|
||||||
|
const err = new Error(`Found a handle whose ${hook}` +
|
||||||
|
' hook was invoked but not its init hook');
|
||||||
|
// Don't throw if we see invocations due to an assertion in a test
|
||||||
|
// failing since we want to list the assertion failure instead
|
||||||
|
if (/process\._fatalException/.test(err.stack)) return null;
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,16 +36,15 @@ function readDomainFromPacket(buffer, offset) {
|
||||||
nread: 1 + length + nread,
|
nread: 1 + length + nread,
|
||||||
domain: domain ? `${chunk}.${domain}` : chunk
|
domain: domain ? `${chunk}.${domain}` : chunk
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
// Pointer to another part of the packet.
|
|
||||||
assert.strictEqual(length & 0xC0, 0xC0);
|
|
||||||
// eslint-disable-next-line space-infix-ops, space-unary-ops
|
|
||||||
const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000;
|
|
||||||
return {
|
|
||||||
nread: 2,
|
|
||||||
domain: readDomainFromPacket(buffer, pointeeOffset)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
// Pointer to another part of the packet.
|
||||||
|
assert.strictEqual(length & 0xC0, 0xC0);
|
||||||
|
// eslint-disable-next-line space-infix-ops, space-unary-ops
|
||||||
|
const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000;
|
||||||
|
return {
|
||||||
|
nread: 2,
|
||||||
|
domain: readDomainFromPacket(buffer, pointeeOffset)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseDNSPacket(buffer) {
|
function parseDNSPacket(buffer) {
|
||||||
|
|
|
@ -309,10 +309,9 @@ function runCallChecks(exitCode) {
|
||||||
if ('minimum' in context) {
|
if ('minimum' in context) {
|
||||||
context.messageSegment = `at least ${context.minimum}`;
|
context.messageSegment = `at least ${context.minimum}`;
|
||||||
return context.actual < context.minimum;
|
return context.actual < context.minimum;
|
||||||
} else {
|
|
||||||
context.messageSegment = `exactly ${context.exact}`;
|
|
||||||
return context.actual !== context.exact;
|
|
||||||
}
|
}
|
||||||
|
context.messageSegment = `exactly ${context.exact}`;
|
||||||
|
return context.actual !== context.exact;
|
||||||
});
|
});
|
||||||
|
|
||||||
failed.forEach(function(context) {
|
failed.forEach(function(context) {
|
||||||
|
@ -465,9 +464,8 @@ function nodeProcessAborted(exitCode, signal) {
|
||||||
// the expected exit codes or signals.
|
// the expected exit codes or signals.
|
||||||
if (signal !== null) {
|
if (signal !== null) {
|
||||||
return expectedSignals.includes(signal);
|
return expectedSignals.includes(signal);
|
||||||
} else {
|
|
||||||
return expectedExitCodes.includes(exitCode);
|
|
||||||
}
|
}
|
||||||
|
return expectedExitCodes.includes(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAlive(pid) {
|
function isAlive(pid) {
|
||||||
|
|
|
@ -217,9 +217,8 @@ class InspectorSession {
|
||||||
return Promise
|
return Promise
|
||||||
.all(commands.map((command) => this._sendMessage(command)))
|
.all(commands.map((command) => this._sendMessage(command)))
|
||||||
.then(() => {});
|
.then(() => {});
|
||||||
} else {
|
|
||||||
return this._sendMessage(commands);
|
|
||||||
}
|
}
|
||||||
|
return this._sendMessage(commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForNotification(methodOrPredicate, description) {
|
waitForNotification(methodOrPredicate, description) {
|
||||||
|
|
|
@ -36,9 +36,8 @@ function getSharedLibPath() {
|
||||||
return path.join(kExecPath, 'node.dll');
|
return path.join(kExecPath, 'node.dll');
|
||||||
} else if (common.isOSX) {
|
} else if (common.isOSX) {
|
||||||
return path.join(kExecPath, `libnode.${kShlibSuffix}`);
|
return path.join(kExecPath, `libnode.${kShlibSuffix}`);
|
||||||
} else {
|
|
||||||
return path.join(kExecPath, 'lib.target', `libnode.${kShlibSuffix}`);
|
|
||||||
}
|
}
|
||||||
|
return path.join(kExecPath, 'lib.target', `libnode.${kShlibSuffix}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the binary path of stack frames.
|
// Get the binary path of stack frames.
|
||||||
|
|
|
@ -73,9 +73,8 @@ class ResourceLoader {
|
||||||
text() { return data.toString(); }
|
text() { return data.toString(); }
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
return fs.readFileSync(file, 'utf8');
|
|
||||||
}
|
}
|
||||||
|
return fs.readFileSync(file, 'utf8');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,24 +602,23 @@ class WPTRunner {
|
||||||
const matches = code.match(/\/\/ META: .+/g);
|
const matches = code.match(/\/\/ META: .+/g);
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
return {};
|
return {};
|
||||||
} else {
|
|
||||||
const result = {};
|
|
||||||
for (const match of matches) {
|
|
||||||
const parts = match.match(/\/\/ META: ([^=]+?)=(.+)/);
|
|
||||||
const key = parts[1];
|
|
||||||
const value = parts[2];
|
|
||||||
if (key === 'script') {
|
|
||||||
if (result[key]) {
|
|
||||||
result[key].push(value);
|
|
||||||
} else {
|
|
||||||
result[key] = [value];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
result[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
const result = {};
|
||||||
|
for (const match of matches) {
|
||||||
|
const parts = match.match(/\/\/ META: ([^=]+?)=(.+)/);
|
||||||
|
const key = parts[1];
|
||||||
|
const value = parts[2];
|
||||||
|
if (key === 'script') {
|
||||||
|
if (result[key]) {
|
||||||
|
result[key].push(value);
|
||||||
|
} else {
|
||||||
|
result[key] = [value];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildQueue() {
|
buildQueue() {
|
||||||
|
|
|
@ -7,15 +7,12 @@ const assert = require('assert');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
let mode;
|
|
||||||
|
|
||||||
if (common.isWindows) {
|
if (common.isWindows) {
|
||||||
common.skip('mode is not supported in mkdir on Windows');
|
common.skip('mode is not supported in mkdir on Windows');
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
mode = 0o644;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mode = 0o644;
|
||||||
const maskToIgnore = 0o10000;
|
const maskToIgnore = 0o10000;
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
|
@ -31,15 +31,14 @@ tmpdir.refresh();
|
||||||
function stat_resource(resource) {
|
function stat_resource(resource) {
|
||||||
if (typeof resource === 'string') {
|
if (typeof resource === 'string') {
|
||||||
return fs.statSync(resource);
|
return fs.statSync(resource);
|
||||||
} else {
|
|
||||||
const stats = fs.fstatSync(resource);
|
|
||||||
// Ensure mtime has been written to disk
|
|
||||||
// except for directories on AIX where it cannot be synced
|
|
||||||
if (common.isAIX && stats.isDirectory())
|
|
||||||
return stats;
|
|
||||||
fs.fsyncSync(resource);
|
|
||||||
return fs.fstatSync(resource);
|
|
||||||
}
|
}
|
||||||
|
const stats = fs.fstatSync(resource);
|
||||||
|
// Ensure mtime has been written to disk
|
||||||
|
// except for directories on AIX where it cannot be synced
|
||||||
|
if (common.isAIX && stats.isDirectory())
|
||||||
|
return stats;
|
||||||
|
fs.fsyncSync(resource);
|
||||||
|
return fs.fstatSync(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_mtime(resource, mtime) {
|
function check_mtime(resource, mtime) {
|
||||||
|
|
|
@ -103,10 +103,9 @@ function pingPongTest(port, host) {
|
||||||
assert.strictEqual(client.writable, false);
|
assert.strictEqual(client.writable, false);
|
||||||
assert.strictEqual(client.readable, true);
|
assert.strictEqual(client.readable, true);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
assert.strictEqual(client.writable, true);
|
|
||||||
assert.strictEqual(client.readable, true);
|
|
||||||
}
|
}
|
||||||
|
assert.strictEqual(client.writable, true);
|
||||||
|
assert.strictEqual(client.readable, true);
|
||||||
|
|
||||||
if (count < N) {
|
if (count < N) {
|
||||||
client.write('PING');
|
client.write('PING');
|
||||||
|
|
|
@ -95,8 +95,7 @@ function test2() {
|
||||||
r._read = function(n) {
|
r._read = function(n) {
|
||||||
if (!reads--)
|
if (!reads--)
|
||||||
return r.push(null); // EOF
|
return r.push(null); // EOF
|
||||||
else
|
return r.push(Buffer.from('x'));
|
||||||
return r.push(Buffer.from('x'));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = [];
|
const results = [];
|
||||||
|
|
|
@ -25,9 +25,8 @@ function getEnabledCategoriesFromCommandLine() {
|
||||||
const indexOfCatFlag = process.execArgv.indexOf('--trace-event-categories');
|
const indexOfCatFlag = process.execArgv.indexOf('--trace-event-categories');
|
||||||
if (indexOfCatFlag === -1) {
|
if (indexOfCatFlag === -1) {
|
||||||
return undefined;
|
return undefined;
|
||||||
} else {
|
|
||||||
return process.execArgv[indexOfCatFlag + 1];
|
|
||||||
}
|
}
|
||||||
|
return process.execArgv[indexOfCatFlag + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const isChild = process.argv[2] === 'child';
|
const isChild = process.argv[2] === 'child';
|
||||||
|
|
|
@ -88,9 +88,8 @@ function pingPongTest(host, on_complete) {
|
||||||
if (sent_final_ping) {
|
if (sent_final_ping) {
|
||||||
assert.strictEqual(client.readyState, 'readOnly');
|
assert.strictEqual(client.readyState, 'readOnly');
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
assert.strictEqual(client.readyState, 'open');
|
|
||||||
}
|
}
|
||||||
|
assert.strictEqual(client.readyState, 'open');
|
||||||
|
|
||||||
if (count < N) {
|
if (count < N) {
|
||||||
client.write('PING');
|
client.write('PING');
|
||||||
|
|
|
@ -508,8 +508,7 @@ function textJoin(nodes, file) {
|
||||||
return `_${textJoin(node.children, file)}_`;
|
return `_${textJoin(node.children, file)}_`;
|
||||||
} else if (node.children) {
|
} else if (node.children) {
|
||||||
return textJoin(node.children, file);
|
return textJoin(node.children, file);
|
||||||
} else {
|
|
||||||
return node.value;
|
|
||||||
}
|
}
|
||||||
|
return node.value;
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,8 @@ function spawnCopyDeepSync(source, destination) {
|
||||||
if (common.isWindows) {
|
if (common.isWindows) {
|
||||||
mkdirSync(destination); // Prevent interactive prompt
|
mkdirSync(destination); // Prevent interactive prompt
|
||||||
return spawnSync('xcopy.exe', ['/E', source, destination]);
|
return spawnSync('xcopy.exe', ['/E', source, destination]);
|
||||||
} else {
|
|
||||||
return spawnSync('cp', ['-r', `${source}/`, destination]);
|
|
||||||
}
|
}
|
||||||
|
return spawnSync('cp', ['-r', `${source}/`, destination]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) {
|
function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue