Skip to content

Commit

Permalink
Ensure verbose mode prints output synchronously
Browse files Browse the repository at this point in the history
Fixes #8208
  • Loading branch information
conartist6 committed Feb 4, 2021
1 parent c174ada commit 198d87c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/jest-reporters/src/DefaultReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ export default class DefaultReporter extends BaseReporter {
this._err = process.stderr.write.bind(process.stderr);
this._status = new Status();
this._bufferedOutput = new Set();
this._wrapStdio(process.stdout);
this._wrapStdio(process.stderr);
this.__wrapStdio(process.stdout);
this.__wrapStdio(process.stderr);
this._status.onChange(() => {
this._clearStatus();
this._printStatus();
});
}

private _wrapStdio(stream: NodeJS.WritableStream | NodeJS.WriteStream) {
protected __wrapStdio(stream: NodeJS.WritableStream | NodeJS.WriteStream): void {
const originalWrite = stream.write;

let buffer: Array<string> = [];
Expand Down
4 changes: 4 additions & 0 deletions packages/jest-reporters/src/VerboseReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export default class VerboseReporter extends DefaultReporter {
this._globalConfig = globalConfig;
}

// Verbose mode is for debugging. Buffering of output is undesirable.
// See https://github.com/facebook/jest/issues/8208
protected __wrapStdio(): void {}

static filterTestResults(
testResults: Array<AssertionResult>,
): Array<AssertionResult> {
Expand Down

0 comments on commit 198d87c

Please sign in to comment.