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
Is your feature request related to a problem or a nice-to-have?? Please describe.
I am using @web/test-runner, which uses mocha in the browser. I need a way to call cleanup from '@testing-library/react' after every test, which seems like the perfect thing for a root plugin.
However, plugins need to be added with --require, which I can't use since I'm in the browser.
Describe the solution you'd like
I think a new option should be added to mocha.setup(), to allow specifying mochaHooks directly.
Describe alternatives you've considered
I've tried using root hooks, loaded in a <script> after mocha is set up, and that was working for firefox and chrome, but fails in safari which seems to try to run it before mocha is finished being added to the global scope. Also, the docs recommend root hook plugins instead, and I'd like to avoid an approach which might be deprecated.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
After looking into it more, it seems that rootHooks is indeed available to use on mocha.setup(). So I've changed this ticket to documenting it, because it definitely wasn't clear that it was possible to do.
@IanVS how did you get this working? I tried adding a config option to the setup call but it didn't work (setup("bdd", { rootHooks: ... });). Searching for setup in the code doesn't turn anything up either... Cheers!
Is your feature request related to a problem or a nice-to-have?? Please describe.
I am using @web/test-runner, which uses mocha in the browser. I need a way to call
cleanup
from '@testing-library/react' after every test, which seems like the perfect thing for a root plugin.However, plugins need to be added with
--require
, which I can't use since I'm in the browser.Describe the solution you'd like
I think a new option should be added to
mocha.setup()
, to allow specifyingmochaHooks
directly.Describe alternatives you've considered
I've tried using root hooks, loaded in a
<script>
after mocha is set up, and that was working for firefox and chrome, but fails in safari which seems to try to run it before mocha is finished being added to the global scope. Also, the docs recommend root hook plugins instead, and I'd like to avoid an approach which might be deprecated.Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: