React Jest test fails to run with ts-jest - Unexpected token on imported file

After messing around with this for absolutely ages it looks like the problem was to do with the lodash-es package and Jest not supporting ES modules. This is mentioned here:

Using @CarlosCrespo answer as a basis I also had to tell babel not to ignore lodash-es when transpiling using the transformIgnorePatterns property to give me the following:


module.exports = {
  moduleDirectories: [
  transform: {
    "\\.tsx?$": "ts-jest",
    "\\.jsx?$": "babel-jest", // if you have jsx tests too
  globals: {
    "ts-jest": {
      "tsConfig": '<rootDir>/tsconfig.json'
  transformIgnorePatterns: [

In addition to this I also needed to update my tsconfig.json after another error - Cannot read property createElement of undefined was caused whilst using TypeScript:


  "compilerOptions": {
    "outDir": "./dist/",
    "noImplicitAny": true,
    "lib": ["dom", "esnext"],
    "module": "esnext",
    "target": "es5",
    "jsx": "react",
    "esModuleInterop": true,
    "allowJs": true,
    "allowSyntheticDefaultImports": true
  "exclude": ["node_modules"]