2013-10-14 02:36:58 +00:00
|
|
|
---
|
2012-10-11 08:13:19 +00:00
|
|
|
title: Vows
|
2015-11-24 05:02:17 +00:00
|
|
|
category: JavaScript libraries
|
2012-10-11 08:13:19 +00:00
|
|
|
---
|
|
|
|
|
2023-03-13 12:02:33 +00:00
|
|
|
### About vows
|
|
|
|
|
2013-10-14 02:36:58 +00:00
|
|
|
* [Vowsjs.org](http://vowsjs.org/)
|
2012-10-11 08:13:19 +00:00
|
|
|
|
|
|
|
### CoffeeScript usage
|
|
|
|
|
|
|
|
vows = require "vows"
|
|
|
|
assert = require "assert"
|
|
|
|
|
|
|
|
vows
|
|
|
|
.describe('My tests')
|
|
|
|
.addBatch
|
|
|
|
'context':
|
|
|
|
topic: ->
|
|
|
|
100
|
|
|
|
'should work': (number) ->
|
|
|
|
assert.equal number, 100
|
|
|
|
|
|
|
|
.export(module)
|
|
|
|
|
|
|
|
### Running
|
|
|
|
|
|
|
|
vows test/*-test.* --spec
|
|
|
|
|
|
|
|
### Assertions
|
|
|
|
|
|
|
|
assert.equal a, b
|
|
|
|
assert.notEqual a, b
|
|
|
|
assert.strictEqual a, b
|
|
|
|
|
|
|
|
assert.isNaN(number)
|
|
|
|
assert.instanceOf(object, klass)
|
|
|
|
assert.isUndefined(object)
|
|
|
|
assert.isFunction(func)
|
|
|
|
assert.isNull(object)
|
|
|
|
assert.isNotZero(object)
|
|
|
|
assert.isObject(object)
|
|
|
|
assert.isString(object)
|
|
|
|
|
|
|
|
### Async
|
|
|
|
|
|
|
|
.addBatch
|
|
|
|
topic: ->
|
|
|
|
doStuff()
|
|
|
|
@callback 2
|
|
|
|
'check things': (n) ->
|
|
|
|
assert.equal 2, n
|