dom-testing-library icon indicating copy to clipboard operation
dom-testing-library copied to clipboard

Adding playground link when a test fails

Open nofar9792 opened this issue 4 years ago • 8 comments

Describe the feature you'd like:

The playground link is really useful. Each time find/get function fails, it prints a really long HTML. Maybe you can add the playground link by default, each time

  1. find/get function fails
  2. One of the expect fails. like expect(element).toBeChecked();

Suggested implementation:

  1. Adding the link to getElementError.
  2. I would like to hear what do you think

nofar9792 avatar Nov 25 '20 15:11 nofar9792

I think that's a pretty good idea personally. Maybe it could be disabled globally?

kentcdodds avatar Nov 25 '20 17:11 kentcdodds

That sounds like a great idea.

AlonMiz avatar Nov 25 '20 20:11 AlonMiz

It sounds good to me too, it could be very useful but I agree with @kentcdodds that should be disabled globally.

delca85 avatar Nov 25 '20 20:11 delca85

To be clear, I think it should be enabled by default. Just something you can disable globally.

kentcdodds avatar Nov 26 '20 06:11 kentcdodds

Also, to be clear further, anyone can claim this. Feel free to volunteer to implement this :)

kentcdodds avatar Nov 26 '20 06:11 kentcdodds

Ooo sounds neat. I'd definitely wan't this in my pipeline.

Aren't the expects standalone, and don't relate to any testing lib? How can we put the the link in that case without binding jest-dom to testing-library?

AmirTugi avatar Nov 26 '20 09:11 AmirTugi

@kentcdodds @nickmccurdy i'd like to help with it

lidoravitan avatar Nov 26 '20 09:11 lidoravitan

Go for it 💯

kentcdodds avatar Nov 26 '20 14:11 kentcdodds