• 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

91.89
/lib/fetchChallenges.ts
1
/*
2!
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 type { Challenge } from './types/types'
1✔
8

1✔
9
async function fetchChallenges (
2✔
10
  juiceShopUrl: string,
2✔
11
  ignoreSslWarnings: boolean,
2✔
12
  { fetch = globalThis.fetch } = { fetch: globalThis.fetch }
2✔
13
): Promise<Challenge[]> {
2✔
14
  const agent = ignoreSslWarnings
2!
15
    ? new https.Agent({ rejectUnauthorized: false })
×
16
    : undefined
2✔
17

2✔
18
  const options = { agent }
2✔
19

2✔
20
  try {
2✔
21
    const response = await fetch(
2✔
22
  `${juiceShopUrl}/api/Challenges`,
2✔
23
  options as RequestInit | undefined
2✔
24
    )
2✔
25

2✔
26
    if (!response.ok) {
2!
27
      throw new Error(`HTTP error! status: ${response.status}`)
×
28
    }
×
29

2✔
30
    const json = (await response.json()) as { data: Challenge[] }
2✔
31
    return json.data
1✔
32
  } catch (err: any) {
1✔
33
    throw new Error('Failed to fetch challenges from API! Argh!' + err.message)
1✔
34
  }
1✔
35
}
2✔
36

1✔
37
export default fetchChallenges
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