New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stryker

Package Overview
Dependencies
Maintainers
2
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stryker - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

.gitattributes

16

CHANGELOG.md

@@ -0,1 +1,17 @@

<a name="0.4.4"></a>
## [0.4.4](https://github.com/stryker-mutator/stryker/compare/v0.4.3...v0.4.4) (2016-10-04)
### Bug Fixes
* **line-endings:** Enforce unix line endings ([#152](https://github.com/stryker-mutator/stryker/issues/152)) ([554c167](https://github.com/stryker-mutator/stryker/commit/554c167))
* **MutantRunResultMatcher:** False positive fix ([#155](https://github.com/stryker-mutator/stryker/issues/155)) ([255f84b](https://github.com/stryker-mutator/stryker/commit/255f84b)), closes [#155](https://github.com/stryker-mutator/stryker/issues/155)
### Features
* **ts2.0:** Migrate to typescript 2.0 ([#154](https://github.com/stryker-mutator/stryker/issues/154)) ([1c5db5c](https://github.com/stryker-mutator/stryker/commit/1c5db5c))
<a name="0.4.3"></a>

@@ -2,0 +18,0 @@ ## [0.4.3](https://github.com/stryker-mutator/stryker/compare/v0.1.0...v0.4.3) (2016-09-09)

0

CONTRIBUTING.md

@@ -0,0 +0,0 @@ # Contribute to Stryker

@@ -0,0 +0,0 @@ /**

27

package.json
{
"name": "stryker",
"version": "0.4.3",
"version": "0.4.4",
"description": "The extendable JavaScript mutation testing framework",

@@ -8,3 +8,2 @@ "main": "src/Stryker.js",

"scripts": {
"pretest": "typings install",
"test": "grunt test",

@@ -55,2 +54,16 @@ "start": "concurrently \"npm run tsc:w\" \"grunt serve\"",

"devDependencies": {
"@types/chai-as-promised": "0.0.28",
"@types/chalk": "^0.4.28",
"@types/es6-promise": "0.0.31",
"@types/escodegen": "0.0.5",
"@types/esprima": "^2.1.31",
"@types/estree": "0.0.32",
"@types/glob": "^5.0.29",
"@types/karma": "^0.13.32",
"@types/lodash": "^4.14.34",
"@types/log4js": "0.0.31",
"@types/mkdirp": "^0.3.28",
"@types/mocha": "^2.2.31",
"@types/sinon": "^1.16.29",
"@types/sinon-chai": "^2.7.26",
"chai": "^3.4.1",

@@ -70,2 +83,3 @@ "chai-as-promised": "^5.2.0",

"grunt-ts": "^6.0.0-beta.3",
"grunt-tslint": "^3.2.1",
"istanbul": "^0.4.0",

@@ -82,8 +96,5 @@ "jasmine-core": "^2.4.1",

"sinon-chai": "^2.8.0",
"stryker-api": "^0.2.0",
"stryker-html-reporter": "^0.2.0",
"stryker-karma-runner": "^0.2.0",
"stryker-mocha-runner": "0.1.0",
"typescript": "^1.8.9",
"typings": "^0.7.11"
"stryker-api": "^0.2.1",
"tslint": "^3.15.1",
"typescript": "^2.0.2"
},

@@ -90,0 +101,0 @@ "peerDependencies": {

@@ -0,0 +0,0 @@ [![Build Status](https://travis-ci.org/stryker-mutator/stryker.svg?branch=master)](https://travis-ci.org/stryker-mutator/stryker)

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
import { InputFile, InputFileDescriptor } from 'stryker-api/core';

@@ -2,0 +3,0 @@ export default class InputFileResolver {

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
import { TestRunner, RunResult, RunOptions, RunnerOptions } from 'stryker-api/test_runner';

@@ -2,0 +3,0 @@ export default class TestRunnerChildProcessAdapter implements TestRunner {

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
import { Location, Range } from 'stryker-api/core';

@@ -14,4 +15,4 @@ import { RunResult } from 'stryker-api/test_runner';

private _timeSpentScopedTests;
scopedTestIds: number[];
timeSpentScopedTests: number;
readonly scopedTestIds: number[];
readonly timeSpentScopedTests: number;
addRunResultForTest(index: number, runResult: RunResult): void;

@@ -21,7 +22,7 @@ constructor(mutatorName: string, filename: string, originalCode: string, replacement: string, location: Location, range: Range);

private getMutationLineIndexes();
originalLines: string;
mutatedLines: string;
private mutatedCode;
readonly originalLines: string;
readonly mutatedLines: string;
private readonly mutatedCode;
save(filename: string): Promise<void>;
reset(filename: string): Promise<void>;
}

@@ -58,6 +58,6 @@ "use strict";

MutantRunResultMatcher.prototype.statementCoversMutant = function (mutant, location) {
var mutantIsAfterStart = mutant.location.end.line > location.start.line ||
(mutant.location.end.line === location.start.line && mutant.location.end.column >= location.start.column);
var mutantIsBeforeEnd = mutant.location.start.line < location.end.line ||
(mutant.location.start.line === location.end.line && mutant.location.start.column <= location.end.column);
var mutantIsAfterStart = mutant.location.start.line > location.start.line ||
(mutant.location.start.line === location.start.line && mutant.location.start.column >= location.start.column);
var mutantIsBeforeEnd = mutant.location.end.line < location.end.line ||
(mutant.location.end.line === location.end.line && mutant.location.end.column <= location.end.column);
return mutantIsAfterStart && mutantIsBeforeEnd;

@@ -64,0 +64,0 @@ };

"use strict";
var _ = require('lodash');
var BinaryOperatorMutator_1 = require('./mutators/BinaryOperatorMutator');
var BlockStatementMutator_1 = require('./mutators/BlockStatementMutator');
var ConditionalBoundaryMutator_1 = require('./mutators/ConditionalBoundaryMutator');
var MathMutator_1 = require('./mutators/MathMutator');
var LogicalOperatorMutator_1 = require('./mutators/LogicalOperatorMutator');
var RemoveConditionalsMutator_1 = require('./mutators/RemoveConditionalsMutator');
var ReverseConditionalMutator_1 = require('./mutators/ReverseConditionalMutator');
var UnaryOperatorMutator_1 = require('./mutators/UnaryOperatorMutator');
var UpdateOperatorMutator_1 = require('./mutators/UpdateOperatorMutator');
var mutant_1 = require('stryker-api/mutant');

@@ -65,8 +64,8 @@ var fileUtils = require('./utils/fileUtils');

var mutatorFactory = mutant_1.MutatorFactory.instance();
mutatorFactory.register('BinaryOperator', BinaryOperatorMutator_1.default);
mutatorFactory.register('BlockStatement', BlockStatementMutator_1.default);
mutatorFactory.register('ConditionalBoundary', ConditionalBoundaryMutator_1.default);
mutatorFactory.register('Math', MathMutator_1.default);
mutatorFactory.register('LogicalOperator', LogicalOperatorMutator_1.default);
mutatorFactory.register('RemoveConditionals', RemoveConditionalsMutator_1.default);
mutatorFactory.register('ReverseConditional', ReverseConditionalMutator_1.default);
mutatorFactory.register('UnaryOperator', UnaryOperatorMutator_1.default);
mutatorFactory.register('UpdateOperator', UpdateOperatorMutator_1.default);
};

@@ -81,13 +80,16 @@ MutatorOrchestrator.prototype.findMutants = function (sourceFile, originalCode, ast, nodes) {

try {
var mutatedNodes = mutator.applyMutations(astnode, function (node, deepClone) {
return deepClone ? _.cloneDeep(node) : _.clone(node);
});
if (mutatedNodes.length > 0) {
log.debug("The mutator '" + mutator.name + "' mutated " + mutatedNodes.length + " node" + (mutatedNodes.length > 1 ? 's' : '') + " between (Ln " + astnode.loc.start.line + ", Col " + astnode.loc.start.column + ") and (Ln " + astnode.loc.end.line + ", Col " + astnode.loc.end.column + ") in file " + sourceFile);
var mutatedNodes = mutator.applyMutations(astnode, objectUtils_1.copy);
if (mutatedNodes) {
if (!Array.isArray(mutatedNodes)) {
mutatedNodes = [mutatedNodes];
}
if (mutatedNodes.length > 0) {
log.debug("The mutator '" + mutator.name + "' mutated " + mutatedNodes.length + " node" + (mutatedNodes.length > 1 ? 's' : '') + " between (Ln " + astnode.loc.start.line + ", Col " + astnode.loc.start.column + ") and (Ln " + astnode.loc.end.line + ", Col " + astnode.loc.end.column + ") in file " + sourceFile);
}
mutatedNodes.forEach(function (mutatedNode) {
var mutatedCode = parserUtils.generate(mutatedNode);
var originalNode = nodes[mutatedNode.nodeID];
mutants.push(new Mutant_1.default(mutator.name, sourceFile, originalCode, mutatedCode, originalNode.loc, originalNode.range));
});
}
mutatedNodes.forEach(function (mutatedNode) {
var mutatedCode = parserUtils.generate(mutatedNode);
var originalNode = nodes[mutatedNode.nodeID];
mutants.push(new Mutant_1.default(mutator.name, sourceFile, originalCode, mutatedCode, originalNode.loc, originalNode.range));
});
}

@@ -94,0 +96,0 @@ catch (error) {

import { Mutator } from 'stryker-api/mutant';
import * as estree from 'estree';
export default class BlockStatementMutator implements Mutator {
name: string;
private types;
private type;
constructor();
applyMutations(node: ESTree.Node, copy: (obj: any, deep?: boolean) => any): ESTree.Node[];
private canMutate(node);
applyMutations(node: estree.Node, copy: <T>(obj: T, deep?: boolean) => T): void | estree.Node | estree.Node[];
}

@@ -6,17 +6,11 @@ "use strict";

this.name = 'BlockStatement';
this.types = [esprima_1.Syntax.BlockStatement];
this.type = esprima_1.Syntax.BlockStatement;
}
BlockStatementMutator.prototype.applyMutations = function (node, copy) {
var nodes = [];
if (this.canMutate(node)) {
if (node.type === esprima_1.Syntax.BlockStatement) {
var mutatedNode = copy(node);
mutatedNode.body = [];
nodes.push(mutatedNode);
return mutatedNode;
}
return nodes;
};
BlockStatementMutator.prototype.canMutate = function (node) {
return !!(node && this.types.indexOf(node.type) >= 0);
};
;
return BlockStatementMutator;

@@ -23,0 +17,0 @@ }());

import { Mutator } from 'stryker-api/mutant';
import * as estree from 'estree';
export default class RemoveConditionalsMutator implements Mutator {

@@ -6,6 +7,5 @@ name: string;

constructor();
applyMutations(node: ESTree.Node, copy: (obj: any, deep?: boolean) => any): ESTree.Node[];
private mutateTestExpression(node, newValue);
applyMutations(node: estree.Node, copy: <T>(obj: T, deep?: boolean) => T): estree.Node[] | void;
private booleanLiteralNode(nodeID, value);
private canMutate(node);
private copyNode(node);
}

@@ -6,29 +6,26 @@ "use strict";

this.name = 'RemoveConditionals';
this.types = [esprima_1.Syntax.DoWhileStatement, esprima_1.Syntax.IfStatement, esprima_1.Syntax.ForStatement, esprima_1.Syntax.WhileStatement];
this.types = [esprima_1.Syntax.DoWhileStatement, esprima_1.Syntax.IfStatement, esprima_1.Syntax.ForStatement, esprima_1.Syntax.WhileStatement, esprima_1.Syntax.ConditionalExpression];
}
RemoveConditionalsMutator.prototype.applyMutations = function (node, copy) {
var nodes = [];
if (this.canMutate(node)) {
var mutatedFalseNode = copy(node.test);
this.mutateTestExpression(mutatedFalseNode, false);
nodes.push(mutatedFalseNode);
if (node.type === esprima_1.Syntax.IfStatement) {
var mutatedTrueNode = copy(node.test);
this.mutateTestExpression(mutatedTrueNode, true);
nodes.push(mutatedTrueNode);
var nodes = [];
nodes.push(this.booleanLiteralNode(node.test.nodeID, false));
if (node.type === esprima_1.Syntax.IfStatement || node.type === esprima_1.Syntax.ConditionalExpression) {
nodes.push(this.booleanLiteralNode(node.test.nodeID, true));
}
return nodes;
}
return nodes;
};
RemoveConditionalsMutator.prototype.mutateTestExpression = function (node, newValue) {
node.type = esprima_1.Syntax.Literal;
node.value = newValue;
RemoveConditionalsMutator.prototype.booleanLiteralNode = function (nodeID, value) {
return {
nodeID: nodeID,
type: esprima_1.Syntax.Literal,
value: value,
raw: value.toString()
};
};
RemoveConditionalsMutator.prototype.canMutate = function (node) {
return !!(node && this.types.indexOf(node.type) >= 0);
return this.types.indexOf(node.type) >= 0;
};
;
RemoveConditionalsMutator.prototype.copyNode = function (node) {
return JSON.parse(JSON.stringify(node));
};
return RemoveConditionalsMutator;

@@ -35,0 +32,0 @@ }());

@@ -1,4 +0,8 @@

import OperatorMutator from './OperatorMutator';
export default class UnaryOperatorMutator extends OperatorMutator {
constructor();
import { Mutator } from 'stryker-api/mutant';
import * as estree from 'estree';
export default class UnaryOperatorMutator implements Mutator {
name: string;
private type;
private operators;
applyMutations(node: estree.Node, copy: <T>(obj: T, deep?: boolean) => T): estree.Node[];
}
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var esprima_1 = require('esprima');
var OperatorMutator_1 = require('./OperatorMutator');
var UnaryOperatorMutator = (function (_super) {
__extends(UnaryOperatorMutator, _super);
var UnaryOperatorMutator = (function () {
function UnaryOperatorMutator() {
_super.call(this, 'UnaryOperator', [esprima_1.Syntax.UpdateExpression, esprima_1.Syntax.UnaryExpression], {
'++': '--',
'--': '++',
'-': '+',
'+': '-' });
this.name = 'UnaryOperator';
this.type = esprima_1.Syntax.UnaryExpression;
this.operators = {
'+': '-',
'-': '+'
};
}
UnaryOperatorMutator.prototype.applyMutations = function (node, copy) {
var nodes = [];
if (node.type === esprima_1.Syntax.UnaryExpression && this.operators[node.operator]) {
var mutatedNode = copy(node);
mutatedNode.operator = this.operators[node.operator];
nodes.push(mutatedNode);
}
return nodes;
};
return UnaryOperatorMutator;
}(OperatorMutator_1.default));
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = UnaryOperatorMutator;
//# sourceMappingURL=UnaryOperatorMutator.js.map

@@ -21,8 +21,8 @@ "use strict";

if (pluginExpression.indexOf('*') !== -1) {
var pluginDirectory = path.normalize(__dirname + '/../..');
var regexp = new RegExp('^' + pluginExpression.replace('*', '.*'));
log.debug('Loading %s from %s', pluginExpression, pluginDirectory);
var plugins = fs.readdirSync(pluginDirectory)
.filter(function (pluginName) { return IGNORED_PACKAGES.indexOf(pluginName) === -1 && regexp.test(pluginName); })
.map(function (pluginName) { return pluginDirectory + '/' + pluginName; });
var pluginDirectory_1 = path.normalize(__dirname + '/../..');
var regexp_1 = new RegExp('^' + pluginExpression.replace('*', '.*'));
log.debug('Loading %s from %s', pluginExpression, pluginDirectory_1);
var plugins = fs.readdirSync(pluginDirectory_1)
.filter(function (pluginName) { return IGNORED_PACKAGES.indexOf(pluginName) === -1 && regexp_1.test(pluginName); })
.map(function (pluginName) { return pluginDirectory_1 + '/' + pluginName; });
if (plugins.length === 0) {

@@ -29,0 +29,0 @@ log.debug('Expression %s not resulted in plugins to load', pluginExpression);

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
import { Reporter } from 'stryker-api/report';

@@ -9,3 +10,3 @@ import { StrykerOptions } from 'stryker-api/core';

constructor(options: StrykerOptions);
private baseFolder;
private readonly baseFolder;
private writeToFile(index, methodName, data);

@@ -12,0 +13,0 @@ private format(input);

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
import { Config } from 'stryker-api/config';

@@ -2,0 +3,0 @@ import { StrykerOptions } from 'stryker-api/core';

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
import { StrykerOptions, InputFile } from 'stryker-api/core';

@@ -2,0 +3,0 @@ import { RunResult } from 'stryker-api/test_runner';

@@ -21,2 +21,3 @@ "use strict";

TestRunnerOrchestrator.prototype.initialRun = function () {
log.info("Starting initial test run. This may take a while.");
if (this.testSelector) {

@@ -58,13 +59,13 @@ return this.initialRunWithTestSelector();

else {
var mutant = mutants.pop();
if (mutant.scopedTestIds.length > 0) {
var mutant_1 = mutants.pop();
if (mutant_1.scopedTestIds.length > 0) {
var sandbox_1 = sandboxes.pop();
var sourceFileCopy_1 = sandbox_1.fileMap[mutant.filename];
return Promise.all([mutant.save(sourceFileCopy_1), _this.selectTestsIfPossible(sandbox_1, mutant.scopedTestIds)])
.then(function () { return sandbox_1.runner.run({ timeout: _this.calculateTimeout(mutant.timeSpentScopedTests) }); })
var sourceFileCopy_1 = sandbox_1.fileMap[mutant_1.filename];
return Promise.all([mutant_1.save(sourceFileCopy_1), _this.selectTestsIfPossible(sandbox_1, mutant_1.scopedTestIds)])
.then(function () { return sandbox_1.runner.run({ timeout: _this.calculateTimeout(mutant_1.timeSpentScopedTests) }); })
.then(function (runResult) {
var result = _this.collectFrozenMutantResult(mutant, runResult);
var result = _this.collectFrozenMutantResult(mutant_1, runResult);
results.push(result);
_this.reporter.onMutantTested(result);
return mutant.reset(sourceFileCopy_1);
return mutant_1.reset(sourceFileCopy_1);
})

@@ -74,3 +75,3 @@ .then(function () { return sandboxes.push(sandbox_1); });

else {
var result = _this.collectFrozenMutantResult(mutant);
var result = _this.collectFrozenMutantResult(mutant_1);
results.push(result);

@@ -77,0 +78,0 @@ return Promise.resolve(_this.reporter.onMutantTested(result));

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
export declare function fileOrFolderExistsSync(path: string): boolean;

@@ -2,0 +3,0 @@ export declare function fileOrFolderExists(path: string): Promise<boolean>;

@@ -9,6 +9,6 @@ 'use strict';

try {
var stats = fs.lstatSync(path);
fs.lstatSync(path);
return true;
}
catch (errror) {
catch (error) {
return false;

@@ -15,0 +15,0 @@ }

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
export declare var serialize: (obj: any) => string;

@@ -7,1 +8,2 @@ export declare function freezeRecursively(target: {

export declare function deserialize(serializedJavascript: String): any;
export declare function copy<T>(obj: T, deep?: boolean): T;

@@ -21,2 +21,11 @@ "use strict";

exports.deserialize = deserialize;
function copy(obj, deep) {
if (deep) {
return _.cloneDeep(obj);
}
else {
return _.clone(obj);
}
}
exports.copy = copy;
//# sourceMappingURL=objectUtils.js.map

@@ -0,3 +1,4 @@

import * as estree from 'estree';
export declare function parse(code: string): any;
export declare function collectFrozenNodes(abstractSyntaxTree: any, nodes?: any[]): any[];
export declare function generate(node: ESTree.Node): string;
export declare function generate(node: estree.Node): string;

@@ -0,1 +1,2 @@

/// <reference types="es6-promise" />
declare var _default: {

@@ -2,0 +3,0 @@ createRandomFolder: (prefix: string) => string;

@@ -26,3 +26,3 @@ "use strict";

try {
var stats = fs.lstatSync(path);
fs.lstatSync(path);
return true;

@@ -29,0 +29,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc