You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there @CHE1RON, thanks for opening this issue!
I believe you understood the test-runner a bit wrong. The test-runner observes your Storybook. It does not augment its functionality. If you want to extend the matchers used in your play function, you should do it in Storybook, and not the test-runner configuration. You use the test-runner configuration to extend expect when using it for accessibility testing, for instance, in Node.
You should be able to achieve this by using a similar code, but in your .storybook/preview file instead:
// .storybook/preview.tsimport{expect}from'@storybook/jest';expect.extend({toBeMuiChecked(element){// Determine whether class indicates 'checked' stateconstpass=element.toHaveClass('Mui-checked');return{
pass,message: pass
? ()=>'you shall pass'
: ()=>'you shall not pass'}}});
Hey Yann, thanks for letting me know & keep up the good work!
yannbf
changed the title
[bug] I'm unable to extend expect with custom matchers.
[question] I'm unable to extend expect with custom matchers.
Nov 2, 2023
Describe the bug
I'm unable to extend
expect
with custom matchers.To Reproduce
Expected behavior
Test succeeds.
Screenshots
System
The text was updated successfully, but these errors were encountered: