OSDN Git Service

Regular updates
[twpd/master.git] / vows.md
1 ---
2 title: Vows
3 category: JavaScript libraries
4 ---
5
6   * [Vowsjs.org](http://vowsjs.org/)
7
8 ### CoffeeScript usage
9
10     vows = require "vows"
11     assert = require "assert"
12
13     vows
14       .describe('My tests')
15       .addBatch
16         'context':
17           topic: ->
18             100
19           'should work': (number) ->
20             assert.equal number, 100
21
22       .export(module)
23
24 ### Running
25
26     vows test/*-test.* --spec
27
28 ### Assertions
29
30     assert.equal a, b
31     assert.notEqual a, b
32     assert.strictEqual a, b
33
34     assert.isNaN(number)
35     assert.instanceOf(object, klass)
36     assert.isUndefined(object)
37     assert.isFunction(func)
38     assert.isNull(object)
39     assert.isNotZero(object)
40     assert.isObject(object)
41     assert.isString(object)
42
43 ### Async
44
45     .addBatch
46       topic: ->
47         doStuff()
48         @callback 2
49       'check things': (n) ->
50         assert.equal 2, n