-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow relative path to custom reporter #2453
Conversation
throw new Error('reporter "' + program.reporter + '" does not exist'); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all appears to be unnecessary since 191b88c
@boneskull Please review. The nested try-catch approach was pretty gnarly, so I flattened it. |
// Try to load reporters from process.cwd() | ||
if (!_reporter) { | ||
try { | ||
_reporter = require(path.resolve(process.cwd(), reporter)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out process.cwd()
is unnecessary as a first argument. I'll push a fix.
Closes mochajs#2434 Previously, mocha --reporter=./path/to/custom-reporter.js would fail. Also removes code from _mocha that has been unnecessary since 191b88c
throw new Error('reporter "' + program.reporter + '" does not exist'); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all appears to be unnecessary since 191b88c
// Try to load reporters from process.cwd() | ||
if (!_reporter) { | ||
try { | ||
_reporter = require(path.resolve(reporter)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a problem if we're running in a browser. Why did this need to move out of _mocha
?
@cletusw any progress on this? I am looking to use this feature. Need help with getting the PR through? |
@sul4bh Yeah, I'll be unable to work on this for the foreseeable future. Feel free to take it from here! |
Closes #2434
Previously, mocha --reporter=./path/to/custom-reporter.js would fail.
Also removes code from _mocha that has been unnecessary since 191b88c