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

yiming-liao / logry / 18441766080

12 Oct 2025 08:57AM UTC coverage: 95.92% (-0.3%) from 96.196%
18441766080

push

github

yiming-liao
chore(release): bump version to 1.2.3

434 of 498 branches covered (87.15%)

Branch coverage included in aggregate %.

3939 of 4061 relevant lines covered (97.0%)

3.66 hits per line

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

78.33
/src/modules/normalizers/fields/normalize-level.ts
1
import type {
1✔
2
  NormalizeFieldOptions,
1✔
3
  NormalizeLevelExtraOptions,
1✔
4
} from "@/modules/normalizers/types";
1✔
5
import type {
1✔
6
  NormalizedLevel,
1✔
7
  RawLevel,
1✔
8
  SnapshotLogFields,
1✔
9
} from "@/shared/types/log-fields";
1✔
10
import { internalLog } from "@/internal";
1✔
11
import {
1✔
12
  DEFAULT_LEVEL_STYLE,
1✔
13
  TITLECASE_LEVELS_MAP,
1✔
14
  UPPERCASE_LEVELS_MAP,
1✔
15
} from "@/modules/normalizers/constants";
1✔
16
import { tryCustomNormalizer } from "@/modules/normalizers/utils/try-custom-normalizer";
1✔
17

1✔
18
export type LevelStyle = "upper" | "lower" | "title";
1✔
19

1✔
20
export const normalizeLevel = (
1✔
21
  fieldValue: RawLevel,
4✔
22
  raw: SnapshotLogFields,
4✔
23
  options: NormalizeFieldOptions<
4✔
24
    RawLevel,
4✔
25
    NormalizedLevel,
4✔
26
    NormalizeLevelExtraOptions
4✔
27
  > = {},
4✔
28
): NormalizedLevel => {
4✔
29
  const { style = DEFAULT_LEVEL_STYLE, customNormalizer } = options;
4✔
30

4✔
31
  // Use custom normalizer if provided
4✔
32
  const customized = tryCustomNormalizer({
4✔
33
    label: "level",
4✔
34
    input: { fieldValue, raw },
4✔
35
    customNormalizer,
4✔
36
  });
4✔
37
  if (customized) {
4!
38
    return customized;
×
39
  }
×
40

4✔
41
  switch (style) {
4✔
42
    case "lower":
4!
43
      return fieldValue;
×
44
    case "title":
4!
45
      return TITLECASE_LEVELS_MAP[fieldValue];
×
46
    case "upper":
4✔
47
      return UPPERCASE_LEVELS_MAP[fieldValue];
4✔
48
    default:
4!
49
      internalLog({
×
50
        type: "warn",
×
51
        message: `Unknown level style "${style}", using "upper" as fallback.`,
×
52
      });
×
53
      return UPPERCASE_LEVELS_MAP[fieldValue];
×
54
  }
4✔
55
};
4✔
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