What I want: To write JavaScript tests once and be able to run them across Node.js, Bun, and Deno.
Problem: Bun and Deno have built-in test runners you have to import from to run tests. I use Mocha. This doesn't work.
Solution: ???
@nzakas shoot, does mocha not run in bun / deno? Bummer :-/
@nzakas What are you using to write the tests you run with Mocha? There is a chance Deno runner is compatible! https://docs.deno.com/runtime/manual/basics/testing/#integration-with-testing-libraries
@threkk not looking for compatibility. I just want it to work as-is.
@nzakas Hmmm... not sure about that then. In theory, if the tests are written using a compatible library, the runner should work out of the box, but never been in that situation
@nzakas Node now has a built in test runner, too. Looks somewhat similar to Mocha, but don't know about compatibility with the others.
https://fosstodon.org/@rauschma/111959120535823618
Via @rauschma
@nzakas Deno has some support for "node:test", so maybe Node APIs remain the most likely common denominator
@ashley node:test barely works in Node.js.
@nzakas it keeps on getting better though! Admirably I've only adopted it in small projects so haven't hit many issues.
I have high hopes for its future.
@nzakas Deno and Bun add more Node.jsAPI compatibility on ech version. I would bet on node:test eventually, but not yet. Currently, Deno partially supports it, but Bun doesn't.
@pawelgrzybek node:test is horribly buggy. Maybe it will improve but for now it’s too unreliable.
@nzakas The problem is the runtimes not having a good VM modules to support what a test framework should be able to do. Although, simple test runners should work cross-platform as these are just require() and functions.