与 Node.js 一起使用的最佳测试框架是什么? [英] What is the best testing framework to use with Node.js?

查看:24
本文介绍了与 Node.js 一起使用的最佳测试框架是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 https://github.com/ry/node 查看了相当长的测试框架列表/wiki/modules#testing.使用这些框架有何经验?

I have looked at the rather long list of testing frameworks at https://github.com/ry/node/wiki/modules#testing. What is the experience with these frameworks?

显然,在浏览器中运行的能力将是一个很大的好处,但我主要对 Node.js 感兴趣.带有严重异步倾斜的东西会很棒.

Obviously the ability to run in the browser would be a big bonus, but I'm mainly interested in Node.js. Something with a heavily asynchronous slant would be great.

推荐答案

更新:

Mocha 在我看来是最好的.

使用这些框架有何经验?

What is the experience with these frameworks?

我玩过 expresso,这是一个非常酷的测试框架,也有测试覆盖.它由 TJ Holowaychuk 创建,他也是 Express.js 的创建者(非常快(和小型)基于 Node.js 和 Connect 的服务器端 JavaScript Web 开发框架).我最近看到他还有一个很酷的库,叫做 should.js 可以和 Expresso 一起使用以获得更好的测试体验.

I played with expresso which is pretty cool testing framework which also has test-coverage. It has been created by TJ Holowaychuk who is also the creator of Express.js (insanely fast (and small) server-side JavaScript web development framework built on Node.js and Connect). I recently saw that he also has a cool library called should.js which can be used together with Expresso for a even better testing experience.

显然,在浏览器将是一个很大的好处

Obviously, the ability to run in the browser would be a big bonus

我不相信它可以在浏览器中运行,但我也不明白你为什么要在浏览器中运行它?

I don't believe it can run in the browser, but I also don't get why you would want to run it inside the browser?

但我主要对 Node.js 感兴趣.严重异步的东西倾斜会很棒.

but I'm mainly interested in Node.js. Something with a heavily asynchronous slant would be great.

快递引述:

传递给每个回调的参数是 beforeExit,通常使用断言回调已经调用.

The argument passed to each callback is beforeExit, which is typically used to assert that callbacks have been invoked.

您可以使用 beforeExit 来测试异步函数.

You can use beforeExit to test asynchronous functions.

提示:TJ Holowaychuken.wikipedia.org/wiki/GitHub" rel="noreferrer">GitHub,因为他创建了非常好的开源代码.

TIP: Follow TJ Holowaychuk on GitHub, because he creates very good open-source code.

这篇关于与 Node.js 一起使用的最佳测试框架是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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