Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch ESLint lintFiles errors (fixes #96) #138

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alunny
Copy link

@alunny alunny commented May 11, 2022

Hello!

Right now, if an ESLint rule throws an error, the error object includes a reference to the AST node where the error originated, which includes circular data structures. jest-runner-eslint doesn't do anything special for these errors.

If the tests are running in band, this is not an issue: Jest correctly shows the error to the user. However, if the test is running in a child process, the runner tries to send the circular data structure back to the main process, which produces the Converting circular structure to JSON error shown in #96.

This patch puts a try…catch around the call to lintFiles, so the error message can be reported to Jest explicitly, preventing the circular reference from being propagated.

@SimenB SimenB linked an issue Aug 25, 2022 that may be closed by this pull request
@SimenB
Copy link
Member

SimenB commented Aug 25, 2022

@alunny hey there! sorry I missed this PR.

I merged in main and it seems tests are failing. Could you take a look? 🙂

@alunny
Copy link
Author

alunny commented Sep 12, 2022

Thanks @SimenB , looks like I needed to run Prettier again :)

@SimenB
Copy link
Member

SimenB commented Oct 19, 2022

@alunny sorry, missed your ping. triggered CI now - seems like there's still lots of failures 🙂

@SimenB
Copy link
Member

SimenB commented Jan 16, 2023

@alunny ping

@ljharb ljharb marked this pull request as draft December 4, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Converting circular structure to JSON
2 participants