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

feat: @effect/vitest custom testers #2646

Closed

Conversation

sukovanej
Copy link
Contributor

The MVP of #2629

Copy link

changeset-bot bot commented Apr 28, 2024

🦋 Changeset detected

Latest commit: 903c9e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/vitest Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@tim-smart tim-smart left a comment

Choose a reason for hiding this comment

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

I wonder if it would be better to add a tester that checks for Equal.isEqual and uses Equal.equals if true.

@sukovanej sukovanej force-pushed the feat/effect-vitest-custom-testers branch from df94dca to 903c9e2 Compare April 30, 2024 09:01
@sukovanej
Copy link
Contributor Author

sukovanej commented Apr 30, 2024

I wonder if it would be better to add a tester that checks for Equal.isEqual and uses Equal.equals if true.

I'm exploring this option, the problem is the fallback on strict equality for objects not implementing Equal, e.g. chunk or list containing arbitrary objects.

@mikearnaldi
Copy link
Member

Wondering if we can make equal act structurally for plain objects with a regional flag

@mikearnaldi
Copy link
Member

testing the idea here: #2662

@sukovanej
Copy link
Contributor Author

While making the equals a little bit smarter by moving closer to the comparison by value absolutely feels like a good move, IMO we should still not break the equality logic of the vitest. Vitest (and I assume generally any testing lib) can have its own comparison logic and most importantly a mechanism for injecting a custom testers (users of Vitest can introduce their own equality for specific cases), therefore the best way to approach this seems to be to introduce an equality tester checking effect's data types "structurally" and than giving the control back to the equality logic of the testing lib for other nested values.

@sukovanej sukovanej closed this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants