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

mocha.opts --reporter-options issue #20

Closed
cristian-smocot opened this issue Jun 30, 2015 · 3 comments
Closed

mocha.opts --reporter-options issue #20

cristian-smocot opened this issue Jun 30, 2015 · 3 comments

Comments

@cristian-smocot
Copy link

I'm using a mocha.opts file for ease-of-use config of the CLI arguments that are passed to mocha.

I have discovered that, if for example I have a mocha.opts file like the following:

--reporter mochawesome --reporter-options reportDir=mocha-reports,reportName=ViewReport,reportTitle=Mocha Tests

it will fail because of the space in reportTitle=Mocha Tests.

reportTitle=MochaTests or reportTitle=Mocha-Tests works correctly.

It would be nice to be able to use spaces in the report title, reportName, reportDirparameters of the reporter.

@adamgruber
Copy link
Owner

It's not currently possible to include spaces and this is due to how mocha parses the arguments.

See https://github.com/mochajs/mocha/blob/master/bin/options.js#L25.

I could include a hack inside Mochawesome but the better solution is to file an issue with mocha or submit a pull request to them. I would think the right way to include spaces in the arguments would be to escape them like this: --reporter-options reportTitle=title\ with\ spaces and then the regex that mocha uses for parsing can be updated to respect escaped spaces.

@adamgruber
Copy link
Owner

I submitted a pull request to mocha that would allow you to pass an option with a space in it as long as the space is escaped. mochajs/mocha#1774

@adamgruber
Copy link
Owner

Closing this issue as mocha 2.3.0 is now out and includes the pull request.

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

No branches or pull requests

2 participants