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

Allow relative path to custom reporter #2453

Closed
wants to merge 1 commit into from
Closed

Conversation

cletusw
Copy link

@cletusw cletusw commented Aug 23, 2016

Closes #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');
}
}

Copy link
Author

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

@cletusw
Copy link
Author

cletusw commented Aug 23, 2016

@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));
Copy link
Author

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');
}
}

Copy link
Author

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));
Copy link
Contributor

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?

@boneskull boneskull added the status: waiting for author waiting on response from OP - more information needed label Sep 17, 2016
@sul4bh
Copy link
Contributor

sul4bh commented Dec 30, 2016

@cletusw any progress on this? I am looking to use this feature. Need help with getting the PR through?

@cletusw
Copy link
Author

cletusw commented Jan 3, 2017

@sul4bh Yeah, I'll be unable to work on this for the foreseeable future. Feel free to take it from here!

@cletusw cletusw closed this Apr 20, 2017
@boneskull boneskull removed the status: waiting for author waiting on response from OP - more information needed label Dec 12, 2017
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

Successfully merging this pull request may close these issues.

3 participants