Skip to content

Commit 499f7d8

Browse files
gaearonalexdriaguine
authored andcommitted
Clear scrollback in test mode (facebook#1237)
1 parent 53e7b23 commit 499f7d8

File tree

1 file changed

+12
-0
lines changed
  • packages/react-scripts/scripts

1 file changed

+12
-0
lines changed

packages/react-scripts/scripts/test.js

+12
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ if (!process.env.CI && argv.indexOf('--coverage') < 0) {
2626
argv.push('--watch');
2727
}
2828

29+
// A temporary hack to clear terminal correctly.
30+
// You can remove this after updating to Jest 18 when it's out.
31+
// https://github.com/facebook/jest/pull/2230
32+
var realWrite = process.stdout.write;
33+
var CLEAR = process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H';
34+
process.stdout.write = function(chunk, encoding, callback) {
35+
if (chunk === '\x1B[2J\x1B[H') {
36+
chunk = CLEAR;
37+
}
38+
return realWrite.call(this, chunk, encoding, callback);
39+
};
40+
2941
// @remove-on-eject-begin
3042
// This is not necessary after eject because we embed config into package.json.
3143
const createJestConfig = require('../utils/createJestConfig');

0 commit comments

Comments
 (0)