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

kulshekhar / ts-jest / 10066013409

23 Jul 2024 08:35PM UTC coverage: 95.254%. Remained the same
10066013409

push

github

ahnpnl
build(deps): Update dependency @testing-library/jest-dom to ^6.4.8

777 of 875 branches covered (88.8%)

Branch coverage included in aggregate %.

4763 of 4941 relevant lines covered (96.4%)

1242.48 hits per line

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

92.06
/src/utils/json.ts
1
/* eslint-disable no-redeclare */
6✔
2
import stableStringify from 'fast-json-stable-stringify'
6✔
3

6✔
4
const UNDEFINED = 'undefined'
6✔
5

6✔
6
export function stringify(input: unknown): string {
1,225✔
7
  return input === undefined ? UNDEFINED : stableStringify(input)
1,225✔
8
}
1,225✔
9

6✔
10
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6✔
11
export function parse(input: string): any {
12✔
12
  return input === UNDEFINED ? undefined : JSON.parse(input)
12✔
13
}
12✔
14

6✔
15
interface NormalizeOptions {
6✔
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6✔
17
  parse?: (input: string) => any
6✔
18
}
6✔
19
/**
6✔
20
 * @internal
6✔
21
 */
6✔
22
export function normalize(input: string, { parse: parser = parse }: NormalizeOptions = {}): string {
24✔
23
  let result: string | undefined
24✔
24
  if (normalize.cache.has(input)) {
24✔
25
    result = normalize.cache.get(input)
6✔
26
  } else {
24✔
27
    const data = parser(input)
18✔
28
    result = stringify(data)
18✔
29
    if (result === input) result = undefined
18!
30
    normalize.cache.set(input, result)
18✔
31
  }
18✔
32

24✔
33
  return result === undefined ? input : result
24!
34
}
24✔
35

6✔
36
/**
6✔
37
 * @internal
6✔
38
 */
6✔
39
// eslint-disable-next-line @typescript-eslint/no-namespace
6✔
40
export namespace normalize {
44✔
41
  export const cache = new Map<string, string | undefined>()
44✔
42
}
44!
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