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

HTML Reporter does not report all errors #361

Closed
lightsofapollo opened this issue Apr 2, 2012 · 7 comments
Closed

HTML Reporter does not report all errors #361

lightsofapollo opened this issue Apr 2, 2012 · 7 comments

Comments

@lightsofapollo
Copy link
Contributor

First off, thanks for Mocha, I have been using it over jasmine for my node projects for awhile now.
I just started to need it for a major new project that lives in the client side and I noticed that the HTML reporter does not seem to be reporting all of the errors.

For example when referencing a variable that does not exist, etc...
After digging into it I found that these errors are actually thrown but are not marked as "uncaught" see: https://github.com/visionmedia/mocha/blob/master/lib/reporters/html.js#L81

Might suggest a deeper problem.

I was testing in Safari 5.1.4 and Firefox Aurora (latest).

I will try to dig into it and submit a pull request...

@tj
Copy link
Contributor

tj commented Apr 2, 2012

let me know if you find something i can reproduce and i'll check it out too, seems ok

@lightsofapollo
Copy link
Contributor Author

You can reproduce it with this (off master btw):

describe("Foo", function(){
  describe("fooz", function(){
    beforeEach(function(){
      //this should not be a function.
      Amzoo.call();
    });

    it("should die", function(){
    });
  });

  it("should work", function(){

  });

});

You will see in node reporters (spec, list, etc..) you will see a Reference error about Amzoo in the HTML reporter you will not see an error.

When I looked into it it seems like the error is not marked uncaught when thrown from the beforeEach hook.

The other reports don't seem to handle this logic the same way essentially they just output an error on .fail (or save each occurrence of an error for later).

@lightsofapollo
Copy link
Contributor Author

I should note the issue only effects errors caused in hooks (before, beforeEach, after, afterEach)

@kevindente
Copy link

I'm seeing the same issue. It appears that the function assigned to window.onerror is never invoked.

@tj
Copy link
Contributor

tj commented Apr 4, 2012

reproduced, thanks @lightsofapollo, I'll take a look in a bit

@tj tj closed this as completed in 701c538 Apr 4, 2012
@tj
Copy link
Contributor

tj commented Apr 4, 2012

we just were not displaying the hook errors, that should be fine

@lightsofapollo
Copy link
Contributor Author

Nice thanks, that is a much simpler fix then what I was thinking.

jfirebaugh added a commit to jfirebaugh/konacha that referenced this issue Apr 24, 2012
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

3 participants