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

docs(test-assertions-js): add base matcher mutability caution note #34155

Conversation

ryangchung
Copy link

Adds code example and caution note to alert of expect.extend() mutability, with a code example, as mentioned in #32271.

@@ -308,6 +308,18 @@ test('amount', async () => {
});
```

Note that `expect.extend()` is mutable, so overriding base matchers may cause infinite loops, such as below.
Copy link
Member

Choose a reason for hiding this comment

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

What is the behavior that you are trying to clarify here? This is example seems very similar to generic:

const obj = {
  m: () => {
    obj.m();
  }
};
obj.m();

where you would end up with infinite recursion.

@yury-s
Copy link
Member

yury-s commented Jan 13, 2025

Closing as part of incoming PRs clean up. Feel free to reopen when you get back to it.

@yury-s yury-s closed this Jan 13, 2025
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