I’m checking the validity of an upload in LiveView. If the upload is not valid, an error is raised. I’m trying to check for this raise, but I can’t figure out how to trap the exit. Process.flag(:trap_exit, true) does nothing. Trying to run it in a new linked process leads to an error due to a missing test supervisor.
The issue seems to be related to LiveViewTest.live/2 which spawns a new process and somehow a raise in this process brings down the whole test, despite the :trap_exit flag. I’m guessing this has something to do with the test supervisor, but I’m not familiar enough with OTP to figure it out. Are the test and spawned LiveView process under the same supervisor and an exit in one exits the whole supervisor?