You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to start a new Node Express project and want to try to get it working with ESM. I've followed did all the ESM jest.config.ts settings that were recommended. The project can successfully be transpiled by TypeScript and can be ran. However, when I attempt to import from the helmet package, jest is failing with the following:
FAIL src/app.test.ts
● Test suite failed to run
src/app.ts:32:10 - error TS2349: This expression is not callable.
Type 'typeof import(".../node_modules/helmet/index")' has no call signatures.
32 helmet.default({
From what I'm able to sleuth so far on why helmet is different, is that the package structure is as follows:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey all,
I'm trying to start a new Node Express project and want to try to get it working with ESM. I've followed did all the ESM
jest.config.ts
settings that were recommended. The project can successfully be transpiled by TypeScript and can be ran. However, when I attempt to import from thehelmet
package, jest is failing with the following:From what I'm able to sleuth so far on why
helmet
is different, is that the package structure is as follows:With it's
package.json
import settings as:I've built a mini-app on a public repo here that recreates the issue: https://github.com/basicdays/jest-ts-node
Running
npm install && npm test
will reproduce the error.Beta Was this translation helpful? Give feedback.
All reactions