Skip to content

Commit

Permalink
Fix boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
RedYetiDev authored Apr 14, 2024
1 parent f7a3542 commit 208a645
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,23 +410,23 @@ 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) =>
RegExpPrototypeExec(re, this.name) !== null,
) ||
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);
}
Expand Down

0 comments on commit 208a645

Please sign in to comment.