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

Testacular prevents error messages from being logged in browser console #368

Closed
mpj opened this issue Feb 26, 2013 · 2 comments · Fixed by #372
Closed

Testacular prevents error messages from being logged in browser console #368

mpj opened this issue Feb 26, 2013 · 2 comments · Fixed by #372

Comments

@mpj
Copy link

mpj commented Feb 26, 2013

In my testacular.conf.js, I'm loading a test-runner.js, which in turn requires my tests using a custom-made require function. This works fine, but if test-runner.js or any of the tests it loads through require has a syntax error, that error does ONLY show up in the Testacular command line tool, not the browser. I'd like it to show up in the browser in addition to the command line, just like errors that occur after the tests start runnung.

The reason I need this is because I want source maps to work (the require does some stuff that messes up the line numbers). If the error is handled by the browser, it will be able to use the source map and produce a correct line number, which Testacular does not.

@dignifiedquire
Copy link
Member

We could change this behavior so that these errors get printed in the browser too, but in the meantime you should be able to work around this if you don't throw the error but use console.error which gets logged to the browser.

@vojtajina
Copy link
Contributor

You can work around it as well, by overriding the window.onerror handler:

window.onerror = function(msg, url, line) {
  window.__testacular__.error(msg, url, line);
  return false;
};

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

Successfully merging a pull request may close this issue.

3 participants