You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ npm run jest
> trace.moe-api@1.0.0 jest
> NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest --runInBand
Determining test suites to run...
FAIL src/get-status.test.js
● Test suite failed to run
SyntaxError: The requested module 'express-rate-limit' does not provide an export named 'default'
at Runtime.linkAndEvaluateModule (node_modules/jest-runtime/build/index.js:779:5)
This has been working for express-rate-limit@5.5.1 with nodejs and jest, and working with 6.0.0 with nodejs, but not with jest
Maybe jest (27.4.5) doesn't fully support ESM yet. Running with node is perfectly fine.
This test are written in ESM and requires --experimental-vm-modules to run with jest, because it doesn't transpile anything with babel.
This is a known issue with Jest (it does not support the exports field in package.json). A similar issue exists on the Jest repo - jestjs/jest#11742).
There is a PR to fix it that might be part of Jest v28, but until then you can use the workaround described here (basically, just delete the main field from node_modules/express-rate-limit/package.json before running the test and restore it after).
Description
This has been working for express-rate-limit@5.5.1 with nodejs and jest, and working with 6.0.0 with nodejs, but not with jest
Maybe jest (27.4.5) doesn't fully support ESM yet. Running with node is perfectly fine.
This test are written in ESM and requires
--experimental-vm-modules
to run with jest, because it doesn't transpile anything with babel.The test case: https://github.com/soruly/trace.moe-api/blob/master/src/app.js
Library version
6.0.0
Node version
v16.13.0
Typescript version (if you are using it)
No response
Module system
ESM
The text was updated successfully, but these errors were encountered: