Use gate pragma instead of if (__EXPERIMENTAL__) (#19722)

* Use gate pragma instead of if (__EXPERIMENTAL__)

* Fix stream error handling in tests

Added an error listener so that the tests fail within their Jest scope,
instead of crashing the whole process.
This commit is contained in:
Andrew Clark
2020-08-28 14:21:01 -07:00
committed by GitHub
parent 380dc95de8
commit 4f5fb56100
2 changed files with 1027 additions and 1013 deletions
File diff suppressed because it is too large Load Diff
@@ -144,9 +144,11 @@ module.exports = function(initModules) {
async function renderIntoStream(reactElement, errorCount = 0) {
return await expectErrors(
() =>
new Promise(resolve => {
new Promise((resolve, reject) => {
const writable = new DrainWritable();
ReactDOMServer.renderToNodeStream(reactElement).pipe(writable);
const s = ReactDOMServer.renderToNodeStream(reactElement);
s.on('error', e => reject(e));
s.pipe(writable);
writable.on('finish', () => resolve(writable.buffer));
}),
errorCount,