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

allowUncaught is not working as expected #2106

Closed
yonida opened this issue Feb 14, 2016 · 3 comments
Closed

allowUncaught is not working as expected #2106

yonida opened this issue Feb 14, 2016 · 3 comments
Labels
type: bug a defect, confirmed by a maintainer

Comments

@yonida
Copy link

yonida commented Feb 14, 2016

In my code there are cases where I might get some errors, which I'm fine with.
I looked around and found the allowUncaught flag to prevent uncaught errors to fail my tests.
Problem is, I don't really understand what this flag does, because the tests keep failing.

process.on = function(e, fn){
        if ('uncaughtException' == e) {
      global.onerror = function(err, url, line){
      fn(new Error(err + ' (' + url + ':' + line + ')'));
      return !mocha.allowUncaught;
    };
    uncaughtExceptionHandlers.push(fn);
  }
};

As you can see in the code, there is no way to block the fn callback in cause of uncaughtException.

If this flag is not intended for this use case, please add some proper documentation for it.

@lolmaus
Copy link

lolmaus commented Mar 25, 2016

mocha.allowUncaught is designed to prevent mocha from catching exceptions, letting them fall through into the console for further inspection.

It does not prevent exceptions from breaking your tests.

@doublerebel
Copy link

@yonida I and others have the same issue, check out the solutions in #1985

@drazisil drazisil added type: bug a defect, confirmed by a maintainer duplicate labels Mar 30, 2017
@drazisil
Copy link

Being handled under #1985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants