Javascript Unit Testing Full Stack

442 views Asked by At

We are looking for a Javascript test framework that can execute tests across the entire application stack, on the client as well as the server. We are using jQuery, RequireJS and Backbone.js on the client, and Node.js and express on the server.

Node.js is supposed to simplify creating web application by providing a more similar setting to both client side and server side development by using the same language (among it's other goals). However, I found it hard to unit test and come up with a consistent set of technologies that work on the client and server.

Currently, we are using QUnit for testing on the client and Expresso and Should.js on the server. They have totally different interfaces, which make it very difficult to test code that is shared between the client and server. Consider for example a module that does validation, both the client and the server need access to this and both need to unit test on all clients and the server.

Essentially, I am looking for that holy grail that allows us to develop web application in a similar fashion that client-server application are developed in languages like python and ruby.

1

There are 1 answers

4
Eric Wendelin On BEST ANSWER

It sounds like you're looking for something like BusterJS which has server-side and client-side components. You would have a separate set of tests for each part, but the syntax would remain consistent. You'd just specify your env in the buster.js config like so:

env: "browser", // or "node"

This is by far my favorite choice from all available frameworks right now.