fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

11K
active users

Nicholas C. Zakas

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 :-/

@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.
fosstodon.org/@rauschma/111959
Via @rauschma

@rauschma @schrotie it’s also horribly buggy and definitely not compatible with other runtimes.

@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.

@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.