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

juice-shop / juice-shop-ctf / 17167236709

22 Aug 2025 10:23PM UTC coverage: 90.832% (-8.0%) from 98.804%
17167236709

push

github

bkimminich
Fix Coveralls publishing to a used Node version

254 of 332 branches covered (76.51%)

961 of 1058 relevant lines covered (90.83%)

6.44 hits per line

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

97.06
/lib/fetchCountryMapping.ts
1
/*
3!
2
 * Copyright (c) 2016-2025 Bjoern Kimminich & the OWASP Juice Shop contributors.
1✔
3
 * SPDX-License-Identifier: MIT
1✔
4
 */
1✔
5

1✔
6
import * as https from 'node:https'
1✔
7
import yaml from 'js-yaml'
1✔
8
import type { CountryMapping } from './types/types'
1✔
9

1✔
10
async function fetchCountryMapping (
3✔
11
  challengeMapFile?: string,
3✔
12
  ignoreSslWarnings?: boolean,
3✔
13
  { fetch = globalThis.fetch } = { fetch: globalThis.fetch }
3✔
14
): Promise<CountryMapping> {
3✔
15
  if (challengeMapFile === undefined || challengeMapFile === '') {
3✔
16
    return {}
1✔
17
  }
1✔
18

3✔
19
  const agent = ignoreSslWarnings === true
3!
20
    ? new https.Agent({ rejectUnauthorized: false })
✔
21
    : undefined
2✔
22
  const options = { agent }
3✔
23

3✔
24
  try {
3✔
25
    const response = await fetch(challengeMapFile, options as RequestInit | undefined)
3✔
26
    const text = await response.text()
3✔
27
    const data = yaml.loadAll(text) as any[]
1✔
28
    return data[0].ctf.countryMapping
1✔
29
  } catch (err: any) {
1✔
30
    throw new Error('Failed to fetch country mapping from API! ' + err.message)
1✔
31
  }
1✔
32
}
3✔
33

1✔
34
export default fetchCountryMapping
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

© 2026 Coveralls, Inc