Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

In topics vows should not catch ReferenceError #202

Merged
merged 1 commit into from Sep 18, 2012

Conversation

Projects
None yet
5 participants
Contributor

Filirom1 commented Mar 30, 2012

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');
      setTimeout(function(){
        self.callback(new Error('Ahhh this error is unvisible'));
      }, 100);
    },
    'Then this test must fail': function(err, data){
      assert.ifError(err);
    }
  }
}).export(module);

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 

node.js:201
        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 Sep 18, 2012

@cloudhead cloudhead added a commit that referenced this pull request Sep 18, 2012

@cloudhead cloudhead Merge pull request #202 from Filirom1/master
In topics vows should not catch ReferenceError
808a773

@cloudhead cloudhead merged commit 808a773 into vowsjs:master Sep 18, 2012

Contributor

adamstallard commented Jan 23, 2013

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