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

chore: update config import error #505

Merged
merged 1 commit into from
Mar 6, 2024
Merged

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Mar 4, 2024

I had a problem where the config import tests failed. This seemed to be because the JSON.parse() error message can change.

For example, JSON.parse('{bad') gives the following error message in Firefox v123:

expected property name or '}' at line 1 column 2 of the JSON data

But Node v20 gives the following:

Expected property name or '}' in JSON at position 1

We now catch this error and return a consistent message, which should make the tests more reliable. Because this code was getting a little long, I moved it into its own function.

I had a problem where the config import tests failed. This seemed to be
because the `JSON.parse()` error message can change.

For example, `JSON.parse('{bad')` gives the following error message in
Firefox v123:

> expected property name or '}' at line 1 column 2 of the JSON data

But Node v20 gives the following:

> Expected property name or '}' in JSON at position 1

We now catch this error and return a consistent message, which should
make the tests more reliable. Because this code was getting a little
long, I moved it into its own function.
Copy link
Contributor

@tomasciccola tomasciccola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@EvanHahn EvanHahn merged commit 86e28be into main Mar 6, 2024
7 checks passed
@EvanHahn EvanHahn deleted the control-error-for-config-import branch March 6, 2024 19:06
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.

2 participants