-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(child process): Make all child processes silent (#1039)
Make all test runner and transpiler child processes silent. The standard out and standard error (stdout and stderr) are now only visible when `loglevel: 'trace'`. If a child process crashes, the last 10 messages received are logged as warning. This is also a refactoring of the way we spawn child processes. Instead of having 2 similar implementations (one for transpiler and one for test runners), they are both consolidated in one coherent `ChildProcessProxy` abstraction. Also clean up the test runner decorator pattern. Timeouts and retries are now implemented only once. Recognizing that the child process crashed is done by validating that the error is an instance of `ChildProcessCrashedError`. No process specifics other than the name of the error is known from the outside. The `Task` class is also refactored. Instead of relying on a custom implementation, it uses the `Promise.race` method for timeout functionality. Fixes #1038 #976
- Loading branch information
Showing
43 changed files
with
1,103 additions
and
998 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
{ | ||
"files": { | ||
"exclude": { | ||
".git": "", | ||
".tscache": "", | ||
"**/*.js": { | ||
"when": "$(basename).ts" | ||
}, | ||
"**/*.d.ts": true, | ||
"**/*.map": { | ||
"when": "$(basename)" | ||
} | ||
"files.exclude": { | ||
".git": true, | ||
".tscache": true, | ||
"**/*.js": { | ||
"when": "$(basename).ts" | ||
}, | ||
"**/*.d.ts": true, | ||
"**/*.map": { | ||
"when": "$(basename)" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/stryker/src/child-proxy/ChildProcessCrashedError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import StrykerError from '../utils/StrykerError'; | ||
|
||
export default class ChildProcessCrashedError extends StrykerError { | ||
constructor( | ||
public readonly pid: number, | ||
message: string, | ||
public readonly exitCode?: number, | ||
public readonly signal?: string, | ||
innerError?: Error) { | ||
super(message, innerError); | ||
Error.captureStackTrace(this, ChildProcessCrashedError); | ||
// TS recommendation: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work | ||
Object.setPrototypeOf(this, ChildProcessCrashedError.prototype); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.