Blockquote
I am getting this error while testing apis
*> Configuration error:
>
> Could not locate module ./src/classes/mail-service mapped as:
> C:\Users\ASUS\Documents\GitHub\NEOS FLOW\flow\@server\profile-service\src\$1.
>
> Please check your configuration for these entries:
> > {
> > "moduleNameMapper": {
> > "/src\/(.*)/": "C:\Users\ASUS\Documents\GitHub\NEOS FLOW\flow\@server\profile-service\src\$1"
> > },
> > "resolver": undefined
> > }
>
> 1 | import sgMail from "@sendgrid/mail";
> > | ^
> *
this is my jest.configs.ts
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
coverageDirectory: "coverage",
collectCoverageFrom: ["src/**/*.{js,ts}"],
forceExit: true,
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
moduleNameMapper: {
"src/(.*)": "<rootDir>/src/$1",
},
transformIgnorePatterns: ["<rootDir>/node_modules/"],
};
As I guess this is failing because node_module is not able to find @sendgrid/mail package in it . I tried with to delete and install node_module but didn't work.
jest 29.3.1 version. Node.js v18.13.0.
Please suggest any solution. Thankyou, Have a great day.