#ESM and writing test using Jest

6 messages · Page 1 of 1 (latest)

chilly locust
#

Hello, I'm writing some tests on my API gateway. I use the ES module, and I wanted to use Jest for testing. But configuring Jest with ESM is just hell. I can't make it work. Has someone ever used Jest with ESM and some specific configuration in tsconfig?

drifting trellis
#

@chilly locust It helps if you describe the problem you're running into rather than asking "has anyone ever done it"

chilly locust
drifting trellis
#

That's a type-script error saying it can't find types... but it looks like types are built-into that module, so either 1) the module isn't installed, or 2) there's something weird in whatever tsconfig you're using for jest.

jolly zinc
#

@chilly locust Can I ask how you could manage to test TypeScript ESMs with Jest? as I understand you should change a lot for example hack the default resolver for Jest. Could I have your configration files for jest.config and tsconfig? 🙏

drifting trellis
#

@jolly zinc It's probably better to open your own help channel with details of your problem rather than asking in related help channels