Closed sjrd closed 4 years ago
@japgolly It would be really nice if you could test this for your use case. You can do with:
sbt scalajs-env-jsdom-nodejs/publishLocal
"org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0-SNAPSHOT"
in your project/plugins.sbt
to use version 1.1.0-SNAPSHOT
instead
React's development mode has a funny way of triggering errors, which tries to convince that exceptions are uncaught (for their development tools to report them) even though React catches them for the "error boundaries" feature.
Since our jsdom handler reports uncaught exceptions as hard failures that fail the run, this creates a very bad interaction where every caught-but-not-really exception crashes the run.
We hack around this hack by detecting when our error handler is in fact called by React's own hack. In that case, we ignore the uncaught exception, and proceed with normal execution.
We add a test that actually uses React's error boundaries, and makes sure that the React component can still detect the error and its error message.