Using babel-plugin-module-resolver with jest

Viewed 2095

I've got babel-plugin-module-resolver set up on my project and it works fine, until I run my tests.

I've set up ~/ to point to ./src.

I've tried adding the following to package.json but it still does not work

"jest": {
  "preset": "react-native",
  "moduleNameMapper": {
    "~": "./src"
  }
}
1 Answers

You could use babel-jest plugin to make jest use babel as a preprocessor.

You can also find an example of this here

Related