larsthorup/mocha-vite-puppeteer

Breakpoints

Closed this issue · 6 comments

Hello.

Thanks for this great module. Exactly what I needed. Looking forward to the upcoming enhancement to log non primitive values.

But I have problems to get breakpoints working. I was able to get breakpoint handled for the mocha structures (describe, it) but not for my test code. What I'm missing?

Hi Michael,

Within the it blocks, you should be able to place
debugger;
and the tests should pause execution at that point.

Also, you should be able to set the debug flag to true or use the 'advanced configurations' (see readme) if you're trying to turn off the headless mode. The browser should automatically pause execution at your debugger point.

If you use the advanced config method, you can pass in
"launchOptions": {"devtools": true}
which automatically sets headless to false and opens the chrome devtools on startup

@michaelvogt

Looking forward to the upcoming enhancement to log non primitive values.

Is now released in v1.7.0

@larsthorup

Great. Thanks for the info 👍

@michaelvogt - did the debugger suggestion from @gabrielthomasjacobs above work for you?

@larsthorup @gabrielthomasjacobs

Yes, just figured it out. I was on the right track, but debugger still didn't break into the dev tools. Even opening the devtools manually in the Chromium page and reloading it.

The key for me to make it work was the advanced setting "devtools": true.

Long story short, yes works now :)

In v1.12.0 (#25) we now automatically set devtools: true in launch options when --debug option is set, so the advanced setting is no longer needed, making debugging easier out of the box.