agnivade / wasmbrowsertest

Run WASM tests inside your browser
MIT License
191 stars 22 forks source link

fix: Cleanup Chrome on Failure #20

Closed jalextowle closed 4 years ago

jalextowle commented 4 years ago

Description

I noticed a problem when I was running browser tests that failed with wasmbrowsertest. Large amounts of Chrome instances were being spun up, which was very taxing for my CPU. After some investigation, I came to the realization that these Chrome instances were being spun up by wasmbrowsertest and were not being torn down when a test suite failed.

The root of the problem appears to be that defer os.Exit($code) will cause the program to exit immediately without calling the defers that were defined previously in the file. This behavior of defer is described in this blogpost: https://blog.golang.org/defer-panic-and-recover.

jalextowle commented 4 years ago

Thanks for the thoughtful review @agnivade! Would you mind taking a look at the other PR that I opened when you get the chance (there is no rush)?

If you'd prefer to discuss this issue elsewhere, please let me know.