Skip to content

test(promise): test for error object names instead of specific messages #66

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

Merged

Conversation

glennsl
Copy link
Contributor

@glennsl glennsl commented Feb 23, 2023

textExternalPromiseThrow failed for me in node v19.6 because the exception message had changed from

Unexpected token . in JSON at position 1

to

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

It's rarely a good idea to test for specific string messages unless you control them in the test itself, since they're solely intended for humans and changing them typically isn't considered breaking.

Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

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

Good catch! Just want to make the minimum needed changes.

@glennsl
Copy link
Contributor Author

glennsl commented Feb 23, 2023

I rewrote the tests to actually test what they're supposed to instead of a fragile side-effect. Is that better?

@zth
Copy link
Collaborator

zth commented Feb 24, 2023

Sure, let's go with this.

@zth zth merged commit 4bbd304 into rescript-lang:main Feb 24, 2023
@glennsl glennsl deleted the test/promise/fix-testExternalProimseThrow branch February 24, 2023 09:31
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