Cannot find module error when using sql-template-tag within jest
danielc92 opened this issue · comments
Daniel Corcoran commented
I'm getting 'cannot find module' error in jest
jest config
module.exports = {
preset: 'ts-jest',
testTimeout: 10000,
testEnvironment: 'node',
automock: false,
collectCoverage: true,
coverageDirectory: './coverage',
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!jest.config.js',
'!webpack.config.js'
],
testMatch: ['**/?(*.)+(spec|test).ts'],
moduleNameMapper: {
'<rootDir>/src/config': '<rootDir>/src/__mocks__/config.js'
},
moduleDirectories: [
'node_modules',
'src'
]
};
Blake Embrey commented
This appears to be an issue with either Jest or TS Jest, not my module, so those might be better places to ask questions. This looks the same as this question: https://stackoverflow.com/questions/66154478/jest-ts-jest-typescript-with-es-modules-import-cannot-find-module
If you are unable to use ES modules in your setup, I recommend using the previous major release of the package that was written for CommonJS instead.