testdouble / quibble

Makes it easy to replace require'd dependencies.
94 stars 25 forks source link

support Node v20.6.0 ability to auto-register loader #102

Closed giltayar closed 1 year ago

giltayar commented 1 year ago

Node.js v20.6.0 has the ability to register a loader and thus auto load it without the user needing to --loader it (https://github.com/nodejs/node/pull/46826).

I implemented the changes necessary for this, while supporting the old --loader interface for both new and old Node.js versions. So the tests run without --loader if running under a node version that supports registering, and also with --loader for all versions.

(note that the code is getting hairier with every change in the loader specification. Hopefully, once 20 will become the oldest version we can do a clean sweep that will remove all this cruft, because it seems that the loader API has finally stabilized)

As usual, once quibble is released, I'll test and update testdouble.js with the new version and also update its documentation.

searls commented 1 year ago

Thanks for all this @giltayar!

giltayar commented 1 year ago

@searls not sure about the protocol here. Do I merge? I'm assuming you need to create the version, because I don't have NPM permissions?