diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 01e31d9e411445..373a4004e8ab97 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -410,12 +410,12 @@ class Test extends AsyncResource { matchesTestNamePatterns() { let patterns; - let boolOp = 0; + let bool = true; if (testNamePatterns !== null) { patterns = testNamePatterns; } else if (testSkipPatterns !== null) { patterns = testSkipPatterns; - boolOp = 1; + bool = false; } else return true; // Nothing is specified, just continue const matchesByNameOrParent = ArrayPrototypeSome(patterns, (re) => @@ -423,10 +423,10 @@ class Test extends AsyncResource { ) || this.parent?.matchesTestNamePatterns(); - if (matchesByNameOrParent) return !!boolOp; // true + if (matchesByNameOrParent) return bool; const testNameWithAncestors = StringPrototypeTrim(this.getTestNameWithAncestors()); - if (!testNameWithAncestors) return !boolOp; // false + if (!testNameWithAncestors) return !bool; return ArrayPrototypeSome(patterns, (re) => RegExpPrototypeExec(re, testNameWithAncestors) !== null); }