stryker
Version:
The extendable JavaScript mutation testing framework
26 lines • 1.12 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var esprima_1 = require("esprima");
/**
* Represents a mutator which can remove the content of an array's elements.
*/
var ArrayDeclaratorMutator = /** @class */ (function () {
function ArrayDeclaratorMutator() {
this.name = 'ArrayDeclarator';
}
ArrayDeclaratorMutator.prototype.applyMutations = function (node, copy) {
if ((node.type === esprima_1.Syntax.CallExpression || node.type === esprima_1.Syntax.NewExpression) && node.callee.type === esprima_1.Syntax.Identifier && node.callee.name === 'Array' && node.arguments.length > 0) {
var mutatedNode = copy(node);
mutatedNode.arguments = [];
return mutatedNode;
}
if (node.type === esprima_1.Syntax.ArrayExpression && node.elements.length > 0) {
var mutatedNode = copy(node);
mutatedNode.elements = [];
return mutatedNode;
}
};
return ArrayDeclaratorMutator;
}());
exports.default = ArrayDeclaratorMutator;
//# sourceMappingURL=ArrayDeclaratorMutator.js.map
;