Mocha、Vows和Jasmine是最知名的。(我没听说过僵尸)。使用哪一个是一种意见问题。我们发现 Vows 非常重量级。Jasmine 朝着更好的方向发展,但 Mocha 目前正在做这项工作。我们在 Mocha 的 BDD 风格单元测试中取得了不错的成功。这是一个例子:
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()
似乎还没有任何完全集成的 Cucumber 式业务可读 DSL 类型的工具用于 NodeJS 和 Coffeescript。