Questions tagged [vows]

Asynchronous behaviour driven development for Node.

Asynchronous tests are first class citizens in vows:

// connection-test.js

var vows = require('vows'),
    assert = require('assert');

// Create a Test Suite
vows.describe('connection api').addBatch({
    'when connecting': {
        topic: function () {
            var self = this;
            socket.connect(/* ... */);
            socket.on('connect', function(){
                self.callback(this);
            });
        },
        'a bidirectional channel is open': function (socket) {
            assert.isNotNull(socket);
            socket.send('hello');
        }
    }
}).run(); // Run it

Run the tests:

vows test/connection-test.js --spec

See http://vowsjs.org for documentation and examples.

62 questions
1
vote
1 answer

Webapp testing with Vows and Tobi

I'm completely new to node.js testing, maybe you can help me out: I want to do some more or less simple tests for my express webapp using vows and tobi (for example testing if the login route works) var vows = require('vows'); var assert =…
toxinlabs
  • 942
  • 1
  • 10
  • 14
1
vote
2 answers

Vows: command not found

I ran my tests from the root folder of my app. The tests lay within the spec directory. $ vows No command 'vows' found, did you mean: Command 'vos' from package 'openafs-client' (universe) Command 'voms' from package 'voms-server'…
Sunil
  • 3,424
  • 2
  • 24
  • 25
1
vote
1 answer

Vows: Testing Asynchronous Interleaving

Is there a methodology to test (potential) interleaving of asynchronous functions with vows? For example: // Topic portion var user = new User('jacob') user.set('email,'foo@bar.com') user.save() // a user.set('email',derp@cherp.com') user.save() //…
Koobz
  • 6,928
  • 6
  • 41
  • 53
1
vote
1 answer

mocha: can't use one request for mutlple `it` test

const request = require('supertest'); const server = request('http://localhost:9001'); describe('Get /static/component-list.json', function() { const api = server.get('/static/component-list.json'); it('should response a json',…
tjfdfs
  • 729
  • 10
  • 26
1
vote
1 answer

server.close() doesn't work in a Vow teardown

I'm trying to write some Vows-based tests for my run-of-the-mill Express app. Here's the test source: var vows = require('vows'); var assert = require('assert'); var startApp = require('./lib/start-app.js'); var suite =…
strugee
  • 2,752
  • 4
  • 19
  • 30
1
vote
0 answers

TDD of Sailsjs Waterline Models with Vowsjs

My problem is trying to do TDD of Waterline models. The tests I present are just boilerplate to get my suite constructed. Nevertheless, they raise valid issues. The primary problem is that I require the model in the Vows.js test. In the test scope…
RedMage
  • 1,126
  • 1
  • 9
  • 21
1
vote
0 answers

Adding batches asynchronously to a Vows suite

I've got some code like this. The idea is that I'm reading fixture data from files and using the data from each file to add a batch: // test.js var vows = require('vows') , async = require('async') , suite; exports.suite = suite =…
Dmitry Minkovsky
  • 36,185
  • 26
  • 116
  • 160
1
vote
0 answers

Collection Testing with Vows.js

I am trying to run unit tests against every item in a collection using Vows.js and I'm having a heck of a time getting it to work. Here is what I have at the moment. 'the variations objects': { topic: function() { var promise =…
arb
  • 7,753
  • 7
  • 31
  • 66
1
vote
1 answer

Asynchronous Topic Scope Vows.JS

I'm having trouble passing parent topic values to children topic values. The code is asynchronous and I think that is where I'm having the problem. I want a part of the JSON response to be the topic of the tests underneath. Here is the relevant…
arb
  • 7,753
  • 7
  • 31
  • 66
1
vote
1 answer

Cannot find module eyes

I have installed vows using 'npm install vows' and made sure that i have 'eyes' but running 'npm install eyes' in the terminal. I have checked that there a eyes folder in the node_modules folder in the local user. But when i run some test using…
testerteaser
  • 411
  • 1
  • 5
  • 7
0
votes
2 answers

Node.js response undefined when connected using http client

I am new to node.js and began by creating a small web app which runs at port 5000. When i tried this url which runs in my local(either via the browser or via curl), everything works fine, and i get back the response. But when i tried connecting it…
Sunil
  • 3,424
  • 2
  • 24
  • 25
0
votes
3 answers

Testing Closure Compiler output under Node.js

I'd like to use Vows to test DOM-free JavaScript code, ideally directly running against the compiled JS. My Vows are written in CoffeeScript, but I'm not sure how to load my JS; I've tried just inlining it using eval: vows = require "vows" assert =…
Kevin L.
  • 1,663
  • 1
  • 16
  • 21
0
votes
1 answer

Tiny server/client setup - server doesn't respond. All code provided

I'm teaching myself Coffeescript/node and, of course, the only way to do this is with TDD. That means I'm also teaching myself vows. There are, I think, at least two problems. One is -- where does the asynchronous code to get the HTTP response lie?…
Trevoke
  • 4,115
  • 1
  • 27
  • 48
0
votes
1 answer

Vows.js: Accessing parameters returned from outer topics inside inner topics

I was wondering if there is any way to obtain the return value of an outer topic, from within a test of an inner topic. If that was confusing, here's an example: "build.css" : { topic : function(file) { fs.readFile(fixtures +…
Matt
  • 22,224
  • 25
  • 80
  • 116
0
votes
1 answer

Output data from Vows test

I have a test file like below: // Dependencies var Vows = require("vows") , Request = require("request") , Assert = require("assert") , MyLib = require("../../lib/") ; // Globals var sServer = new MyLib({ root: __dirname +…
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474