Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Clearer jsdomError messages #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

CodyRay
Copy link

@CodyRay CodyRay commented Jun 26, 2020

I encountered a situation where I was creating a 'jsdomError'. Jest reported the error like so:

Screenshot from 2020-06-26 12-22-20

At first glance it is easy to miss that the error.detail is concatenated to the end of the fourth line, I certainly missed it.

I found that happened because by default jsdom logs the error.stack and error.default as two parameters to console.error

This PR overrides that default and lets jest format the errors, which it does very nicely:

Screenshot from 2020-06-26 12-28-17

@SimenB
Copy link
Owner

SimenB commented Nov 1, 2020

Sorry about the missing response @haroldhues! I had over 3k notification on GH and I'm currently trying to wade through them 😅

Could you send this PR to Jest core? The logic here is copied from there https://github.com/facebook/jest/blob/2b748f67c25615a111330017a2bffc0baf51d558/packages/jest-environment-jsdom/src/index.ts#L38

@SimenB
Copy link
Owner

SimenB commented Apr 22, 2021

03837ba

But yes, sending a PR with this to Jest core would be appreciated 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants