[英]Using jQuery in Mocha tests with Node NOT io.js
I'm running Mocha/Chai unit tests of a module which uses jQuery (for ajax calls) and of course jQuery complains about the missing document, cause I run tests without browser. 我正在运行使用jQuery(用于ajax调用)的模块的Mocha / Chai单元测试,当然jQuery抱怨缺少文档,因为我在没有浏览器的情况下运行测试。 I found jsdom module which creates virtual dom, that can fool jquery, but the project has ditched node.js in favor of io.js and can't be used with node. 我发现创建虚拟dom的jsdom模块可以欺骗jquery,但该项目放弃了node.js,转而使用io.js,并且不能与node一起使用。 I don't think I feel like switching to io.js in the middle of a project so my question is: 我不认为我想在项目中间切换到io.js,所以我的问题是:
Is there any sane way of using jQuery in Mocha tests from commandline at the moment? 目前有没有在命令行中在Mocha测试中使用jQuery的明智方法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.