Ts-jest: Cannot find module '@babel/core'

Created on 3 Aug 2018  路  12Comments  路  Source: kulshekhar/ts-jest

Issue:

When I run Jest tests I get Cannot find module '@babel/core'. Prior to v23.1.0 this did not error as babel-core was used.

Expected behavior:

I'm not sure if this was intentional or not. Either this shouldn't throw when babel-core is present or peerDependencies should be updated and possibly a major version bump should be made.

Most helpful comment

thanks @byCedric. And thanks @kulshekhar for taking care of the merging and publishing quickly as well!

All 12 comments

preprocessor.js seems to be missing in v23.1.0

I have the older <rootDir>/node_modules/ts-jest/preprocessor.js in my transform settings (which is a reference to ts-jest/dist/preprocessor.js) both files are missing.

@babel/core should at least be a peer dependency.

Got the same issue here

@scttcper for the preprocessor.js, you should replace any transform in the jest config with <rootDir>/node_modules/ts-jest/preprocessor.js to just ts-jest.

For the @babel/core, installing the @babel/core will do the trick. Working right now on a patch for both

@huafu I think we should describe breaking changes in the release page. I think we forgot about that.

Workaround if you does not require babel.

// pacakge.json
"jest": {
    "globals": {
      "ts-jest": {
        "skipBabel": true
      }
    }
}

@azu thanks. Actually it's not a workaround, it's expected to not use neither load babel if you set this flag.
Also don't forget to read the new (but to be completed) troubleshooting page 馃槈

Greenkeeper and travis are still reporting this issue with missing babel, even when upgrading to 23.1.1. See Travis for full log.

thx @byCedric, looking at it now

@huafu ah thanks! You are quick! Almost quicker than the notifications of the automated tools 馃槵 Looks good and again, thanks for the fix!

thanks @byCedric. And thanks @kulshekhar for taking care of the merging and publishing quickly as well!

Was this page helpful?
0 / 5 - 0 ratings