Configuring Babel and Jest

泪湿孤枕 提交于 2019-12-05 17:34:26

Jest currently doesn't transform modules defined in globalSetup and globalTeardown. There's an open GitHub discussion here.

That being said, there are some workarounds on the same thread. You'll have to require babel-register and babel-polyfill on top of your jest.config.js. Here is the full implementation: https://github.com/facebook/jest/issues/5164#issuecomment-366139663

If someone is using TypeScript requiring ts-node/register should make it work. https://github.com/facebook/jest/issues/5164#issuecomment-376006851

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!