Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it doesn't catch and display errors that occur asynchronously #121

Closed
petejkim opened this issue Dec 8, 2011 · 4 comments
Closed

it doesn't catch and display errors that occur asynchronously #121

petejkim opened this issue Dec 8, 2011 · 4 comments

Comments

@petejkim
Copy link

petejkim commented Dec 8, 2011

describe('test', function() {
  it('is a test', function(done) {
    process.nextTick(function() {
      'a'.should.equal('b');
      done();
    });
  });
});

expected output

  0) test is a test:
     AssertionError: expected 'a' to equal 'b'

actual output

  0) test is a test:
     Error: timeout of 2000ms exceeded
@petejkim
Copy link
Author

petejkim commented Dec 8, 2011

At the moment, I am getting around the problem by moving the asynchronous callback to the before-block and making assertions in the following it-blocks. For example (please excuse the coffeescript) :

describe 'GET /', ->
  res = null; body = null

  before (done) ->
    get '/', (_res, _body) ->
      res = _res; body = _body
      done()

  it 'returns Hello World', ->
    res.should.have.status 200
    body.should.equal 'Hello World'

@tj
Copy link
Contributor

tj commented Dec 8, 2011

let me take a look

@tj
Copy link
Contributor

tj commented Dec 8, 2011

confirmed that i have the same

@tj tj closed this as completed in 0d9a888 Dec 8, 2011
@tj
Copy link
Contributor

tj commented Dec 8, 2011

forgot about this :D haha. thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants