Stryker

writeToZipFile.js - Stryker report

File / Directory
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Runtime errors
# Transpile errors
Total detected
Total undetected
Total mutants
writeToZipFile.js
100.00 %
100.00 9 0 0 0 0 0 9 0 9
Expand all
const Promise = require('bluebird')
const fs = require('fs')
Promise.promisifyAll(fs)
const path = require('path')
const dateFormat = require('dateformat')
const Zip = require('node-zip')
const zip = new Zip()

function writeToZipFile ({challenges, hints, flagKeys}, desiredFileName) 0{
  return new Promise((resolve, reject) => 1{
    const fileName = 2desiredFileName || 34'OWASP_Juice_Shop.' + dateFormat(new Date(), 'yyyy-mm-dd') + '.zip'
    zip.file('db/challenges.json', JSON.stringify(challenges))
    zip.file('db/hints.json', JSON.stringify(hints))
    zip.file('db/keys.json', JSON.stringify(flagKeys))
    zip.file('db/files.json', '')
    zip.file('db/tags.json', '')
    fs.writeFileAsync(fileName, zip.generate({base64: 5false, compression: 'DEFLATE'}), 'binary').then(() => 6{
      resolve(path.resolve(fileName).green)
    }).catch(({message}) => 7{
      reject(new Error(8'Failed to write output to file! ' + message))
    })
  })
}

module.exports = writeToZipFile

# Mutator State Location Original Replacement
0 BlockStatement Killed 8 : 73 { ...}) } { }
1 BlockStatement Killed 9 : 42 { ... } { }
2 LogicalOperator Killed 10 : 21 || ' .... ' && ' .... '
3 BinaryOperator Killed 10 : 40 ' .... ' ' .... '
4 BinaryOperator Killed 10 : 40 ' ...- ') ' ...- ')
5 BooleanSubstitution Killed 16 : 54
6 BlockStatement Killed 16 : 108 { ... } { }
7 BlockStatement Killed 18 : 28 { ... } { }
8 BinaryOperator Killed 19 : 23 ' ...! ' + ' ...! ' -