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

Wrong error message when a reporter blows up trying to load another module #1952

Closed
nfriedly opened this issue Oct 30, 2015 · 2 comments
Closed
Labels
stale this has been inactive for a while...

Comments

@nfriedly
Copy link

I was trying to use the xunit-file reporter in conjunction with gulp-mocha, and that reporter blows up with the error "Error: Cannot find module 'mocha'"

However, because mocha just checks for the string 'Cannot find module' it incorrectly logs that the reporter wasn't found and makes things take a bit longer to debug.

@nfriedly
Copy link
Author

nfriedly commented Nov 2, 2015

You might consider running require.resolve() first - it will either return a string or throw, but if it throws the "Cannot find module...", then you know it's due to the exact thing you're trying to require not existing.

Although, I think the better solution is probably to not have any custom logic here at all. Treat all errors equally, including 'cannot find module'.

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

stale bot commented Oct 17, 2017

I am a bot that watches issues for inactivity.
This issue hasn't had any recent activity, and I'm labeling it stale. In 14 days, if there are no further comments or activity, I will close this issue.
Thanks for contributing to Mocha!

@stale stale bot added the stale this has been inactive for a while... label Oct 17, 2017
@boneskull boneskull removed the type: bug a defect, confirmed by a maintainer label Oct 18, 2017
@stale stale bot removed the stale this has been inactive for a while... label Oct 18, 2017
@boneskull boneskull added the stale this has been inactive for a while... label Oct 18, 2017
@stale stale bot closed this as completed Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale this has been inactive for a while...
Projects
None yet
Development

No branches or pull requests

3 participants