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

[bug] tests expected to fail pass even if the expected message doesn't match the actual error message #285

Closed
beluamat29 opened this issue May 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@beluamat29
Copy link
Collaborator

Describe the bug

When running a test that's expected to fail using expectFailureOn() the test passes even if the expected error message doesn't match the actual error message from the test run

Version(s) affected

To Reproduce

  • Add a test you expect to fail, or modify one of the existing ones making the I18nMessage sent as argument in expectFailureOn() be any random string.
image
  • Run the test and verify that the test passes
image

Expected behavior

The message from the assertion failure should match the one expected in the test file. If they don't match the test should not pass

@beluamat29 beluamat29 added the bug Something isn't working label May 8, 2024
@ngarbezza ngarbezza removed their assignment May 8, 2024
@ngarbezza
Copy link
Owner

I found the problem. For default equality assertions, we were relying on Node's assert#deepStrictEqual function. This functions compares objects by enumerating their properties. Properties must be enumerable.

When I introduced private fields as a "refactor", I broke the equality for these objects, because private properties are not enumerable, therefore the equality always returned true (no enumerable properties to compare).

I will work on the issue and release a new version with the fix.

@ngarbezza ngarbezza self-assigned this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants