Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: Add support for additional runtimes like Bun and Deno #5108

Open
2 of 3 tasks
voxpelli opened this issue Feb 29, 2024 · 2 comments
Open
2 of 3 tasks

🚀 Feature: Add support for additional runtimes like Bun and Deno #5108

voxpelli opened this issue Feb 29, 2024 · 2 comments
Labels
core-team issues which must be handled by Mocha's core team type: feature enhancement proposal

Comments

@voxpelli
Copy link
Member

Feature Request Checklist

Overview

As mentioned in #5065 (comment), wintercg/proposal-minimum-common-api#68 and https://twitter.com/_nicojs/status/1762508703863894472:

Nicholas C. Zakas @slicknet
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: ???

There is a need for a cross-runtime testing library.

Mocha already supports browsers and node.js, what would it take to support eg. Deno and Bun as well?

Suggested Solution

Research what would be needed to support Bun and Deno and evaluate the feasibility.

Alternatives

Standardizing on a shared built in test API and move away from Mocha: wintercg/proposal-minimum-common-api#68

This would only solve it for those runtimes who are compliant with the WinterCG proposal though and not work for eg browsers. It also would mean running the tests in multiple different implementations of the same test framework, which can have unexpected consequences.

Additional Info

No response

@voxpelli voxpelli added type: feature enhancement proposal status: in triage a maintainer should (re-)triage (review) this issue labels Feb 29, 2024
@nzakas
Copy link

nzakas commented Mar 7, 2024

One thing I noticed when running Mocha on Bun: When there is a test failure, Mocha's exit code is 0, making it appear that CI is passing if you don't look at the console output.

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Oct 8, 2024

👍 we've been chatting about this off-and-on for most of this year. We're generally in favor.

I think in order for this to happen, we'd need to roll out slowly. Here's a strategy proposal:

  1. Add examples for Bun and Deno to https://github.com/mochajs/mocha-examples
  2. Add executing tests for Bun and Deno to Mocha's CI
    • Since these will probably be failing at first, perhaps just for the main branch & on PRs with a particular label?
  3. See what CI run failures arise from that, and file standalone issues
  4. For each of Bun and Deno, once they have no CI failures, announce them as experimentally available in production
  5. Wait some time to gather user input
  6. Announce them as officially supported in production

This is lower priority than work on Mocha 11 (https://github.com/mochajs/mocha/milestone/65) or 12 (https://github.com/mochajs/mocha/milestone/66), but would be great down the road.

@JoshuaKGoldberg JoshuaKGoldberg added core-team issues which must be handled by Mocha's core team and removed status: in triage a maintainer should (re-)triage (review) this issue status: in discussion Let's talk about it! labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-team issues which must be handled by Mocha's core team type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

3 participants