Files
cheatsheets/vows.md
Rico Sta. Cruz 511de900ba Formatting updates (#2133)
- Update some sheets which have very long sections
- Remove `layout: 2017/sheet` (everything has the same layout now)
- Remove outdated sheets
2024-04-03 18:30:24 +11:00

896 B

title, category
title category
Vows JavaScript libraries

About vows

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