使用jasmine来测试Express.js [英] Use jasmine to test Express.js

查看:125
本文介绍了使用jasmine来测试Express.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Node.js和Express框架。我是茉莉花的粉丝。所以我想使用茉莉花每当我可以,但是,我找不到一个很好的方式测试快递与茉莉花。例如,应该如何在app.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆