babel-jest doesn’t handle ES6 within modules

By default any code in node_modules is ignored by babel-jest, see the Jest config option transformIgnorePatterns. I’ve also created a PR on your example repo, so you can see it working.

While this works, I’ve found it to be extremely slow in real applications that have a lot of dependencies containing ES modules. The Jest codebase has a slightly different approach to this as you can find in babel-jest transforming dependencies. This can also take much longer on Windows, see Taking 10 seconds on an empty repo.

If doing “unit” testing, mocking is probably the better way to go.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)