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've been working with ESM for a while. Changes to Jest and my own understanding have caused me to try and thin my projects, to go to a more minimal number of npm install commands. It also caused me to better understand how to I should be able to use this present and ESM together. My jest.config.ts now looks like this:
importtype{JestConfigWithTsJest}from"ts-jest"constconfig: JestConfigWithTsJest={preset: "@shelf/jest-mongodb",extensionsToTreatAsEsm: [".ts"],verbose: true,rootDir: "src",moduleNameMapper: {"^(\\.{1,2}/.*)\\.js$": "$1",},transform: {// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`"^.+\\.tsx?$": ["ts-jest",{useESM: true,},],},fakeTimers: {enableGlobally: true,doNotFake: ["nextTick","setImmediate"],},}exportdefaultconfig
In the past, I didn't understand that I could use this preset with ESM, but I realize I can if I configure ts-jest as above.
What I found was that NODE_OPTIONS=--experimental-vm-modules npx jest --watch results in tests being run over and over again without me changing any files. It simply repeats.
jest does work without --watch. Through trial and error, if I remove preset: "@shelf/jest-mongodb".
I'll go back to manually configuring the mongdb memory server, but if someone sees something obviously wrong with my configuration, please let me know.
The text was updated successfully, but these errors were encountered:
I've been working with ESM for a while. Changes to Jest and my own understanding have caused me to try and thin my projects, to go to a more minimal number of
npm install
commands. It also caused me to better understand how to I should be able to use this present and ESM together. Myjest.config.ts
now looks like this:In the past, I didn't understand that I could use this preset with ESM, but I realize I can if I configure
ts-jest
as above.What I found was that
NODE_OPTIONS=--experimental-vm-modules npx jest --watch
results in tests being run over and over again without me changing any files. It simply repeats.jest
does work without--watch
. Through trial and error, if I removepreset: "@shelf/jest-mongodb"
.I'll go back to manually configuring the mongdb memory server, but if someone sees something obviously wrong with my configuration, please let me know.
The text was updated successfully, but these errors were encountered: