Open boonya opened 11 months ago
Hey @boonya thanks a lot for flagging this! Would you be open to making a PR that fixes it? Thanks!
Hey @boonya thanks a lot for flagging this! Would you be open to making a PR that fixes it? Thanks!
With pleasure... When I have a time and inspiration ;)
I tried to work on this issue, but I was frustrated because I am new to eslint plugin development. The existing API determines the userEvent object by its name, so I couldn't figure out how to determine the variable created in userEvent.setup. I'll try some more when I have time, but I'd be happy if there were contributions from experts until then.
This is what I have so far https://github.com/storybookjs/eslint-plugin-storybook/pull/142
But I am a little bit stuck, caue I don't see how to integrate expectation of await
before the variable created by userEvent.setup()
. I'll try a bit later, but may be someone has some suggestion or idea.
Looks like this is something related https://github.com/testing-library/eslint-plugin-testing-library/pull/817
Describe the bug
Latest version of user-event lib recommends to use a little bit different API. Instead of using
userEvent.click
they suggest to createuser-event
instance first by invokingconst events = userEvent.setup()
. And then use any event available e.g.await events.click()
.userEvent.setup
returns an object directly without promise, so it shouldn't be awaiten. But the rule "storybook/await-interactions" reports an issue there.To Reproduce
@storybook/testing-library
(0.2.0 in my case)userEvent
constructor.userEvent.setup();
statement as it recommended in latest user-event section.Expected behavior Validation error should not be triggered on
setup
method.Screenshots![image](https://github.com/storybookjs/eslint-plugin-storybook/assets/779184/5b9fdb92-87fd-470a-946e-017a5d337b0e)