Vows is an asynchronous behavior-driven development (BDD) testing framework for Node.js.
Basic Usage
const vows = require('vows');
const assert = require('assert');
vows
.describe('Math operations')
.addBatch({
'when calculating numbers': {
topic: function () {
return 100;
},
'should equal 100': function (number) {
assert.equal(number, 100);
}
}
})
.export(module);
Running Tests
vows test/*-test.js --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);
Asynchronous Topics
.addBatch({
'when performing async tasks': {
topic: function () {
doAsyncWork(this.callback);
},
'should handle callback result': function (err, result) {
assert.isNull(err);
assert.equal(result, 42);
}
}
})