• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

variablesoftware / logface / 15371407231

01 Jun 2025 05:16AM UTC coverage: 91.974% (+0.5%) from 91.47%
15371407231

push

github

px
✨ fix: (config): add new logface configuration with emoji sets and randomization

256 of 293 branches covered (87.37%)

Branch coverage included in aggregate %.

443 of 467 relevant lines covered (94.86%)

33.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/utils/matchesScopeFilter.ts
1
/**
2
 * Match a scope or level against a user-defined LOG pattern.
3
 * Supports wildcards such as `auth*` and `auth:*`, and negation with `!pattern`.
4
 * @param scope - The tag or level name
5
 * @param pattern - The filter string, supports wildcards and negation
6
 * @returns True if the scope matches the pattern (negation returns false if matched)
7
 * @internal
8
 */
9
export function matchesScopeFilter(scope: string, pattern: unknown): boolean {
1✔
10
  if (pattern == null) return true;
186✔
11
  if (typeof pattern === 'string') {
186✔
12
    if (pattern.startsWith('!')) {
179✔
13
      // Negation: return false if the rest matches
14
      const positive = pattern.slice(1);
6✔
15
      return !matchesScopeFilter(scope, positive);
6✔
16
    }
6✔
17
    if (pattern.endsWith(":*")) {
179✔
18
      return (
7✔
19
        scope === pattern.slice(0, -2) || scope.startsWith(pattern.slice(0, -1))
7✔
20
      );
21
    }
7✔
22
    if (pattern.endsWith("*")) {
177✔
23
      return scope.startsWith(pattern.slice(0, -1));
24✔
24
    }
24✔
25
    return scope === pattern;
142✔
26
  }
142✔
27
  if (pattern instanceof RegExp) {
21✔
28
    return pattern.test(scope);
2✔
29
  }
2✔
30
  if (typeof pattern === 'function') {
21✔
31
    return !!pattern(scope);
2✔
32
  }
2✔
33
  return false;
1✔
34
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc