web icon indicating copy to clipboard operation
web copied to clipboard

Mocha docs: Explain differences between `runTests` and `mocha`

Open atjn opened this issue 9 months ago • 1 comments

Under "Writing Tests / HTML Tests", you explain that to use Mocha, one must import the runTests function and run the tests in that. Link to page: https://modern-web.dev/docs/test-runner/writing-tests/html-tests/

Under "Test Frameworks / Mocha / Writing HTML tests", you explain that to use Mocha, one must import the mocha object along with sessionFinished and sessionFailed and use those to run the tests. Link to page: https://modern-web.dev/docs/test-runner/test-frameworks/mocha/#writing-html-tests

So which one should I use? And what are the differences? There is no documentation explaining any of that.

atjn avatar Apr 06 '25 15:04 atjn

I agree it's not clear from our docs, also not clear why seemingly the same functions are imported from 2 different packages in 2 different examples.

I'm not writing HTML tests like this in my daily job, so not sure how to help, hope that some other maintainers can have a look.

Meanwhile I'd recommend to go with runTests, as it seems like it's the most mimimal setup possible. I assume other setups give you more flexibility, so you'll know when you need to use them.

bashmish avatar May 21 '25 09:05 bashmish