Don't use the render callback with promises (#10050)

This covers up errors that are thrown in Fiber, because callback gets
fired *and* an error is thrown. Created a follow up #10049 to reevaluate
these semantics.

# Conflicts:
#	scripts/fiber/tests-passing-except-dev.txt
#	scripts/fiber/tests-passing.txt
This commit is contained in:
Sebastian Markbåge authored and GitHub committed 2017-06-27 08:24:31 -07:00
1 parent cb32253d2f
commit 90b7facd52
3 files changed
+12 -9

No files matched your search

@@ -28,9 +28,12 @@ const stream = require('stream');
// promisified version of ReactDOM.render()
function asyncReactDOMRender(reactElement, domElement) {
return new Promise(resolve =>
ReactDOM.render(reactElement, domElement, resolve),
);
return new Promise(resolve => {
ReactDOM.render(reactElement, domElement);
// We can't use the callback for resolution because that will not catch
// errors. They're thrown.
resolve();
});
}
// performs fn asynchronously and expects count errors logged to console.error.
// will fail the test if the count of errors logged is not equal to count.