question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Jest: a transform must export something.

See original GitHub issue

🐛 Bug Report

After upgrading from jest 23.6.3 to 27.0.1 and running our test suite we get the following error message:

TypeError: Jest: a transform must export something.

image

To Reproduce

  1. Clone the GIT repo
  2. Upgrade jest:
   name  range   from       to      url
>( ) jest  latest  26.6.3  ❯  27.0.1  https://jestjs.io/
  1. Run yarn test

Expected behavior

No error message

Debug log:

# content of ts-jest.log :
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"26.5.6"},"message":"creating jest presets not handling JavaScript files","sequence":1,"time":"2021-05-25T13:21:43.451Z"}
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"26.5.6"},"message":"creating jest presets not handling JavaScript files","sequence":2,"time":"2021-05-25T13:21:43.474Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"26.5.6"},"message":"creating Importer singleton","sequence":3,"time":"2021-05-25T13:21:45.906Z"}

envinfo

System:
    OS: Windows Server 2016
    Node version: 14.15.4

Npm packages:
    jest: 27.0.1
    ts-jest: 26.5.6
    typescript: 4.2.4

Related issue

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:47
  • Comments:29

github_iconTop GitHub Comments

67reactions
ahnpnlcommented, May 26, 2021

pls clear Jest cache and use ts-jest 27.0.0

38reactions
asohail-futucommented, May 28, 2021

I used this: npx jest --clearCache which showed this message after running: Cleared /private/var/folders/mr/pkt42jm120gbnm9lddwm_n9cl2tb8h/T/jest_alc100 That seemed to have cleared the cache

adding to the previous comment – clearing the cache didn’t solve the issue for me. I’m still getting the original error mentioned in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Jest: a transform must export something
I tried to debug Jest by Node debugger (something like node inspect test.js ) , and I found the culprit. For me it...
Read more >
Code Transformation - Jest
Instead of having your custom transformer implement the Transformer interface directly, you can choose to export createTransformer , a factory ...
Read more >
Error: Jest: A Transform Must Export A 'Process' Function. Stack
After upgrading from jest 23.6.3 to 27.0.1 and running our test suite we get the following error message: TypeError: Jest: a transform must...
Read more >
TypeError: Jest: a transform must export a `process` function In ...
[Solved]-ERROR: Jest: a transform must export a `process` function. STACK: TypeError: Jest: a transform must export a `process` function In VUE Project-Vue.js.
Read more >
Configuration | ts-jest - Huafu
ts-jest provides a helper to transform the mapping from tsconfig to Jest config format, but it needs the .js version of the config...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found