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

yiming-liao / logry / 15760909787

19 Jun 2025 03:01PM UTC coverage: 96.654% (-1.8%) from 98.439%
15760909787

push

github

yiming-liao
refactor: restructure formatter, handler and core log flow

503 of 546 branches covered (92.12%)

Branch coverage included in aggregate %.

543 of 549 new or added lines in 39 files covered. (98.91%)

80 existing lines in 11 files now uncovered.

4668 of 4804 relevant lines covered (97.17%)

3.71 hits per line

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

72.09
/src/modules/formatters/utils/resolve-scope-string.ts
1
import type { RawScope } from "@/core/logger/types";
1✔
2
import type { NormalizedScope } from "@/modules/normalizers/types";
1✔
3

1✔
4
export type ResolveScopeStringOptions = {
1✔
5
  /** Full normalized scope string, e.g. "user.auth.login" */
1✔
6
  scope: NormalizedScope;
1✔
7
  /** Raw scope e.g. ["user","auth","login"] */
1✔
8
  rawScope: RawScope;
1✔
9
  /** Return only the last segment of the scope */
1✔
10
  showOnlyLatest?: boolean;
1✔
11
  /** Custom separator to join raw segments */
1✔
12
  customSeparator?: string;
1✔
13
};
1✔
14

1✔
15
/**
1✔
16
 * Resolve the final scope string based on formatting options.
1✔
17
 *
1✔
18
 * - If `showOnlyLatest` is true, returns the last segment.
1✔
19
 * - If `customSeparator` is provided, joins raw scope with it.
1✔
20
 * - Otherwise, returns the normalized scope string.
1✔
21
 */
1✔
22
export const resolveScopeString = ({
1✔
23
  scope,
4✔
24
  rawScope,
4✔
25
  showOnlyLatest = false,
4✔
26
  customSeparator,
4✔
27
}: ResolveScopeStringOptions): string => {
4✔
28
  if (!Array.isArray(rawScope) || rawScope.length === 0) {
4✔
29
    return "";
4✔
30
  }
4✔
UNCOV
31

×
UNCOV
32
  if (showOnlyLatest) {
×
UNCOV
33
    return rawScope[rawScope.length - 1];
×
UNCOV
34
  }
×
UNCOV
35

×
UNCOV
36
  if (customSeparator) {
×
UNCOV
37
    return rawScope.join(customSeparator);
×
UNCOV
38
  }
×
UNCOV
39

×
UNCOV
40
  return scope;
×
UNCOV
41
};
×
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

© 2026 Coveralls, Inc