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
159
votes
32 answers

Command not found after npm install in zsh

I'm having some problems installing vows via npm in zsh. Here's what I get. I tried installing it with and without the -g option. Do you have any idea what's wrong here? [❤ ~/Desktop/sauce-node-demo:master] npm install -g vows npm http GET…
optikfluffel
  • 2,538
  • 4
  • 20
  • 27
48
votes
6 answers

How do you mock MySQL (without an ORM) in Node.js?

I'm using Node.js with felixge's node-mysql client. I am not using an ORM. I'm testing with Vows and want to be able to mock my database, possibly using Sinon. Since I don't really have a DAL per se (aside from node-mysql), I'm not really sure how…
Josh Smith
  • 14,674
  • 18
  • 72
  • 118
11
votes
1 answer

V8 lazy generation of stack traces seems to cause an infinite loop in the vows library

I spent some time debugging a strange infinite loop problem in a NodeJS testsuite. It only happens under rare conditions but I can reproduce it when I attach to the chrome debugger. I think it has to do with V8's handling of stack traces in…
Philipp Claßen
  • 41,306
  • 31
  • 146
  • 239
10
votes
2 answers

Should I switch from Vows to Mocha?

I'm trying to decide whether to switch from Vows to Mocha for a large Node app. I've enjoyed almost all of the Vows experience - but there is just something strange about the argument passing. I always have to scratch my head to remember how topics…
Joe Parry
  • 241
  • 2
  • 7
10
votes
1 answer

What is the correct way to launch your server from vows for testing?

I have an express server which I am testing using vows. I want to run the server from within the vows test suite, so that I dont need to have it running in the background in order for the test suite to work, then I can just create a cake task which…
cjroebuck
  • 2,273
  • 4
  • 30
  • 46
8
votes
3 answers

Node.js testing RESTful API (vows.js?)

I could really do with some advice on testing a RESTful api I created in node.js. There are a plethora of frameworks out there and I am at a loss. My testing knowledge isn't good enough generally which is why I am trying to write these tests. I've…
henry.oswald
  • 5,304
  • 13
  • 51
  • 73
8
votes
3 answers

How to run cleanup with vows.js?

I'm using Vows.js to test some node.js which is creating records in a database. As a result of this it creates some test records in the database. I'd like to remove these records once the tests have run. Is there a way to run a cleanup function when…
tooba
  • 551
  • 5
  • 22
8
votes
1 answer

Namespaces in node.js with require

I am playing around and learning about vows with a personal project. This is a small client side library, with testing done in vows. Therefore, I must build and test a file that is written like this: (function(exports) { var module =…
Miles McCrocklin
  • 920
  • 2
  • 9
  • 12
7
votes
2 answers

Testing MongooseJs Validations

Does anyone know how to test Mongoose Validations? Example, I have the following Schema (as an example): var UserAccount = new Schema({ user_name : { type: String, required: true, lowercase: true, trim: true, index: { unique: true },…
Donn Felker
  • 9,553
  • 7
  • 48
  • 66
4
votes
1 answer

Is this the correct way to do Dependency Injection in Node?

I recently started a node project and as a Test-Driven Developer, I quickly ran into a dependency injection problem with my brand new module. Here's how I figured out I should do dependency injection. It's important to note I'm using vows as BDD…
4
votes
2 answers

Querying DOM of a Backbone.js app with Zombie.js

Just trying out Zombie.js for the first time today, and I'm having trouble visiting a page that populates DOM elements via javascript (specifically, a Backbone.js app). As a quick example, I visited the Backbone.js Todo app and manually added a few…
Christopher DuBois
  • 42,350
  • 23
  • 71
  • 93
4
votes
0 answers

How to debug test in vows nodejs?

How to debug vows test? I was thinking to make an html reporter for the tests and run tests in the browser, but I really don't know how and where to start. If there are better workarounds I'm happy to hear, thanks ;) code from my reporter this.print…
Totty.js
  • 15,563
  • 31
  • 103
  • 175
4
votes
1 answer

How to solve "callback not fired" with Vows and Node.js

I'm trying to get started with Vows and Vows-BDD. Unfortunately, the callbacks are tripping me up. In the very simple example below, how does one fix this error? ** Inside the first context ** Creating Person with name Nick ✗ Errored » callback not…
nickh
  • 4,721
  • 2
  • 29
  • 31
3
votes
1 answer

BDD Testing framework for Express.js

Here is what i need: Must be able to run test in Jenkins I want to test API, so I don't really care about functions and objects, I just want to make sure that when I send POST to /api/users.json, I will see that user in json array from GET…
Andoriyu
  • 212
  • 7
  • 17
3
votes
2 answers

Error in writing asynchronous Vows.js Tests

I have been working with node and using vows to write tests. var vows = require('vows'); var assert = require('assert'); var boardData = require('../lib/data/BoardData.js'); vows.describe('Loading provinces and Boundries for').addBatch({ …
Ra is dead
  • 569
  • 2
  • 18
1
2 3 4 5