4

I'm dabbling with node.js and coffeescript and I want to know what is a good unit test and acceptance test setup for the technologies. The data component of the project (backend/webserver/database) is using coffeescript and node.js and the view and component is going to be in coffeescript/javascript (using titanium appcelerator) and they are very separate but if they can use the same testing frameworks for both it would be cool.

The names I have heard after a bit of searching are Jasmine, Zombie and Mocha.

Any help would be appreciated Thanks.

UPDATE:

I forgot to add I'm used to developing using rails and using rspec for unit tests and Cucumber for acceptance tests.

2 Answers 2

3

Mocha, Vows, and Jasmine are the most well known. (I haven't heard of Zombie). Which one to use is kind of an opinion question. We found Vows to be pretty heavyweight. Jasmine moved in a better direction, but Mocha is doing the job for now. We've had decent success with Mocha for BDD style unit tests. Here's an example:

Scout = require '../../Scout'
FilteringStrategy = require '../../models/filteringStrategies/FilteringStrategy'
FormattingStrategy = require '../../models/formattingStrategies/FormattingStrategy'
RetrievalStrategy = require '../../models/retrievalStrategies/RetrievalStrategy'
EchoInputStrategy = require '../../models/retrievalStrategies/EchoInputStrategy'
CdrStrategy = require './mocks/CdrStrategy'
EveryOtherStrategy = require './mocks/EveryOtherStrategy'
ArrayToStringStrategy = require './mocks/ArrayToStringStrategy'

require 'should'

describe 'When constructed with a custom retrieval technique', ->
  describe '#get', ->
    it 'should return results', (done)->
      data = [0..10]
      connectionScout = new Scout(CdrStrategy)

      connectionScout.get data, (results)->
        results.should.eql [1..10]
        done()

It doesn't appear that there's any fully integrated Cucumber-esque business-readable DSL type of tool for NodeJS and Coffeescript yet.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm a big fan of using Mocha for unit tests and Zombie.js for end-to-end browser testing.
According to cucumber.js: "Both JavaScript (.js) and CoffeeScript (.coffee) source files are supported."
0

I use Jasmine and it works for me, you can write all testcases by coffeescript.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.