Stryker

BinaryOperatorMutator.js - Stryker report

Summary

File
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Errors
Total detected
Total undetected
Total mutants
BinaryOperatorMutator.js
84%
11/13 11 2 0 0 0 11 2 13

Code

"use strict";
var esprima_1 = require('esprima');
var BinaryOperatorMutator = (function () 0{
    function BinaryOperatorMutator() 1{
        this.name = 'BinaryOperator';
        this.operators = {
            '+': '-',
            '-': '+',
            '*': '/',
            '/': '*',
            '%': '*',
            '<': ['<=', '>='],
            '<=': ['<', '>'],
            '>': ['>=', '<='],
            '>=': ['>', '<'],
            '==': '!=',
            '!=': '==',
            '===': '!==',
            '!==': '==='
        };
    }
    BinaryOperatorMutator.prototype.applyMutations = function (node, copy) 2{
        var nodes = [];
        if (3456node.type === esprima_1.Syntax.BinaryExpression && this.operators[node.operator]) 7{
            var binaryNode_1 = node;
            var mutatedOperators = this.operators[node.operator];
            if (8910typeof mutatedOperators === 'string') 11{
                mutatedOperators = [mutatedOperators];
            }
            mutatedOperators.forEach(function (operator) 12{
                var mutatedNode = copy(binaryNode_1);
                mutatedNode.operator = operator;
                nodes.push(mutatedNode);
            });
        }
        return nodes;
    };
    return BinaryOperatorMutator;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = BinaryOperatorMutator;
//# sourceMappingURL=BinaryOperatorMutator.js.map