I'm currently trying to use jest in a Typescript monorepo (not Lerna or anything just baseURL and paths, also, not my decision) and one of the files I'm testing imports a something from the monorepo.
import {publish, subscribe} from "message-bus"
Now in my tsconfig.json I have:
...
"compilerOptions": {
"baseUrl": "./packages",
"paths": {
"message-bus":["message-bus/src"],
},
...
and in the package jest.config.js:
module.exports = {
...
preset: 'ts-jest',
moduleNameMapper: {
'^message-bus/(.*)$': "../message-bus/src/$1"
}
...
}
Even with all this in place jest complains that it cannot find the module message-bus. Can you please help me fix my configuration?