analytics.js-integrations icon indicating copy to clipboard operation
analytics.js-integrations copied to clipboard

Support a better debugging mode for unit tests

Open nchilada opened this issue 4 years ago • 1 comments

What does this PR do?

  • Use a visible Chrome browser instead of headless Chrome when running unit tests with HEADLESS=false.
  • For the Optimizely integration, facilitate this via a new yarn test:debug command.

Are there breaking changes in this PR?

No. I've confirmed yarn test command continues to run in headless mode.

Any background context you want to provide?

I was having trouble debugging some of the tests in #481. This tweak made debugging much easier because it allowed me to step through my code line-by-line using the Chrome inspector. I'll admit there may be a built-in debugging flow that I'm just not aware of.

Is there parity with the server-side/android/iOS integration components (if applicable)?

N/A

Does this require a new integration setting? If so, please explain how the new setting works

No

Links to helpful docs and other external resources

N/A

nchilada avatar Aug 13 '20 02:08 nchilada

I know this is a change to the global karma.conf.js, so I totally understand if you all don't want to accept this.

But FYI @patrickshih-optimizely, this may help you debug the stuff you're working on too. cd integrations/optimizely && yarn test:debug

nchilada avatar Aug 13 '20 02:08 nchilada