Skip to content

Conversation

@ptomato
Copy link
Contributor

@ptomato ptomato commented Nov 4, 2025

This is something we've been talking about for a while. I started doing it for the upstream reference polyfill, but abandoned it because Jest was too memory-heavy to support the number of snapshot tests I wanted to do. However, that work was mostly reusable for this polyfill.

These were accidentally added in a previous rebase.
These have been removed upstream, probably because of having been
converted into test262 tests already and using temporal-test262-runner.
They were missed in the rebases.
@ptomato ptomato force-pushed the jest branch 4 times, most recently from ecfb1ba to 99e600c Compare November 4, 2025 01:23
@ptomato
Copy link
Contributor Author

ptomato commented Nov 4, 2025

Unfortunately I've run out of time for this without getting it to work ☹️

Jest's "resolver" option doesn't seem to work properly on Node 20.x and earlier. Here's the error:

> @js-temporal/[email protected] test /home/runner/work/temporal-polyfill/temporal-polyfill
> npm run build && node --no-warnings --experimental-modules --experimental-vm-modules --experimental-specifier-resolution=node --icu-data-dir node_modules/full-icu node_modules/.bin/jest


> @js-temporal/[email protected] build /home/runner/work/temporal-polyfill/temporal-polyfill
> rm -rf dist/* tsc-out/* && tsc && rollup -c rollup.config.js --bundleConfigAsCjs


tsc-out/index.js → ./dist/index.esm.js, ./dist/index.cjs...
created ./dist/index.esm.js, ./dist/index.cjs in 1s

tsc-out/index.js → ./dist/index.umd.js...
created ./dist/index.umd.js in 3.4s
● Validation Error:

  Module <rootDir>/jest.resolve.cjs in the resolver option was not found.
         <rootDir> is: /home/runner/work/temporal-polyfill/temporal-polyfill

  Configuration Documentation:
  https://jestjs.io/docs/configuration

npm ERR! Test failed.  See above for more details.
Error: Process completed with exit code 1.

The file that it claims not to find is right there, so I'm not sure what's going on. It also works on my machine, even with a copy of Node 18. Hopefully someone else can take this and run with it!

@fabon-f
Copy link
Contributor

fabon-f commented Nov 6, 2025

I can reproduce the issue when running npm ci --no-optional && npm test in Node.js v20.19.5 and npm v10.8.2. Without --no-optional option, it works fine.

npm ci --no-optional seems to skip all "optional" packages including platform-specific binary package needed by Jest (in this case @unrs/resolver-binding-linux-x64-gnu for Linux) in older npm.

@ptomato
Copy link
Contributor Author

ptomato commented Nov 7, 2025

Thanks, that fixed Node 18.x and 20.x, but there is still the same error on 16.x, and a different error on 14.x.

@fabon-f
Copy link
Contributor

fabon-f commented Nov 28, 2025

Jest v30 supports only Node.js v18 and later, so I think there are two options: use older Jest v29 which supports Node.js v14 and v16, or stop testing for EOL versions (v14, v16).

Drop the obsolete Demitasse dependency.

Rather than convert every single test to use Jest's expect-style
assertions, write simple wrappers for assert(), throws(), etc. The idea
is to use the Jest-style assertions in new code but the existing code
can be left alone.
To generate this commit I installed node@18 with Homebrew and ran
`npm install --package-lock-only`.
@ptomato
Copy link
Contributor Author

ptomato commented Nov 29, 2025

That did it, thank you @fabon-f!

This is ready for merging now, I think.

Copy link
Contributor

@justingrant justingrant left a comment

Choose a reason for hiding this comment

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

Amazing! Nice work making this happen.

@ptomato
Copy link
Contributor Author

ptomato commented Dec 1, 2025

Thanks for the review.

@ptomato ptomato merged commit ef71639 into main Dec 1, 2025
31 checks passed
@ptomato ptomato deleted the jest branch December 1, 2025 18:05
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.

4 participants