Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Pinca <luigipinca@gmail.com>2020-04-08 19:58:03 +0300
committerLuigi Pinca <luigipinca@gmail.com>2020-05-16 07:42:16 +0300
commitb533fb3508009e5f567cc776daba8fbf665386a6 (patch)
tree4b7bbfdc2feeee93b855b01abd2e56f499b70d0a /test/common
parent1cb80d1e0590eeb3daf495bddfcf5237a99aa9b7 (diff)
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>
Diffstat (limited to 'test/common')
-rw-r--r--test/common/dns.js17
-rw-r--r--test/common/index.js8
-rw-r--r--test/common/inspector-helper.js3
-rw-r--r--test/common/shared-lib-util.js3
-rw-r--r--test/common/wpt.js30
5 files changed, 27 insertions, 34 deletions
diff --git a/test/common/dns.js b/test/common/dns.js
index 37f80dde027..d8a703cc53b 100644
--- a/test/common/dns.js
+++ b/test/common/dns.js
@@ -36,16 +36,15 @@ function readDomainFromPacket(buffer, offset) {
nread: 1 + length + nread,
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) {
diff --git a/test/common/index.js b/test/common/index.js
index a7528749926..6343425858d 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -309,10 +309,9 @@ function runCallChecks(exitCode) {
if ('minimum' in context) {
context.messageSegment = `at least ${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) {
@@ -465,9 +464,8 @@ function nodeProcessAborted(exitCode, signal) {
// the expected exit codes or signals.
if (signal !== null) {
return expectedSignals.includes(signal);
- } else {
- return expectedExitCodes.includes(exitCode);
}
+ return expectedExitCodes.includes(exitCode);
}
function isAlive(pid) {
diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js
index d430137746d..77d7928af13 100644
--- a/test/common/inspector-helper.js
+++ b/test/common/inspector-helper.js
@@ -217,9 +217,8 @@ class InspectorSession {
return Promise
.all(commands.map((command) => this._sendMessage(command)))
.then(() => {});
- } else {
- return this._sendMessage(commands);
}
+ return this._sendMessage(commands);
}
waitForNotification(methodOrPredicate, description) {
diff --git a/test/common/shared-lib-util.js b/test/common/shared-lib-util.js
index e522a71b474..9f891a6043e 100644
--- a/test/common/shared-lib-util.js
+++ b/test/common/shared-lib-util.js
@@ -36,9 +36,8 @@ function getSharedLibPath() {
return path.join(kExecPath, 'node.dll');
} else if (common.isOSX) {
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.
diff --git a/test/common/wpt.js b/test/common/wpt.js
index e33d0c86cc7..e79bd66b370 100644
--- a/test/common/wpt.js
+++ b/test/common/wpt.js
@@ -73,9 +73,8 @@ class ResourceLoader {
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);
if (!matches) {
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];
- }
+ }
+ 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;
+ result[key] = [value];
}
+ } else {
+ result[key] = value;
}
- return result;
}
+ return result;
}
buildQueue() {