esm-jest
esm-jest copied to clipboard
Getting "TypeError: Jest: a transform must export a `process` function."
TypeError: Jest: a transform must export a `process` function.
at ScriptTransformer._getTransformer (node_modules/jest-runtime/build/script_transformer.js:236:15)
I'm using the same jest version as you, running jest --watch --runInBand --no-cache --config jest.config.js
Downgrading from "esm": "3.2.25"
to "esm": "3.1.0"
fixed the issue but then I get Cannot read property 'next' of undefined
:
FAIL src/utils/redis.test.js
utils/redis
Redis client connection succeed
✕ client connected (234ms)
Redis client connection error
✓ Client throw on bad IP (3ms)
✓ Client throw on bad password
● utils/redis › Redis client connection succeed › client connected
TypeError: Cannot read property 'next' of undefined
> 1 | import fetch from 'node-fetch'
| ^
2 | import { createHttpLink } from 'apollo-link-http'
3 | import { InMemoryCache } from 'apollo-cache-inmemory'
4 | import ApolloClient from 'apollo-client'
at Object.n.(anonymous function) (node_modules/esm/esm.js:1:1796)
Hello, I got the same problem.
@devniel I have the same issue too
How did you fix it?
an alternative version
https://github.com/seeliang/esm-jest/commit/e6ec9c0285a9ebbfad20a3546ba493b0e3b7ff7e