testdouble / quibble

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

error in node v16.13.0 #97

Closed travi closed 1 year ago

travi commented 1 year ago

i'm excited about the update to support node v20, so i'm eager to get recent renovate PRs for the new testdouble version merged. however, some of my projects are failing for those updates when i have node v16.13.0 in the matrix of versions. it looks like v16.14.0 is passing, but v16.12.0 fails like v16.13.0. I did not test more versions below v16.12.0.

TypeError: Cannot destructure property 'port' of 'undefined' as it is undefined.
    at globalPreload (file:///Users/travi/development/form8ion/project/node_modules/quibble/lib/quibble.mjs:144:33)
    at ESMLoader.preload (node:internal/modules/esm/loader:362:48)
    at ESMLoader.addCustomLoaders (node:internal/modules/esm/loader:194:10)
    at initializeLoader (node:internal/process/esm_loader:82:19)
    at async loadESM (node:internal/process/esm_loader:87:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)
ERROR: "test:integration:base -- --profile noWip" exited with 1.

an example of the error that i'm seeing can be found in this build result.

reproduction steps:

  1. git clone git@github.com:form8ion/project.git
  2. nvm use 16.13.0
  3. npm install
  4. npm run test:integration
searls commented 1 year ago

Uh oh! cc/@giltayar

giltayar commented 1 year ago

Yup. It's a bug in Node.js 16.13.x, fixed in 16.14.x. Node.js doesn't pass me the "message port" through which the API and the loader communicate.

While I could use the old system that didn't use a message port, specifically only for Node.js 16.13.0, I don't think it's worth it.

Thanks for the reproduction, though! It's issues like these that make our life easier!

travi commented 1 year ago

understood. unfortunate that this means that i'll need to push out some major package versions in order to get updated, but i totally understand the stance. thanks for the explanation