Skip to content
Snippets Groups Projects
Commit d6285521 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Added Mutation Tests

parent 87661b84
Branches
Tags
1 merge request!1Master
......@@ -2,3 +2,5 @@ node_modules/
coverage/
stryker.log
*.DS_Store
# stryker temp files
.stryker-tmp
document.querySelector('mutation-test-report-app').report = {"files":{"/Users/sigmundd/Code/config/index.js":{"language":"javascript","mutants":[{"id":"0","location":{"end":{"column":22,"line":1},"start":{"column":18,"line":1}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Killed"},{"id":"1","location":{"end":{"column":26,"line":2},"start":{"column":20,"line":2}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Killed"},{"id":"8","location":{"end":{"column":130,"line":12},"start":{"column":75,"line":12}},"mutatorName":"ArrowFunction","replacement":"() => undefined","status":"Killed"},{"id":"9","location":{"end":{"column":129,"line":12},"start":{"column":111,"line":12}},"mutatorName":"ArrowFunction","replacement":"() => undefined","status":"Killed"},{"id":"3","location":{"end":{"column":2,"line":51},"start":{"column":29,"line":5}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"2","location":{"end":{"column":35,"line":3},"start":{"column":21,"line":3}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Killed"},{"id":"12","location":{"end":{"column":2,"line":25},"start":{"column":42,"line":15}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"13","location":{"end":{"column":31,"line":17},"start":{"column":28,"line":17}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Killed"},{"id":"14","location":{"end":{"column":29,"line":19},"start":{"column":20,"line":19}},"mutatorName":"ConditionalExpression","replacement":"false","status":"Killed"},{"id":"15","location":{"end":{"column":29,"line":19},"start":{"column":20,"line":19}},"mutatorName":"EqualityOperator","replacement":"i <= len - 1","status":"Killed"},{"id":"19","location":{"end":{"column":6,"line":23},"start":{"column":36,"line":19}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"20","location":{"end":{"column":26,"line":21},"start":{"column":13,"line":21}},"mutatorName":"ConditionalExpression","replacement":"true","status":"Killed"},{"id":"21","location":{"end":{"column":26,"line":21},"start":{"column":13,"line":21}},"mutatorName":"ConditionalExpression","replacement":"false","status":"Survived"},{"id":"5","location":{"end":{"column":81,"line":7},"start":{"column":68,"line":7}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Timeout"},{"id":"4","location":{"end":{"column":93,"line":6},"start":{"column":71,"line":6}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Timeout"},{"id":"22","location":{"end":{"column":26,"line":21},"start":{"column":13,"line":21}},"mutatorName":"BooleanLiteral","replacement":"schema[elem]","status":"Killed"},{"id":"23","location":{"end":{"column":23,"line":24},"start":{"column":18,"line":24}},"mutatorName":"ArithmeticOperator","replacement":"len + 1","status":"Killed"},{"id":"24","location":{"end":{"column":4,"line":30},"start":{"column":7,"line":27}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"6","location":{"end":{"column":4,"line":13},"start":{"column":41,"line":11}},"mutatorName":"BlockStatement","replacement":"{}","status":"Timeout"},{"id":"7","location":{"end":{"column":69,"line":12},"start":{"column":36,"line":12}},"mutatorName":"ArrowFunction","replacement":"() => undefined","status":"Timeout"},{"id":"27","location":{"end":{"column":44,"line":31},"start":{"column":17,"line":31}},"mutatorName":"ArithmeticOperator","replacement":"'No File ' - configDefaults","status":"Survived"},{"id":"29","location":{"end":{"column":4,"line":37},"start":{"column":7,"line":34}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"28","location":{"end":{"column":27,"line":31},"start":{"column":17,"line":31}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Survived"},{"id":"32","location":{"end":{"column":41,"line":38},"start":{"column":17,"line":38}},"mutatorName":"ArithmeticOperator","replacement":"'No File ' - configLocal","status":"Survived"},{"id":"10","location":{"end":{"column":129,"line":12},"start":{"column":116,"line":12}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Timeout"},{"id":"11","location":{"end":{"column":160,"line":12},"start":{"column":139,"line":12}},"mutatorName":"ArrowFunction","replacement":"() => undefined","status":"Timeout"},{"id":"33","location":{"end":{"column":27,"line":38},"start":{"column":17,"line":38}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Survived"},{"id":"34","location":{"end":{"column":42,"line":42},"start":{"column":23,"line":42}},"mutatorName":"ConditionalExpression","replacement":"false","status":"Killed"},{"id":"35","location":{"end":{"column":42,"line":42},"start":{"column":23,"line":42}},"mutatorName":"EqualityOperator","replacement":"index <= keys.length","status":"Killed"},{"id":"16","location":{"end":{"column":29,"line":19},"start":{"column":20,"line":19}},"mutatorName":"EqualityOperator","replacement":"i >= len - 1","status":"Timeout"},{"id":"17","location":{"end":{"column":29,"line":19},"start":{"column":24,"line":19}},"mutatorName":"ArithmeticOperator","replacement":"len + 1","status":"Timeout"},{"id":"38","location":{"end":{"column":4,"line":48},"start":{"column":53,"line":42}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"39","location":{"end":{"column":62,"line":44},"start":{"column":59,"line":44}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Killed"},{"id":"18","location":{"end":{"column":34,"line":19},"start":{"column":31,"line":19}},"mutatorName":"UpdateOperator","replacement":"i--","status":"Timeout"},{"id":"40","location":{"end":{"column":67,"line":44},"start":{"column":64,"line":44}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Killed"},{"id":"43","location":{"end":{"column":6,"line":47},"start":{"column":14,"line":45}},"mutatorName":"BlockStatement","replacement":"{}","status":"Killed"},{"id":"25","location":{"end":{"column":63,"line":29},"start":{"column":57,"line":29}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Timeout"},{"id":"26","location":{"end":{"column":4,"line":32},"start":{"column":18,"line":30}},"mutatorName":"BlockStatement","replacement":"{}","status":"Timeout"},{"id":"36","location":{"end":{"column":42,"line":42},"start":{"column":23,"line":42}},"mutatorName":"EqualityOperator","replacement":"index >= keys.length","status":"Killed"},{"id":"37","location":{"end":{"column":51,"line":42},"start":{"column":44,"line":42}},"mutatorName":"UpdateOperator","replacement":"index--","status":"Killed"},{"id":"30","location":{"end":{"column":74,"line":36},"start":{"column":68,"line":36}},"mutatorName":"StringLiteral","replacement":"\"\"","status":"Timeout"},{"id":"31","location":{"end":{"column":4,"line":39},"start":{"column":19,"line":37}},"mutatorName":"BlockStatement","replacement":"{}","status":"Timeout"},{"id":"41","location":{"end":{"column":12,"line":45},"start":{"column":9,"line":45}},"mutatorName":"ConditionalExpression","replacement":"true","status":"Killed"},{"id":"42","location":{"end":{"column":12,"line":45},"start":{"column":9,"line":45}},"mutatorName":"ConditionalExpression","replacement":"false","status":"Killed"}],"source":"var fs = require('fs')\nvar path = require('path')\nvar merge = require('lodash.merge')\n\nmodule.exports = function() {\n let configDefaults = path.join(path.dirname(require.main.filename), 'config.defaults.json')\n let configLocal = path.join(path.dirname(require.main.filename), 'config.json')\n \n let config = {}\n \n const objectDeepKeys = function (obj) {\n return Object.keys(obj).filter(key => obj[key] instanceof Object).map(key => objectDeepKeys(obj[key]).map(k => `${key}.${k}`)).reduce((x, y) => x.concat(y), Object.keys(obj))\n }\n \n const set = function(obj, path, value) {\n var schema = obj // a moving reference to internal objects within obj\n var pList = path.split('.')\n var len = pList.length\n for(var i = 0; i < len-1; i++) {\n var elem = pList[i]\n if( !schema[elem] ) schema[elem] = {}\n schema = schema[elem]\n }\n schema[pList[len-1]] = value\n}\n\n try {\n fs.accessSync(configDefaults)\n config = JSON.parse(fs.readFileSync(configDefaults, 'utf8'))\n } catch(error) {\n console.log('No File ' + configDefaults)\n }\n \n try {\n fs.accessSync(configLocal)\n config = merge(config, JSON.parse(fs.readFileSync(configLocal, 'utf8')))\n } catch (error) {\n console.log('No File ' + configLocal)\n }\n \n let keys = objectDeepKeys(config)\n for (let index = 0; index < keys.length; index++) {\n const element = keys[index]\n const env = process.env[element.toUpperCase().replace('.', '_')]\n if (env) {\n set(config, element, env)\n }\n }\n\n return config\n}"}},"schemaVersion":"1.0","thresholds":{"break":null,"high":80,"low":60}};
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="mutation-test-elements.js"></script>
</head>
<body>
<img class="stryker-image" alt="Stryker" src="stryker-80x80.png"
style="position: fixed; right: 0; top: 0; z-index: 10">
<mutation-test-report-app titlePostfix="Stryker">
Your browser doesn't support <a href="https://caniuse.com/#search=custom%20elements">custom elements</a>.
Please use a latest version of an evergreen browser (Firefox, Chrome, Safari, Opera, etc).
</mutation-test-report-app>
<script src="bind-mutation-test-report.js"></script>
</body>
</html>
This diff is collapsed.
docs/mutation/stryker-80x80.png

6.05 KiB

This diff is collapsed.
......@@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"test": "jest",
"test:mutation": "stryker run",
"sonarqube": "sonar-scanner -Dsonar.projectKey=config -Dsonar.sources=. -Dsonar.host.url=https://it-devops-01.br-edv.brnet.int:8999 -Dsonar.login=gitlab"
},
"keywords": [
......@@ -19,7 +20,11 @@
"vault": "^0.3.0"
},
"devDependencies": {
"jest": "^25.1.0"
"@stryker-mutator/core": "^3.1.0",
"@stryker-mutator/javascript-mutator": "^3.1.0",
"@stryker-mutator/jest-runner": "^3.1.0",
"@stryker-mutator/typescript": "^3.1.0",
"jest": "^25.3.0"
},
"jest": {
"collectCoverage": true,
......
{
"$schema": "https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json",
"mutator": "javascript",
"packageManager": "npm",
"reporters": [
"html",
"clear-text",
"progress",
"dashboard"
],
"testRunner": "jest",
"transpilers": [],
"coverageAnalysis": "all",
"htmlReporter": {
"baseDir": "docs/mutation"
},
"mutate": ["index.js"]
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment