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

juice-shop / juice-shop-ctf / 16070243603

04 Jul 2025 09:11AM UTC coverage: 91.94% (-3.3%) from 95.214%
16070243603

push

github

web-flow
Merge pull request #159 from hxrshxz/ts

Phase 2 - Migrate test files from Mocha to to node.js native test runner

94 of 127 branches covered (74.02%)

365 of 397 relevant lines covered (91.94%)

194.06 hits per line

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

50.0
/lib/fetchCodeSnippets.js
1
/*
2
 * Copyright (c) 2016-2025 Bjoern Kimminich & the OWASP Juice Shop contributors.
3
 * SPDX-License-Identifier: MIT
4
 */
5

6
const request = require('request-promise')
18✔
7

8
async function fetchCodeSnippets (juiceShopUrl, ignoreSslWarnings, skip = false) {
×
9
  if (skip) {
15✔
10
    return {}
9✔
11
  }
12
  try {
6✔
13
    const { challenges } = await request({
6✔
14
      url: juiceShopUrl + '/snippets',
15
      json: true,
16
      strictSSL: !ignoreSslWarnings
17
    })
18
    if (!challenges) {
6!
19
      return {}
6✔
20
    }
21
    const snippets = {}
×
22
    const snippetList = await Promise.all(
×
23
      challenges.map(async (challengeKey) => {
24
        const { snippet } = await request({
×
25
          url: juiceShopUrl + '/snippets/' + challengeKey,
26
          json: true,
27
          strictSSL: !ignoreSslWarnings
28
        })
29
        return { challengeKey, snippet }
×
30
      })
31
    )
32

33
    for (const { challengeKey, snippet } of snippetList) {
×
34
      snippets[challengeKey] = snippet
×
35
    }
36
    return snippets
×
37
  } catch (error) {
38
    throw new Error('Failed to fetch snippet from API! ' + error.message)
×
39
  }
40
}
41

42
module.exports = fetchCodeSnippets
18✔
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