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

kulshekhar / ts-jest / 4440110611

pending completion
4440110611

push

github

GitHub
build(deps): Update dependency eslint to ^8.36.0 (#4045)

930 of 1044 branches covered (89.08%)

Branch coverage included in aggregate %.

4055 of 4154 relevant lines covered (97.62%)

520.62 hits per line

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

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

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

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

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

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

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

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