mocha icon indicating copy to clipboard operation
mocha copied to clipboard

📝 Docs: Indicate that "exports" interface does not work in browsers

Open JKAnderson409 opened this issue 5 years ago • 2 comments

Is your feature request related to a problem or a nice-to-have?? Please describe. I wasted a good deal of time trying to get the "exports" interface (which I think is perfect for organizing tests for a large OOP project) only to find that it just does not work in the browser. I can get my demo test to run on the command line (node) just fine but Firefox and Chromium ignore the exported test suite when the interface is set to "exports".

Describe the solution you'd like The docs should indicate that this is the case in both the "Interfaces" and "Browser support" sections.

Describe alternatives you've considered Of course it would be nice if it was fixed to work in the browser but I think that updating the docs is the best immediate fix.

Additional context This was brought up quite a while ago (https://github.com/mochajs/mocha/issues/2198) with some manual solutions to get it working but it does not appear that the docs were updated to reflect the issue.

JKAnderson409 avatar Jul 25 '19 23:07 JKAnderson409

Makes sense. Thanks for raising.

craigtaub avatar Jul 30 '19 16:07 craigtaub

Hi everyone,

I have created a pull request to address the documentation issue regarding the "exports" interface not working in browser environments. You can view the PR here: PR #5181.

In this PR:

  • docs/index.md: Added a note explaining the limitation with the "exports" interface under the relevant section.
  • docs/API.md: Added a note under the "exports" interface section explaining its incompatibility with browsers.

Please review and let me know if any further changes are needed.

Thank you!

deyjoy avatar Jul 23 '24 04:07 deyjoy