Open rjray opened 1 month ago
I created a new branch and tried to follow a blog post that used ts-jest
, rather than babel
. I installed the necessary packages, and updated my jest.config.ts
to be:
/** @type {import('ts-jest').JestConfigWithTsJest} **/
export default {
moduleNameMapper: {
"^(constants|controllers|database|db|models|types|utils)":
"<rootDir>/src/$1",
},
preset: "ts-jest",
testEnvironment: "node",
};
I get the same error message. If I remove the moduleNameMapper
, then I get import errors (as before) prior to it reaching the module that is the source of the error. If it helps, I've checkpointed the non-working code in the branch at: https://github.com/rjray/smdb/tree/jest-debugging (if you switch to the main branch, you will get the Babel version but not the actual test case itself).
Everything I can find via searching seems to indicate that the TypeScript code under src
is not being transformed.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Could be because of the typescript 5.6. https://github.com/microsoft/TypeScript/issues/59991
Page(s)
https://jestjs.io/docs/getting-started#using-typescript
Description
Following the instructions to set up testing of TypeScript code with Babel lead me to the following error message:
My
jest.config.js
is:(Without the
moduleNameMapper
declaration, none of the local import paths in the TS code resolve.)babel.config.js
is: