kenotron / esm-jest

Sample repository that would demonstrate how to use jest with ESM module
23 stars 5 forks source link

Getting "TypeError: Jest: a transform must export a `process` function." #5

Open Vadorequest opened 5 years ago

Vadorequest commented 5 years ago
    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

Vadorequest commented 5 years ago

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)
devniel commented 5 years ago

Hello, I got the same problem.

danielotieno commented 4 years ago

@devniel I have the same issue too

How did you fix it?

seeliang commented 4 years ago

an alternative version

https://github.com/seeliang/esm-jest/commit/e6ec9c0285a9ebbfad20a3546ba493b0e3b7ff7e