使用jasmine来测试Express.js [英] Use jasmine to test Express.js
本文介绍了使用jasmine来测试Express.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在app.js中有这条路线:
.get('/',function(req,res){
...
});
如何使用茉莉花测试?
解决方案
茉莉花节点使其易于使用茉莉花与node.js.他们的网站上有一些例子。另一个例子可以从 http://blog.drewolson.org/post/14684497867/ 找到
I am learning Node.js and Express framework. I am a big fan of jasmine. So I want to use jasmine whenever I can, however, I can't find a good way testing Express with jasmine. For example, how should I test a route in app.js?
If I have this route in app.js:
app.get('/', function(req, res) {
...
});
How can I use jasmine to test it?
解决方案
Jasmine-node makes it easy to use jasmine with node.js. There are some examples on their site. Another example can be found from http://blog.drewolson.org/post/14684497867/
这篇关于使用jasmine来测试Express.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文