ccampbell / luna-testing

Simple, modern, opinionated JavaScript unit testing
https://craig.is/testing/code
MIT License
151 stars 6 forks source link

Set a breakpoint in a browser test? #13

Open Nathan22Miles opened 5 years ago

Nathan22Miles commented 5 years ago

I love how easy it is to use this!

Is there a way to set a break point? I presume this would mean some way to open the developers tools display for the headless browser that is running the test?

Thanks, Nathan

ccampbell commented 5 years ago

Thanks. At the moment that is not possible, but I could see that being useful.

I sometimes end up doing similar things by commenting out code in Luna to keep the server from closing after a test run so I can open a specific test run in an actual browser for debugging purposes. Perhaps that is a feature I should support out of the box using a command line flag.

I am not sure how breakpoints would work in that context though or if puppeteer has API support for them. Perhaps you could put breakpoints in your code and then run luna using a flag like --open-in-browser. I am not entirely sure the best way to handle it.