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 authored and GitHub committed 2020-08-28 14:21:01 -07:00
1 parent 380dc95de8
commit 4f5fb56100
2 files changed
+1027 -1013

No files matched your search

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,