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

stryker

Package Overview
Dependencies
Maintainers
3
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.23.0 to 0.24.0

src/reporters/ci/CircleProvider.d.ts

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="0.24.0"></a>
# [0.24.0](https://github.com/stryker-mutator/stryker/compare/stryker@0.23.0...stryker@0.24.0) (2018-05-21)
### Features
* **Dashboard reporter:** add support for CircleCI ([a58afff](https://github.com/stryker-mutator/stryker/commit/a58afff))
<a name="0.23.0"></a>

@@ -8,0 +19,0 @@ # [0.23.0](https://github.com/stryker-mutator/stryker/compare/stryker@0.22.4...stryker@0.23.0) (2018-04-30)

11

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

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

"glob": "^7.0.3",
"inquirer": "^3.0.6",
"inquirer": "^5.2.0",
"istanbul-lib-instrument": "^1.9.2",

@@ -71,3 +71,3 @@ "lodash": "^4.17.4",

"rimraf": "^2.6.1",
"rxjs": "^5.4.3",
"rxjs": "^6.0.0",
"source-map": "^0.6.1",

@@ -79,8 +79,7 @@ "surrial": "^0.1.3",

"devDependencies": {
"@types/commander": "^2.9.0",
"@types/inquirer": "0.0.35",
"@types/inquirer": "0.0.41",
"@types/istanbul-lib-instrument": "^1.7.0",
"@types/prettier": "^1.6.0",
"@types/progress": "^2.0.1",
"stryker-api": "^0.17.0"
"stryker-api": "^0.17.1"
},

@@ -87,0 +86,0 @@ "peerDependencies": {

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

The `dashboard` reporter is a special kind of reporter. It sends a report to https://dashboard.stryker-mutator.io, enabling you to add a fancy mutation score badge to your readme! To make sure no unwanted results are sent to the dashboards, it will only send the report if it is run from a build server. The only build server supported at the moment is travis (please open an [issue](https://github.com/stryker-mutator/stryker/issues/new) if your build server is missing). The reporter uses these environment settings:
The `dashboard` reporter is a special kind of reporter. It sends a report to https://dashboard.stryker-mutator.io, enabling you to add a fancy mutation score badge to your readme! To make sure no unwanted results are sent to the dashboards, it will only send the report if it is run from a build server. The reporter currently detects [Travis](https://travis-ci.org/) and [CircleCI](https://circleci.com/). Please open an [issue](https://github.com/stryker-mutator/stryker/issues/new) if your build server is missing. On all these environments, it will ignore builds of pull requests. Apart from buildserver-specific environment variables, the reporter uses one environment variable:
| Environment variable | Description | Example value |
| Environment variable | Description | Example value |
| ------------- | ------------- | ----- |
| TRAVIS | Make sure we're running on the build server | TRUE |
| TRAVIS\_PULL\_REQUEST | All PR builds are ignored by default | false |
| TRAVIS\_BRANCH | The branch to be sent along with the report | master |
| STRYKER\_DASHBOARD\_API\_KEY | Your api key (generated for this repository on https://dashboard.stryker-mutator.io) | `52248872-2edc-4102-a43a-bcfca7a9ca99` |
| STRYKER\_DASHBOARD\_API\_KEY | Your API key (generated at https://dashboard.stryker-mutator.io) | `52248872-2edc-4102-a43a-bcfca7a9ca99` |
All `TRAVIS` environment variables are set by Travis for each build. However, you will need to pass the `STRYKER\_DASHBOARD\_API\_KEY` environment variable yourself. You can create one for your repository by logging in on [the stryker dashboard](https://dashboard.stryker-mutator.io). We strongly recommend you use [encrypted environment variables](https://docs.travis-ci.com/user/environment-variables/#Encrypting-environment-variables).
You will need to pass the `STRYKER_DASHBOARD_API_KEY` environment variable yourself. You can create one for your repository by logging in on [the Stryker dashboard](https://dashboard.stryker-mutator.io). We strongly recommend you use encrypted environment variables:
* [Travis documentation](https://docs.travis-ci.com/user/environment-variables/#Encrypting-environment-variables)
* [CircleCI documentation](https://circleci.com/security/#secrets_section)

@@ -267,11 +266,13 @@ #### Files in the sandbox

When Stryker is mutating code, it cannot determine indefinitely whether or not a code mutation results in an infinite loop (see [Halting problem](https://en.wikipedia.org/wiki/Halting_problem)).
In order to battle infinite loops, a test run gets killed after a certain period. This period is configurable with two settings: `timeoutMs` and `timeoutFactor`.
In order to battle infinite loops, a test run gets killed after a certain period of time. This period is configurable with two settings: `timeoutMs` and `timeoutFactor`.
To calculate the actual timeout in milliseconds the, following formula is used:
```
timeoutForTestRunMs = timeOfTheInitialTestRunMs * timeoutFactor + timeoutMs
timeoutForTestRunMs = netTimeMs * timeoutFactor + timeoutMs + overheadMs
```
Both `netTimeMs` and `overheadMs` are calculated during the initial test run. They are logged on `info` level. For example when `overheadMs` is 92 and `netTimeMs` is 5: `Initial test run succeeded. Ran 6 tests in 4 seconds (net 5 ms, overhead 92 ms).`
With `timeoutFactor` you can configure the allowed deviation relative to the time of a normal test run. Tweak this if you notice that mutants are prone to creating slower code, but not infinite loops.
`timeoutMs` lets you configure an absolute deviation. Use it, if you run Stryker on a busy machine and you need to wait longer to make sure that the code indeed entered an infinite loop.
`timeoutMs` lets you configure an absolute deviation. Use it, if you run Stryker on a busy machine and you need to wait longer to make sure that the code indeed entered an infinite loop.

@@ -278,0 +279,0 @@ #### Timeout factor

@@ -0,0 +0,0 @@ export declare type ChildProxy<T> = {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export default class ChildProcessProxyWorker {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum WorkerMessageKind {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Config } from 'stryker-api/config';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { TestFramework } from 'stryker-api/test_framework';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { StatementMap } from 'stryker-api/test_runner';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=FileStatements.js.map

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

@@ -0,0 +0,0 @@ import { RestClient } from 'typed-rest-client/RestClient';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface PromptOption {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=PromptOption.js.map

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NpmClient from './NpmClient';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import PromptOption from './PromptOption';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { File } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import StrictReporter from '../reporters/StrictReporter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { RunnerOptions } from 'stryker-api/test_runner';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IsolatedRunnerOptions.js.map

@@ -0,0 +0,0 @@ /// <reference types="node" />

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=MessageProtocol.js.map

@@ -0,0 +0,0 @@ import IsolatedRunnerOptions from './IsolatedRunnerOptions';

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

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { File } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Config } from 'stryker-api/config';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Node } from 'estree';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IdentifiedNode.js.map

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IdentifiedNode } from './IdentifiedNode';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=NodeMutator.js.map

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NodeMutator from './NodeMutator';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export default class PluginLoader {

@@ -0,0 +0,0 @@ "use strict";

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

runResult: RunResult;
overheadTimeMS: number;
sourceMapper: SourceMapper;

@@ -25,4 +26,12 @@ coverageMaps: CoverageMapsByFile;

private annotateForCodeCoverage(files, sourceMapper);
private validateResult(runResult);
private validateResult(runResult, timing);
/**
* Calculates the timing variables for the test run.
* grossTime = NetTime + overheadTime
*
* The overhead time is used to calculate exact timeout values during mutation testing.
* See timeoutMs setting in README for more information on this calculation
*/
private calculateTiming(grossTimeMS, tests);
/**
* Creates a facade for the transpile pipeline.

@@ -36,3 +45,3 @@ * Also includes the coverage instrumenter transpiler,

private filterOutFailedTests(runResult);
private logInitialTestRunSucceeded(tests);
private logInitialTestRunSucceeded(tests, timing);
private logFailedTestsInInitialRun(failedTests);

@@ -39,0 +48,0 @@ private logErrorsInInitialRun(runResult);

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

var INITIAL_RUN_TIMEOUT = 60 * 1000 * 5;
var INITIAL_TEST_RUN_MARKER = 'Initial test run';
var InitialTestExecutor = /** @class */ (function () {

@@ -27,5 +28,5 @@ function InitialTestExecutor(options, inputFiles, testFramework, timer) {

return tslib_1.__awaiter(this, void 0, void 0, function () {
var transpiledFiles, sourceMapper, _a, coverageMaps, instrumentedFiles, runResult;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
var transpiledFiles, sourceMapper, _a, coverageMaps, instrumentedFiles, _b, runResult, grossTimeMS, timing;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -35,13 +36,15 @@ this.log.info("Starting initial test run. This may take a while.");

case 1:
transpiledFiles = _b.sent();
transpiledFiles = _c.sent();
sourceMapper = SourceMapper_1.default.create(transpiledFiles, this.options);
return [4 /*yield*/, this.annotateForCodeCoverage(transpiledFiles, sourceMapper)];
case 2:
_a = _b.sent(), coverageMaps = _a.coverageMaps, instrumentedFiles = _a.instrumentedFiles;
_a = _c.sent(), coverageMaps = _a.coverageMaps, instrumentedFiles = _a.instrumentedFiles;
this.logTranspileResult(instrumentedFiles);
return [4 /*yield*/, this.runInSandbox(instrumentedFiles)];
case 3:
runResult = _b.sent();
this.validateResult(runResult);
_b = _c.sent(), runResult = _b.runResult, grossTimeMS = _b.grossTimeMS;
timing = this.calculateTiming(grossTimeMS, runResult.tests);
this.validateResult(runResult, timing);
return [2 /*return*/, {
overheadTimeMS: timing.overhead,
sourceMapper: sourceMapper,

@@ -57,15 +60,17 @@ runResult: runResult,

return tslib_1.__awaiter(this, void 0, void 0, function () {
var sandbox, runResult;
var sandbox, runResult, grossTimeMS;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Sandbox_1.default.create(this.options, 0, files, this.testFramework)];
case 0: return [4 /*yield*/, Sandbox_1.default.create(this.options, 0, files, this.testFramework, 0)];
case 1:
sandbox = _a.sent();
this.timer.mark(INITIAL_TEST_RUN_MARKER);
return [4 /*yield*/, sandbox.run(INITIAL_RUN_TIMEOUT, this.getCollectCoverageHooksIfNeeded())];
case 2:
runResult = _a.sent();
grossTimeMS = this.timer.elapsedMs(INITIAL_TEST_RUN_MARKER);
return [4 /*yield*/, sandbox.dispose()];
case 3:
_a.sent();
return [2 /*return*/, runResult];
return [2 /*return*/, { runResult: runResult, grossTimeMS: grossTimeMS }];
}

@@ -104,3 +109,3 @@ });

};
InitialTestExecutor.prototype.validateResult = function (runResult) {
InitialTestExecutor.prototype.validateResult = function (runResult, timing) {
switch (runResult.status) {

@@ -118,3 +123,3 @@ case test_runner_1.RunStatus.Complete:

else {
this.logInitialTestRunSucceeded(runResult.tests);
this.logInitialTestRunSucceeded(runResult.tests, timing);
return;

@@ -132,2 +137,17 @@ }

/**
* Calculates the timing variables for the test run.
* grossTime = NetTime + overheadTime
*
* The overhead time is used to calculate exact timeout values during mutation testing.
* See timeoutMs setting in README for more information on this calculation
*/
InitialTestExecutor.prototype.calculateTiming = function (grossTimeMS, tests) {
var netTimeMS = tests.reduce(function (total, test) { return total + test.timeSpentMs; }, 0);
var overheadTimeMS = grossTimeMS - netTimeMS;
return {
overhead: overheadTimeMS < 0 ? 0 : overheadTimeMS,
net: netTimeMS
};
};
/**
* Creates a facade for the transpile pipeline.

@@ -166,4 +186,4 @@ * Also includes the coverage instrumenter transpiler,

};
InitialTestExecutor.prototype.logInitialTestRunSucceeded = function (tests) {
this.log.info('Initial test run succeeded. Ran %s tests in %s.', tests.length, this.timer.humanReadableElapsed());
InitialTestExecutor.prototype.logInitialTestRunSucceeded = function (tests, timing) {
this.log.info('Initial test run succeeded. Ran %s tests in %s (net %s ms, overhead %s ms).', tests.length, this.timer.humanReadableElapsed(), timing.net, timing.overhead);
};

@@ -170,0 +190,0 @@ InitialTestExecutor.prototype.logFailedTestsInInitialRun = function (failedTests) {

@@ -0,7 +1,7 @@

import { Config } from 'stryker-api/config';
import { File } from 'stryker-api/core';
import { MutantResult } from 'stryker-api/report';
import { Config } from 'stryker-api/config';
import { TestFramework } from 'stryker-api/test_framework';
import { File } from 'stryker-api/core';
import TestableMutant from '../TestableMutant';
import StrictReporter from '../reporters/StrictReporter';
import TestableMutant from '../TestableMutant';
export default class MutationTestExecutor {

@@ -12,5 +12,6 @@ private config;

private reporter;
constructor(config: Config, inputFiles: ReadonlyArray<File>, testFramework: TestFramework | null, reporter: StrictReporter);
private overheadTimeMS;
constructor(config: Config, inputFiles: ReadonlyArray<File>, testFramework: TestFramework | null, reporter: StrictReporter, overheadTimeMS: number);
run(allMutants: TestableMutant[]): Promise<MutantResult[]>;
private runInsideSandboxes(sandboxes, transpiledMutants);
}

@@ -5,8 +5,9 @@ "use strict";

var rxjs_1 = require("rxjs");
var operators_1 = require("rxjs/operators");
var report_1 = require("stryker-api/report");
var test_runner_1 = require("stryker-api/test_runner");
var report_1 = require("stryker-api/report");
var SandboxPool_1 = require("../SandboxPool");
var MutantTranspiler_1 = require("../transpiler/MutantTranspiler");
var SandboxPool_1 = require("../SandboxPool");
var MutationTestExecutor = /** @class */ (function () {
function MutationTestExecutor(config, inputFiles, testFramework, reporter) {
function MutationTestExecutor(config, inputFiles, testFramework, reporter, overheadTimeMS) {
this.config = config;

@@ -16,2 +17,3 @@ this.inputFiles = inputFiles;

this.reporter = reporter;
this.overheadTimeMS = overheadTimeMS;
}

@@ -28,3 +30,3 @@ MutationTestExecutor.prototype.run = function (allMutants) {

transpiledFiles = _a.sent();
sandboxPool = new SandboxPool_1.default(this.config, this.testFramework, transpiledFiles);
sandboxPool = new SandboxPool_1.default(this.config, this.testFramework, transpiledFiles, this.overheadTimeMS);
return [4 /*yield*/, this.runInsideSandboxes(sandboxPool.streamSandboxes(), mutantTranspiler.transpileMutants(allMutants))];

@@ -55,15 +57,7 @@ case 2:

}
return transpiledMutants
.zip(recycled.merge(sandboxes), createTuple)
.map(earlyResult)
.flatMap(runInSandbox)
.do(recycle)
.map(function (_a) {
return rxjs_1.zip(transpiledMutants, rxjs_1.merge(recycled, sandboxes), createTuple)
.pipe(operators_1.map(earlyResult), operators_1.flatMap(runInSandbox), operators_1.tap(recycle), operators_1.map(function (_a) {
var result = _a.result;
return result;
})
.do(reportResult(this.reporter))
.toArray()
.do(completeRecycle)
.do(reportAll(this.reporter))
}), operators_1.tap(reportResult(this.reporter)), operators_1.toArray(), operators_1.tap(completeRecycle), operators_1.tap(reportAll(this.reporter)))
.toPromise(Promise);

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

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Reporter, SourceFile, MutantResult, MatchedMutant, ScoreResult } from 'stryker-api/report';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Reporter, MutantResult, ScoreResult } from 'stryker-api/report';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { MutationScoreThresholds } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { HttpClient } from 'typed-rest-client/HttpClient';

@@ -7,2 +7,3 @@ import { Reporter, ScoreResult } from 'stryker-api/report';

private readonly log;
private readonly ciProvider;
constructor(setting: StrykerOptions, dashboardReporterClient?: DashboardReporterClient);

@@ -9,0 +10,0 @@ private readEnvironmentVariable(name);

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

var objectUtils_1 = require("../utils/objectUtils");
var Provider_1 = require("./ci/Provider");
var log4js_1 = require("log4js");

@@ -13,2 +14,3 @@ var DashboardReporter = /** @class */ (function () {

this.log = log4js_1.getLogger(DashboardReporter.name);
this.ciProvider = Provider_1.determineCIProvider();
}

@@ -27,3 +29,3 @@ DashboardReporter.prototype.readEnvironmentVariable = function (name) {

return tslib_1.__awaiter(this, void 0, void 0, function () {
var mutationScore, travisBuild, pullRequest, repository, branch, apiKey;
var mutationScore, isPullRequest, repository, branch, apiKey;
return tslib_1.__generator(this, function (_a) {

@@ -33,8 +35,7 @@ switch (_a.label) {

mutationScore = ScoreResult.mutationScore;
travisBuild = objectUtils_1.getEnvironmentVariable('TRAVIS');
if (!travisBuild) return [3 /*break*/, 5];
pullRequest = objectUtils_1.getEnvironmentVariable('TRAVIS_PULL_REQUEST');
if (!(pullRequest === 'false')) return [3 /*break*/, 3];
repository = this.readEnvironmentVariable('TRAVIS_REPO_SLUG');
branch = this.readEnvironmentVariable('TRAVIS_BRANCH');
if (!(this.ciProvider !== undefined)) return [3 /*break*/, 5];
isPullRequest = this.ciProvider.isPullRequest();
if (!!isPullRequest) return [3 /*break*/, 3];
repository = this.ciProvider.determineRepository();
branch = this.ciProvider.determineBranch();
apiKey = this.readEnvironmentVariable('STRYKER_DASHBOARD_API_KEY');

@@ -53,7 +54,7 @@ if (!(repository && branch && apiKey)) return [3 /*break*/, 2];

case 3:
this.log.info('Dashboard report is not sent when build is for a pull request {TRAVIS_PULL_REQUEST=<number>}');
this.log.info('Dashboard report is not sent when building a pull request');
_a.label = 4;
case 4: return [3 /*break*/, 6];
case 5:
this.log.info('Dashboard report is not sent when stryker didn\'t run on buildserver {TRAVIS=true}');
this.log.info('Dashboard report is not sent when not running on a buildserver');
_a.label = 6;

@@ -60,0 +61,0 @@ case 6: return [2 /*return*/];

@@ -0,0 +0,0 @@ import { Reporter, MutantResult } from 'stryker-api/report';

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { MatchedMutant } from 'stryker-api/report';

@@ -0,0 +0,0 @@ "use strict";

import ProgressBar = require('progress');
export default ProgressBar;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { MatchedMutant, Reporter, MutantResult } from 'stryker-api/report';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { MatchedMutant, MutantResult } from 'stryker-api/report';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Reporter, SourceFile, MutantResult, MatchedMutant, ScoreResult } from 'stryker-api/report';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=StrictReporter.js.map

@@ -10,2 +10,3 @@ import { Config } from 'stryker-api/config';

private testFramework;
private timeOverheadMS;
private readonly log;

@@ -18,3 +19,3 @@ private testRunner;

private initialize();
static create(options: Config, index: number, files: ReadonlyArray<File>, testFramework: TestFramework | null): Promise<Sandbox>;
static create(options: Config, index: number, files: ReadonlyArray<File>, testFramework: TestFramework | null, timeoutOverheadMS: number): Promise<Sandbox>;
run(timeout: number, testHooks: string | undefined): Promise<RunResult>;

@@ -21,0 +22,0 @@ dispose(): Promise<void>;

@@ -13,6 +13,7 @@ "use strict";

var Sandbox = /** @class */ (function () {
function Sandbox(options, index, files, testFramework) {
function Sandbox(options, index, files, testFramework, timeOverheadMS) {
this.options = options;
this.index = index;
this.testFramework = testFramework;
this.timeOverheadMS = timeOverheadMS;
this.log = log4js_1.getLogger(Sandbox.name);

@@ -38,4 +39,4 @@ this.workingFolder = TempFolder_1.TempFolder.instance().createRandomFolder('sandbox');

};
Sandbox.create = function (options, index, files, testFramework) {
var sandbox = new Sandbox(options, index, files, testFramework);
Sandbox.create = function (options, index, files, testFramework, timeoutOverheadMS) {
var sandbox = new Sandbox(options, index, files, testFramework, timeoutOverheadMS);
return sandbox.initialize().then(function () { return sandbox; });

@@ -145,3 +146,3 @@ };

var baseTimeout = mutant.timeSpentScopedTests;
return (this.options.timeoutFactor * baseTimeout) + this.options.timeoutMs;
return (this.options.timeoutFactor * baseTimeout) + this.options.timeoutMs + this.timeOverheadMS;
};

@@ -148,0 +149,0 @@ Sandbox.prototype.getFilterTestsHooks = function (mutant) {

@@ -10,5 +10,6 @@ import { Observable } from 'rxjs';

private initialFiles;
private overheadTimeMS;
private readonly log;
private readonly sandboxes;
constructor(options: Config, testFramework: TestFramework | null, initialFiles: ReadonlyArray<File>);
constructor(options: Config, testFramework: TestFramework | null, initialFiles: ReadonlyArray<File>, overheadTimeMS: number);
streamSandboxes(): Observable<Sandbox>;

@@ -15,0 +16,0 @@ private registerSandbox(promisedSandbox);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var log4js_1 = require("log4js");
var os = require("os");
var log4js_1 = require("log4js");
var rxjs_1 = require("rxjs");
var operators_1 = require("rxjs/operators");
var Sandbox_1 = require("./Sandbox");
var SandboxPool = /** @class */ (function () {
function SandboxPool(options, testFramework, initialFiles) {
function SandboxPool(options, testFramework, initialFiles, overheadTimeMS) {
this.options = options;
this.testFramework = testFramework;
this.initialFiles = initialFiles;
this.overheadTimeMS = overheadTimeMS;
this.log = log4js_1.getLogger(SandboxPool.name);

@@ -31,4 +33,4 @@ this.sandboxes = [];

this.log.info("Creating " + numConcurrentRunners + " test runners (based on " + numConcurrentRunnersSource + ")");
var sandboxes = rxjs_1.Observable.range(0, numConcurrentRunners)
.flatMap(function (n) { return _this.registerSandbox(Sandbox_1.default.create(_this.options, n, _this.initialFiles, _this.testFramework)); });
var sandboxes = rxjs_1.range(0, numConcurrentRunners)
.pipe(operators_1.flatMap(function (n) { return _this.registerSandbox(Sandbox_1.default.create(_this.options, n, _this.initialFiles, _this.testFramework, _this.overheadTimeMS)); }));
return sandboxes;

@@ -35,0 +37,0 @@ };

@@ -0,0 +0,0 @@ import { MutationScoreThresholds } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { File, Range, Location, Position } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Config } from 'stryker-api/config';

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

if (!(initialTestRunResult.runResult.tests.length && testableMutants.length)) return [3 /*break*/, 8];
mutationTestExecutor = new MutationTestExecutor_1.default(this.config, inputFiles.files, this.testFramework, this.reporter);
mutationTestExecutor = new MutationTestExecutor_1.default(this.config, inputFiles.files, this.testFramework, this.reporter, initialTestRunResult.overheadTimeMS);
return [4 /*yield*/, mutationTestExecutor.run(testableMutants)];

@@ -63,0 +63,0 @@ case 4:

@@ -0,0 +0,0 @@ export default class StrykerCli {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Location } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { TestFramework } from 'stryker-api/test_framework';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import TestableMutant from './TestableMutant';

@@ -0,0 +0,0 @@ "use strict";

import { TestFramework } from 'stryker-api/test_framework';
export declare const COVERAGE_CURRENT_TEST_VARIABLE_NAME = "__strykerCoverageCurrentTest__";
export declare function coveragePerTestHooks(testFramework: TestFramework): string;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Transpiler } from 'stryker-api/transpile';

@@ -0,0 +0,0 @@ import { Observable } from 'rxjs';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { File, Location } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { File } from 'stryker-api/core';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=TranspileResult.js.map

@@ -0,0 +0,0 @@ import { File } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Location } from 'stryker-api/core';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import * as estree from 'estree';

@@ -0,0 +0,0 @@ "use strict";

export default class StrykerError extends Error {
constructor(message: string, innerError?: Error);
}

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

export default class Timer {
private now;
private start;
constructor();
private markers;
constructor(now?: () => Date);
reset(): void;
humanReadableElapsed(): string;
elapsedSeconds(): number;
elapsedMs(sinceMarker?: string): number;
mark(name: string): void;
private static humanReadableElapsedSeconds(elapsedSeconds);
private static humanReadableElapsedMinutes(elapsedSeconds);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Timer = /** @class */ (function () {
function Timer() {
function Timer(now) {
if (now === void 0) { now = function () { return new Date(); }; }
this.now = now;
this.reset();
}
Timer.prototype.reset = function () {
this.start = new Date();
this.markers = Object.create(null);
this.start = this.now();
};

@@ -15,5 +18,16 @@ Timer.prototype.humanReadableElapsed = function () {

Timer.prototype.elapsedSeconds = function () {
var elapsedMs = new Date().getTime() - this.start.getTime();
var elapsedMs = this.elapsedMs();
return Math.floor(elapsedMs / 1000);
};
Timer.prototype.elapsedMs = function (sinceMarker) {
if (sinceMarker && this.markers[sinceMarker]) {
return this.now().getTime() - this.markers[sinceMarker].getTime();
}
else {
return this.now().getTime() - this.start.getTime();
}
};
Timer.prototype.mark = function (name) {
this.markers[name] = this.now();
};
Timer.humanReadableElapsedSeconds = function (elapsedSeconds) {

@@ -20,0 +34,0 @@ var restSeconds = elapsedSeconds % 60;

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