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

Getting an error when trying to use esbuild-runner with the latest version of Jest. Config is simple:

transform: {
    '\\.ts$': 'esbuild-runner/jest',
  },

Versions: jest: 27.0.4 esbuild-runner: 2.2.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
esturckecommented, Jun 15, 2021

I just ran into this in a new project as well. I was able work around this by creating an ./esr-jest.js:

const { process } = require("esbuild-runner/jest")
module.exports = { process }

And then in ./jest.config.js:

  transform: {
    "^.+\\.tsx?$": "./esr-jest",
  },

I’m not sure why this works, but I’m guessing something to do with how Jest’s requireOrImportModule works.

2reactions
folkecommented, Aug 30, 2021

I just released an update that fixes this

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 >
TypeError: Jest: a transform must export something. #2612
1 and running our test suite we get the following error message: TypeError: Jest: a transform must export something. image. To Reproduce. Clone ......
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 >

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