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.5.6 to 0.5.7

src/reporters/ProgressAppendOnlyReporter.d.ts

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.5.7"></a>
## [0.5.7](https://github.com/stryker-mutator/stryker/compare/v0.5.6...v0.5.7) (2017-01-16)
### Features
* **append-only-progress:** Implement new reporter ([#213](https://github.com/stryker-mutator/stryker/issues/213)) ([7b68506](https://github.com/stryker-mutator/stryker/commit/7b68506))
<a name="0.5.6"></a>

@@ -2,0 +12,0 @@ ## [0.5.6](https://github.com/stryker-mutator/stryker/compare/v0.5.5...v0.5.6) (2016-12-31)

2

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

@@ -5,0 +5,0 @@ "main": "src/Stryker.js",

@@ -14,3 +14,10 @@ "use strict";

var nodes = [];
nodes.push(this.booleanLiteralNode(node.test.nodeID, false));
if (node.test) {
nodes.push(this.booleanLiteralNode(node.test.nodeID, false));
}
else {
var mutatedNode = copy(node);
mutatedNode.test = this.booleanLiteralNode(null, false);
nodes.push(mutatedNode);
}
if (node.type === esprima_1.Syntax.IfStatement || node.type === esprima_1.Syntax.ConditionalExpression) {

@@ -17,0 +24,0 @@ nodes.push(this.booleanLiteralNode(node.test.nodeID, true));

@@ -7,4 +7,4 @@ import { StrykerOptions } from 'stryker-api/core';

createBroadcastReporter(): Reporter;
private createReporter(name);
private logPossibleReporters();
private registerDefaultReporters();
}

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

var ProgressReporter_1 = require("./reporters/ProgressReporter");
var ProgressAppendOnlyReporter_1 = require("./reporters/ProgressAppendOnlyReporter");
var DotsReporter_1 = require("./reporters/DotsReporter");

@@ -11,6 +12,13 @@ var EventRecorderReporter_1 = require("./reporters/EventRecorderReporter");

var log = log4js.getLogger('ReporterOrchestrator');
function registerDefaultReporters() {
report_1.ReporterFactory.instance().register('progress-append-only', ProgressAppendOnlyReporter_1.default);
report_1.ReporterFactory.instance().register('progress', ProgressReporter_1.default);
report_1.ReporterFactory.instance().register('dots', DotsReporter_1.default);
report_1.ReporterFactory.instance().register('clear-text', ClearTextReporter_1.default);
report_1.ReporterFactory.instance().register('event-recorder', EventRecorderReporter_1.default);
}
registerDefaultReporters();
var ReporterOrchestrator = (function () {
function ReporterOrchestrator(options) {
this.options = options;
this.registerDefaultReporters();
}

@@ -23,6 +31,6 @@ ReporterOrchestrator.prototype.createBroadcastReporter = function () {

if (Array.isArray(reporterOption)) {
reporterOption.forEach(function (reporterName) { return reporters.push({ name: reporterName, reporter: report_1.ReporterFactory.instance().create(reporterName, _this.options) }); });
reporterOption.forEach(function (reporterName) { return reporters.push(_this.createReporter(reporterName)); });
}
else {
reporters.push({ name: reporterOption, reporter: report_1.ReporterFactory.instance().create(reporterOption, this.options) });
reporters.push(this.createReporter(reporterOption));
}

@@ -36,2 +44,11 @@ }

};
ReporterOrchestrator.prototype.createReporter = function (name) {
if (name === 'progress' && !process.stdout['isTTY']) {
log.info('Detected that current console does not support the "progress" reporter, downgrading to "progress-append-only" reporter');
return { name: 'progress-append-only', reporter: report_1.ReporterFactory.instance().create('progress-append-only', this.options) };
}
else {
return { name: name, reporter: report_1.ReporterFactory.instance().create(name, this.options) };
}
};
ReporterOrchestrator.prototype.logPossibleReporters = function () {

@@ -47,8 +64,2 @@ var possibleReportersCsv = '';

};
ReporterOrchestrator.prototype.registerDefaultReporters = function () {
report_1.ReporterFactory.instance().register('progress', ProgressReporter_1.default);
report_1.ReporterFactory.instance().register('dots', DotsReporter_1.default);
report_1.ReporterFactory.instance().register('clear-text', ClearTextReporter_1.default);
report_1.ReporterFactory.instance().register('event-recorder', EventRecorderReporter_1.default);
};
return ReporterOrchestrator;

@@ -55,0 +66,0 @@ }());

@@ -1,8 +0,9 @@

import { Reporter, MatchedMutant, MutantResult } from 'stryker-api/report';
export default class ProgressReporter implements Reporter {
import { MatchedMutant, MutantResult } from 'stryker-api/report';
import ProgressKeeper from './ProgressKeeper';
export default class ProgressBarReporter extends ProgressKeeper {
private progressBar;
private tickValues;
onAllMutantsMatchedWithTests(matchedMutants: ReadonlyArray<MatchedMutant>): void;
onMutantTested(result: MutantResult): void;
tick(): void;
private tick();
private render();
}
"use strict";
var report_1 = require("stryker-api/report");
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 ProgressKeeper_1 = require("./ProgressKeeper");
var ProgressBar_1 = require("./ProgressBar");
var chalk = require("chalk");
var ProgressReporter = (function () {
function ProgressReporter() {
// tickValues contains Labels, because on initation of the ProgressBar the width is determined based on the amount of characters of the progressBarContent inclusive ASCII-codes for colors
this.tickValues = {
error: 0,
survived: 0,
killed: 0,
timeout: 0,
noCoverage: 0,
killedLabel: chalk.green.bold('killed'),
survivedLabel: chalk.red.bold('survived'),
noCoverageLabel: chalk.red.bold('no coverage'),
timeoutLabel: chalk.yellow.bold('timeout'),
errorLabel: chalk.yellow.bold('error')
};
var ProgressBarReporter = (function (_super) {
__extends(ProgressBarReporter, _super);
function ProgressBarReporter() {
return _super.apply(this, arguments) || this;
}
ProgressReporter.prototype.onAllMutantsMatchedWithTests = function (matchedMutants) {
var progressBarContent;
progressBarContent =
"Mutation testing [:bar] :percent (ETC :etas)" +
"[:killed :killedLabel] " +
"[:survived :survivedLabel] " +
"[:noCoverage :noCoverageLabel] " +
"[:timeout :timeoutLabel] " +
"[:error :errorLabel]";
ProgressBarReporter.prototype.onAllMutantsMatchedWithTests = function (matchedMutants) {
_super.prototype.onAllMutantsMatchedWithTests.call(this, matchedMutants);
var progressBarContent = "Mutation testing [:bar] :percent (ETC :etas)" +
"[:killed :killedLabel] " +
"[:survived :survivedLabel] " +
"[:noCoverage :noCoverageLabel] " +
"[:timeout :timeoutLabel] " +
"[:error :errorLabel]";
this.progressBar = new ProgressBar_1.default(progressBarContent, {

@@ -34,36 +26,26 @@ width: 50,

incomplete: ' ',
total: matchedMutants.filter(function (m) { return m.scopedTestIds.length > 0; }).length
stream: process.stdout,
total: this.progress.totalCount
});
};
ProgressReporter.prototype.onMutantTested = function (result) {
switch (result.status) {
case report_1.MutantStatus.NoCoverage:
this.tickValues.noCoverage++;
this.progressBar.render(this.tickValues);
break;
case report_1.MutantStatus.Killed:
this.tickValues.killed++;
this.tick();
break;
case report_1.MutantStatus.Survived:
this.tickValues.survived++;
this.tick();
break;
case report_1.MutantStatus.TimedOut:
this.tickValues.timeout++;
this.tick();
break;
case report_1.MutantStatus.Error:
this.tickValues.error++;
this.tick();
break;
ProgressBarReporter.prototype.onMutantTested = function (result) {
var ticksBefore = this.progress.testedCount;
_super.prototype.onMutantTested.call(this, result);
if (ticksBefore < this.progress.testedCount) {
this.tick();
}
else {
this.render();
}
};
ProgressReporter.prototype.tick = function () {
this.progressBar.tick(this.tickValues);
ProgressBarReporter.prototype.tick = function () {
this.progressBar.tick(this.progress);
};
return ProgressReporter;
}());
ProgressBarReporter.prototype.render = function () {
this.progressBar.render(this.progress);
};
return ProgressBarReporter;
}(ProgressKeeper_1.default));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ProgressReporter;
exports.default = ProgressBarReporter;
//# sourceMappingURL=ProgressReporter.js.map

@@ -6,4 +6,5 @@ export default class Timer {

humanReadableElapsed(): string;
elapsedSeconds(): number;
private static humanReadableElapsedSeconds(elapsedSeconds);
private static humanReadableElapsedMinutes(elapsedSeconds);
}

@@ -10,6 +10,9 @@ "use strict";

Timer.prototype.humanReadableElapsed = function () {
var elapsedMs = new Date().getTime() - this.start.getTime();
var elapsedSeconds = Math.floor(elapsedMs / 1000);
var elapsedSeconds = this.elapsedSeconds();
return Timer.humanReadableElapsedMinutes(elapsedSeconds) + Timer.humanReadableElapsedSeconds(elapsedSeconds);
};
Timer.prototype.elapsedSeconds = function () {
var elapsedMs = new Date().getTime() - this.start.getTime();
return Math.floor(elapsedMs / 1000);
};
Timer.humanReadableElapsedSeconds = function (elapsedSeconds) {

@@ -16,0 +19,0 @@ var restSeconds = elapsedSeconds % 60;

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