[英]How to disable Babel integration in Jest?
I have project which has code targeting both browser and node. 我的项目包含针对浏览器和节点的代码。 It has
.babelrc
file for the browser code. 它有
.babelrc
文件用于浏览器代码。 But when I'm running tests for the node code using Jest it always reads the .babelrc
file which is not required. 但是当我使用Jest运行节点代码测试时,它总是读取
.babelrc
文件。
So I can somehow disable it? 所以我可以以某种方式禁用它?
You need to create an additional jest setting file for your node test. 您需要为节点测试创建一个额外的jest设置文件。 In this file set
transform
to an empty object. 在此文件集中
transform
为空对象。 To use this file you need to call jest with the --config
option pointing to your node jest setting. 要使用此文件,您需要使用指向节点jest设置的
--config
选项调用jest。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.