现有的单元测试框架将测试NodeJs服务器端和客户端?

时间:2021-08-31 15:59:42

So there seems to have been a flurry of new Unit test frameworks that have popped up for Node since it was released. https://github.com/joyent/node/wiki/modules#wiki-testing

因此,自从Node发布以来,似乎出现了一系列新的单元测试框架。https://github.com/joyent/node/wiki/modules wiki-testing

Can't I use an existing framework to test my client and NodeJs server side JavaScript code? I don't want to have to go and learn yet ANOTHER implementation.

我不能使用现有的框架来测试我的客户端和NodeJs服务器端JavaScript代码吗?我不想再去学习另一个实现。

2 个解决方案

#1


2  

nodeunit is a solid unit testing library that works both on server and client.

nodeunit是一个可靠的单元测试库,可以在服务器和客户端上工作。

It uses a very simply assertion API and feels familiar to Qunit.

它使用一个非常简单的断言API, Qunit对它很熟悉。

However TJHolowaychuck recently released mocha which sounds like a solid alternative. I'd recommend placing bets on this library merely because TJ is a rock solid module author.

然而,TJHolowaychuck最近发布了mocha,听起来像是一个可靠的替代品。我建议在这个库上押注,仅仅因为TJ是一个非常可靠的模块作者。

#2


1  

We've been using Jasmine which works both as a Node module and also as a browser based test runner for client side Javascript. Its very mature, very easy to get started with and very well respected.

我们一直在使用Jasmine,它既是节点模块,也是客户端Javascript的基于浏览器的测试运行器。它很成熟,很容易上手,也很受尊重。

#1


2  

nodeunit is a solid unit testing library that works both on server and client.

nodeunit是一个可靠的单元测试库,可以在服务器和客户端上工作。

It uses a very simply assertion API and feels familiar to Qunit.

它使用一个非常简单的断言API, Qunit对它很熟悉。

However TJHolowaychuck recently released mocha which sounds like a solid alternative. I'd recommend placing bets on this library merely because TJ is a rock solid module author.

然而,TJHolowaychuck最近发布了mocha,听起来像是一个可靠的替代品。我建议在这个库上押注,仅仅因为TJ是一个非常可靠的模块作者。

#2


1  

We've been using Jasmine which works both as a Node module and also as a browser based test runner for client side Javascript. Its very mature, very easy to get started with and very well respected.

我们一直在使用Jasmine,它既是节点模块,也是客户端Javascript的基于浏览器的测试运行器。它很成熟,很容易上手,也很受尊重。