Comparing version 0.26.0 to 0.26.1
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.26.1"></a> | ||
## [0.26.1](https://github.com/stryker-mutator/stryker/compare/stryker@0.26.0...stryker@0.26.1) (2018-08-03) | ||
### Bug Fixes | ||
* **stryker:** Clear timeouts so stryker exits correctly ([#1063](https://github.com/stryker-mutator/stryker/issues/1063)) ([2058382](https://github.com/stryker-mutator/stryker/commit/2058382)) | ||
<a name="0.26.0"></a> | ||
@@ -8,0 +19,0 @@ # [0.26.0](https://github.com/stryker-mutator/stryker/compare/stryker@0.25.1...stryker@0.26.0) (2018-08-03) |
{ | ||
"name": "stryker", | ||
"version": "0.26.0", | ||
"version": "0.26.1", | ||
"description": "The extendable JavaScript mutation testing framework", | ||
@@ -5,0 +5,0 @@ "main": "src/Stryker.js", |
@@ -54,3 +54,3 @@ "use strict"; | ||
inputFiles = _a.sent(); | ||
if (!inputFiles.files.length) return [3 /*break*/, 9]; | ||
if (!inputFiles.files.length) return [3 /*break*/, 10]; | ||
TempFolder_1.TempFolder.instance().initialize(); | ||
@@ -64,3 +64,3 @@ initialTestRunProcess = new InitialTestExecutor_1.default(this.config, inputFiles, this.testFramework, this.timer, loggingContext); | ||
testableMutants = _a.sent(); | ||
if (!(initialTestRunResult.runResult.tests.length && testableMutants.length)) return [3 /*break*/, 9]; | ||
if (!(initialTestRunResult.runResult.tests.length && testableMutants.length)) return [3 /*break*/, 10]; | ||
mutationTestExecutor = new MutationTestExecutor_1.default(this.config, inputFiles.files, this.testFramework, this.reporter, initialTestRunResult.overheadTimeMS, loggingContext); | ||
@@ -80,4 +80,7 @@ return [4 /*yield*/, mutationTestExecutor.run(testableMutants)]; | ||
_a.sent(); | ||
return [4 /*yield*/, LogConfigurator_1.default.shutdown()]; | ||
case 9: | ||
_a.sent(); | ||
return [2 /*return*/, mutantResults]; | ||
case 9: return [2 /*return*/, Promise.resolve([])]; | ||
case 10: return [2 /*return*/, Promise.resolve([])]; | ||
} | ||
@@ -84,0 +87,0 @@ }); |
@@ -27,13 +27,12 @@ "use strict"; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, Promise.race([ | ||
// First let the inner test runner dispose | ||
this.worker.proxy.dispose().catch(function (error) { | ||
// It's OK if the child process is already down. | ||
if (!(error instanceof ChildProcessCrashedError_1.default)) { | ||
throw error; | ||
} | ||
}), | ||
// ... but don't wait forever on that | ||
objectUtils_1.sleep(MAX_WAIT_FOR_DISPOSE) | ||
])]; | ||
case 0: return [4 /*yield*/, objectUtils_1.timeout( | ||
// First let the inner test runner dispose | ||
this.worker.proxy.dispose().catch(function (error) { | ||
// It's OK if the child process is already down. | ||
if (!(error instanceof ChildProcessCrashedError_1.default)) { | ||
throw error; | ||
} | ||
}), | ||
// ... but don't wait forever on that | ||
MAX_WAIT_FOR_DISPOSE)]; | ||
case 1: | ||
@@ -40,0 +39,0 @@ _a.sent(); |
@@ -8,3 +8,2 @@ "use strict"; | ||
var objectUtils_1 = require("../utils/objectUtils"); | ||
var TIMEOUT_EXPIRED = 'timeout_expired'; | ||
/** | ||
@@ -22,5 +21,2 @@ * Wraps a test runner and implements the timeout functionality. | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
function timeout() { | ||
return objectUtils_1.sleep(options.timeout).then(function () { return TIMEOUT_EXPIRED; }); | ||
} | ||
var result; | ||
@@ -31,6 +27,6 @@ return tslib_1.__generator(this, function (_a) { | ||
this.log.debug('Starting timeout timer (%s ms) for a test run', options.timeout); | ||
return [4 /*yield*/, Promise.race([_super.prototype.run.call(this, options), timeout()])]; | ||
return [4 /*yield*/, objectUtils_1.timeout(_super.prototype.run.call(this, options), options.timeout)]; | ||
case 1: | ||
result = _a.sent(); | ||
if (result === TIMEOUT_EXPIRED) { | ||
if (result === objectUtils_1.TIMEOUT_EXPIRED) { | ||
return [2 /*return*/, this.handleTimeout()]; | ||
@@ -37,0 +33,0 @@ } |
@@ -27,3 +27,5 @@ /// <reference types="node" /> | ||
export declare function kill(pid: number): Promise<void>; | ||
export declare function sleep(ms: number): Promise<void>; | ||
export declare type TimeoutExpired = 'TIMEOUT_EXPIRED'; | ||
export declare const TIMEOUT_EXPIRED: TimeoutExpired; | ||
export declare function timeout<T>(promise: Promise<T>, ms: number): Promise<T | TimeoutExpired>; | ||
export declare function padLeft(input: string): string; |
@@ -108,8 +108,17 @@ "use strict"; | ||
exports.kill = kill; | ||
function sleep(ms) { | ||
return new Promise(function (res) { | ||
setTimeout(res, ms); | ||
exports.TIMEOUT_EXPIRED = 'TIMEOUT_EXPIRED'; | ||
function timeout(promise, ms) { | ||
var sleep = new Promise(function (res, rej) { | ||
var timer = setTimeout(function () { return res(exports.TIMEOUT_EXPIRED); }, ms); | ||
promise.then(function (result) { | ||
clearTimeout(timer); | ||
res(result); | ||
}).catch(function (error) { | ||
clearTimeout(timer); | ||
rej(error); | ||
}); | ||
}); | ||
return sleep; | ||
} | ||
exports.sleep = sleep; | ||
exports.timeout = timeout; | ||
function padLeft(input) { | ||
@@ -116,0 +125,0 @@ return input.split('\n').map(function (str) { return '\t' + str; }).join('\n'); |
@@ -0,1 +1,2 @@ | ||
import { TimeoutExpired } from './objectUtils'; | ||
/** | ||
@@ -12,3 +13,3 @@ * Wraps a promise in a Task api for convenience. | ||
readonly isCompleted: boolean; | ||
resolve(result: undefined | T | PromiseLike<T>): void; | ||
resolve(result: T | PromiseLike<T>): void; | ||
reject(reason: any): void; | ||
@@ -20,4 +21,4 @@ } | ||
*/ | ||
export declare class ExpirableTask<T = void> extends Task<T | void> { | ||
export declare class ExpirableTask<T = void> extends Task<T | TimeoutExpired> { | ||
constructor(timeoutMS: number); | ||
} |
@@ -50,3 +50,5 @@ "use strict"; | ||
var _this = _super.call(this) || this; | ||
_this._promise = Promise.race([_this._promise, objectUtils_1.sleep(timeoutMS)]); | ||
_this._promise = objectUtils_1.timeout(_this._promise, timeoutMS).then(function (val) { | ||
return val; | ||
}); | ||
return _this; | ||
@@ -53,0 +55,0 @@ } |
382374
6929