Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


In topics vows should not catch ReferenceError #202

merged 1 commit into from

5 participants


This test should fail :

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

vows.describe('A vows test').addBatch({
  'When doing something': {
    topic: function(){
      var self = this;
      anUndefinedObject.log('will throw an exception here');
        self.callback(new Error('Ahhh this error is unvisible'));
      }, 100);
    'Then this test must fail': function(err, data){

But it passed

$ vows test/myTest.js --spec

  ♢ A vows test 

  When doing something
    ✓ Then this test must fail

✓ OK » 1 honored (0.002s) 

Now, the error if thrown

$ vows test/myTest.js --spec

  ♢ A vows test 

        throw e; // process.nextTick error, or 'error' event on first tick
ReferenceError: anUndefinedObject is not defined
    at Object.<anonymous> (/home/romain/test-vows/test/myTest.js:9:11)
    at run (/home/romain/vows/lib/vows/suite.js:134:35)
    at EventEmitter.<anonymous> (/home/romain/vows/lib/vows/suite.js:234:40)
    at EventEmitter.<anonymous> (events.js:88:20)
    at EventEmitter.emit (/home/romain/vows/lib/vows.js:236:24)
    at Array.0 (/home/romain/vows/lib/vows/suite.js:169:45)
    at EventEmitter._tickCallback (node.js:192:40)

Is there any chance that this pull request will be merged? I just spent a fair amount of time tracking an issue with seemingly non-executing topic... The root cause was indeed in my code but the fact that vows was "swallowing" the ReferenceError did not help at all.

@JerrySievert JerrySievert was assigned
@cloudhead cloudhead merged commit 808a773 into from

I think rethrowing just ReferenceErrors is the wrong approach. Any type of error should be either sent to the first parameter of the vow or counted as an errored test in the reporter (depending on the settings).

See pull request #263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2012
  1. @Filirom1

    Do not catch ReferenceError

    Filirom1 authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/vows/suite.js
1  lib/vows/suite.js
@@ -134,6 +134,7 @@ this.Suite.prototype = new(function () {
topic = topic.apply(ctx.env, ctx.topics);
catch (ex) {
+ if(/ReferenceError/.test(ex)) throw ex;
topic = ex;
Something went wrong with that request. Please try again.