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

feat(semver-major): Upgrade package to Node.js v23 #54

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RedYetiDev
Copy link
Member

Ref: nodejs/admin#928

This PR introduces a major upgrade to the package, adding support for Node.js v23 features. Please note that the minimum required Node.js version is now v18, which was used for all testing.

The update includes most of the new features in v23, with the following exceptions:

  • Importing reporters or custom modules from node_modules located outside the test module's directory
  • Setting global hooks using --require or --import when process isolation is disabled and multiple files need to be executed
  • Code coverage support
  • File watching capabilities
  • Module mocking functionality
  • Source map caching

with:
node-version: ${{ matrix.node }}
node-version: 18
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's bring back the matrix

Copy link
Member Author

@RedYetiDev RedYetiDev Oct 27, 2024

Choose a reason for hiding this comment

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

.This package isn't compatible with v20, or with v16. It's specifically meant for v18

Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably be aiming for support on all supported versions of Node.js. If there's something that makes it work only for v18 but not v20, something's probably wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll look into it, but we really don't need to support v20. v20 has most features that this aims to replicate

.npmignore Outdated Show resolved Hide resolved
MAINTAINING.md Outdated Show resolved Hide resolved
@aduh95
Copy link
Contributor

aduh95 commented Oct 27, 2024

This PR is hard to review without knowing what process did you follow and understanding the motivations behind the choices that were made.

@RedYetiDev
Copy link
Member Author

Sorry if this is difficult to review! A breakdown of my thought process is as follows:

When updating the library, there was the primary goal of adding as many v23 features that could be backported to this version easily. Along with this goal, a secondary goal was to modify as little source code as possible (E.G. the files in lib/internal/test_runner/ that are directly from the core repository).

With that in mind, the instances where code absolutely had to be modified are denoted with /* NOTE(RedYetiDev): ... */ comments.

Additionally, I understood the following limitations

  • Without access to the internal inspector bindings, code coverage was not possible (and therefore source maps aren't really needed)
  • Without access to the internal libuv bindings associated with the FileWatcher class, file watching was not possible
  • Without access to the module loader, module mocks would not be possible, nor modules imported as --test-reporter, among other things.
  • In order to make use of the CLI flags that are not allowed on v18, they would have to be passed after the fiile, therefore, process.argv and process.execArgv are both checked.

Anything else you want to know?

@RedYetiDev RedYetiDev marked this pull request as ready for review November 4, 2024 18:26
@bnb
Copy link
Contributor

bnb commented Nov 7, 2024

(Edit by @RedYetiDev: I accidentally removed the content of this comment, re-added)

I think landing this is good as a way to get close to catching up, but ideally there would be 1:1 parity between the package and the core module - it should be a drop in replacement.

IMO, testing shouldn't be using core modules - we should only be using things that are available to the ecosystem. If there's something that's useful for testing that we want to hook into in core, we should find ways to expose those APIs.

@RedYetiDev
Copy link
Member Author

RedYetiDev commented Nov 7, 2024

IMO, testing shouldn't be using core modules - we should only be using things that are available to the ecosystem. If there's something that's useful for testing that we want to hook into in core, we should find ways to expose those APIs.

I highly disagree with this. The test runner should make use of core modules, it's a builtin for a reason. Users who do not wish for this behavior can use alternative libraries, such as Mocha.

As for the builtin, using internal modules allows for it to use a wide-range of features not typically exposed to userland, and it can access (if needed) the CPP builtins that are the backbone of Node.js.

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