hi! Anyone else hit this with pact-js 16.5.0? It p...
# pact-js
d
hi! Anyone else hit this with pact-js 16.5.0? It pulls in https-proxy-agent@9, which is ESM-only, and our Jest (ts-jest) suite blows up at import:
Copy code
SyntaxError: Cannot use import statement outside a module
  (https-proxy-agent@9.1.0/dist/index.js)
The bump PR (#1731) actually called this out and showed it breaking the example jobs, but it got merged and there's no follow-up. We pinned it back with an override (
@pact-foundation/pact>https-proxy-agent: 7.0.6
) and we're green again. Is a revert or lazy-import fix on the radar?
👋 1
m
Hey Dmitry, apologies for that. I’ve created https://github.com/pact-foundation/pact-js/issues/1858 to track it. There were no plans to fix things (until just now!), if you were keen on a PR to help we’d certainly consider it. I think what happened, is that the build was red but after the examples were re-worked to use vite, the build started passing (because we previously also used jest) and this slipped in. The minor version problem aside, is there a reason you can’t update Jest to support ESM? We have discussed being ESM native for a while now, as it’s the modern standard and pretty much all tooling supports it. It’s likely to happen in a future major version.
j
On the 'update Jest to support ESM': It's is unfortunately something Jest has flagged as being experimental for a while. They have a whole page for it: https://jestjs.io/docs/ecmascript-modules I really don't know if or when they'll get first class support 😞
m
It is just one of the many reasons I hate jest
😅 1
j
I love that the admonition on that page states:
the APIs Jest uses to implement ESM support are still considered experimental by Node (as of version 18.8.0).
Do they realise we're up to Node 26? And LTS versions 18 and 20 are now both EOL?
😆 1
m
Well, people in glass houses Josh… I’m sure there are many parts of our docs suggesting equally awkward things
😅 1
💯 1
🫠 1