Skip to content

Conversation

@SethFalco
Copy link
Member

@SethFalco SethFalco commented Nov 2, 2025

Description

Node.js has added a standard library for Node.js unit testing, which has become more mature over the years, including a test runner, mocking support, coverage, etc.

See: https://nodejs.org/en/learn/test-runner/using-test-runner

I propose we migrate from mocha/sinon/should/nyc to just the standard library, which provides everything we need without adding literally 170 npm dependencies to the project.

  • Drops 4 dev dependencies.
  • Drops 170 indirect dependencies. (i.e. node_modules not declared in package.json)
  • Easier to maintain and find maintainers for as it's safe to assume exposure to node:test, whereas testing in the Node.js ecosystem has traditionally been very fragmented.

All tests have been kept intact, this just migrates from one library to the standard library. I've been using node:test in all of my other projects as well, and it's pretty great imo.

Checklist

Please review this checklist before submitting a pull request.

  • Code compiles correctly
  • Created tests, if possible
  • All tests passing (npm run test:all)
  • Extended the README / documentation, if necessary

Copy link
Member

@owenvoke owenvoke left a comment

Choose a reason for hiding this comment

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

I'm personally in favour of this partly just due to the pretty big reduction in dependencies. 👀 I didn't know that Node had it's own test runner for a while, that's pretty neat. 👍🏻

However, I guess if people are used to working with the current setup and it's not broken, perhaps we should stick to it. 🤷🏻 But will leave to other maintainers with more familiarity with the project to approve. 👍🏻

@sebastiaanspeck
Copy link
Member

sebastiaanspeck commented Nov 18, 2025

I'm personally in favour of this partly just due to the pretty big reduction in dependencies. 👀 I didn't know that Node had it's own test runner for a while, that's pretty neat. 👍🏻

However, I guess if people are used to working with the current setup and it's not broken, perhaps we should stick to it. 🤷🏻 But will leave to other maintainers with more familiarity with the project to approve. 👍🏻

To me reducing the amount of dependencies has much more value than the argument to stick to a 3rd party test library because people are used to it.

Another argument to switch to the Node test runner, is that I see the CI is much quicker.

@sebastiaanspeck sebastiaanspeck self-requested a review November 18, 2025 14:42
@SethFalco SethFalco force-pushed the node-test branch 7 times, most recently from 10e3bd0 to 6942b61 Compare November 18, 2025 15:50
@SethFalco
Copy link
Member Author

I'll return to this once the Cloudflare issues etc. are all over. I'm not sure what's wrong, but for me the tests are passing intermittently at the moment.

  • On my usual Wi-Fi locally, they pass around 95% of the time.
  • On CI and on my slow Wi-Fi locally, they fail 100% of the time.

The issue appears to be related to either slower networks or when the connection lives for longer.

This makes it sound like a timeout or race condition to me, but I don't see any obvious problems for now. But it's probably not a good time to try and fix network related tests while half the internet is on fire anyway.

@SethFalco
Copy link
Member Author

Rebased and resolved merge conflicts, and tests are passing now! 🎉

Not 100% sure if the failures before were due to the outages or not, but CI did pass twice in a row, so I'll just assume that it was. Of course, I'm happy to take a deeper look if the issue comes up again!

@sebastiaanspeck
Copy link
Member

Rebased and resolved merge conflicts, and tests are passing now! 🎉

Not 100% sure if the failures before were due to the outages or not, but CI did pass twice in a row, so I'll just assume that it was. Of course, I'm happy to take a deeper look if the issue comes up again!

I've seen other PRs failing as well the last day(s) (#490 for example, but as well the Dependabot PRs).
We can give this a shot and see if main has the issues as well?

@SethFalco
Copy link
Member Author

SethFalco commented Nov 19, 2025

Yeah sure!

I'll get this merged then, and if we see any issues with main I'll give it a peek this weekend.

Edit: I can also confirm that the CI run for main after merging this passed as well. 👍

@SethFalco SethFalco merged commit 59b9d39 into tldr-pages:main Nov 19, 2025
9 checks passed
@SethFalco SethFalco deleted the node-test branch November 19, 2025 22:00
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.

3 participants