使用 jasmine 测试 Express.js [英] Use jasmine to test Express.js
问题描述
我正在学习 Node.js 和 Express 框架.我是茉莉花的忠实粉丝.所以我想尽可能地使用 jasmine,但是,我找不到用 jasmine 测试 Express 的好方法.例如,我应该如何在 app.js 中测试路由?
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?
如果我在 app.js 中有这条路线:
If I have this route in app.js:
app.get('/', function(req, res) {
...
});
如何使用jasmine进行测试?
How can I use jasmine to test it?
推荐答案
Jasmine-node使用 node.js 可以轻松使用 jasmine.他们的网站上有一些例子.另一个例子可以从http://blog.drewolson.org/post/14684497867/找到 网络.archive.org
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/ web.archive.org
这篇关于使用 jasmine 测试 Express.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!