Skip to content

Test CI with both Node.js and Bun #352

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

Closed
wants to merge 2 commits into from
Closed

Conversation

Electroid
Copy link

This adds support to run tests in CI using Bun, and keeps Node.js support. It makes running tests 35% faster.

Bun - 11s Node - 17s
Screenshot 2025-02-20 at 3 32 02 PM Screenshot 2025-02-20 at 3 32 49 PM

Since Bun supports Jest & Vitest, you'll notice there are no code changes! It just works. (and I did test the Github Action on a fork to verify that it indeed does work)

This also changes npm install to bun install, but just in CI. Developers can continue to use npm, yarn, etc.

I also updated various GitHub Action steps to use the newer versions (e.g. actions/checkout@v2 -> actions/checkout@v4)

Copy link
Member

@blakeembrey blakeembrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pillarjs/express-tc This project is JS-only, no deps, nothing runtime specific (since it's designed to be used everywhere). Based on past discussions we would want to merge this (and any other runtimes people want to test on) but my personal experience is to keep the test suite minimal and instead target ES version supports vs runtimes.

@@ -26,6 +30,8 @@ const {
} = require("path-to-regexp");
```

This library is compatible and tested with Node.js 16+ and Bun 1.2+.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to remove this, it's all just JS so it's compatible with anything that supports ES2015 basically. These just happen to be where tests are run.

@@ -0,0 +1,3 @@
[test]
coverage = true
coverageReporter = ["text", "lcov"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Member

@ctcpip ctcpip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

@blakeembrey
Copy link
Member

why?

@ctcpip when we’ve discussed it in the past I thought you were on the side of testing everything that’s supported. The package supports everything that can run ES2015, including browsers, Cloudflare workers, etc so it seems like this is an improvement toward that goal.

@ctcpip
Copy link
Member

ctcpip commented Apr 29, 2025

why?

@ctcpip when we’ve discussed it in the past I thought you were on the side of testing everything that’s supported. The package supports everything that can run ES2015, including browsers, Cloudflare workers, etc so it seems like this is an improvement toward that goal.

That's not exactly my position. My position is that if we are officially and deliberately supporting something, then we should have tests for those runtimes, environments, engines, etc.

Similarly, I wouldn't expect to see tests for every JS engine out there either.

The ADR on this is not yet merged, but right now contains the following:

It is also worth noting that Express was specifically designed to run with Node.js. While some of our libraries can run in other runtimes, this can currently be classified as an "unofficial and untested feature." Consequently, our CI systems do not include other runtimes as part of their testing workflows.

@jonchurch
Copy link
Member

Thank you for the contribution.

Im +1 to keeping a minimal test suite

Is there a specific problem this PR would solve for consumers or maintainers?

If so, Im open to learning more.

Absent a clear problem, Im not seeing value in the additional workflow complexity

@blakeembrey
Copy link
Member

blakeembrey commented Apr 29, 2025

@ctcpip I did try my best to get that language removed with expressjs/discussions#323 (comment) 🤷 This package does support other runtimes than it's tested on, but lack of CI is due to redundancy and maintenance overhead.

@Electroid I'm going to close this out for now since this is a simple package and supports any ES2015 environment, so it shouldn't need a dedicated test suite for this. Let me know if you disagree though. This is currently enforced through TypeScript with target and types being explicitly defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants