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

Object type mocha options are removed by 'dargs' #155

Closed
agracio opened this issue Feb 22, 2017 · 5 comments
Closed

Object type mocha options are removed by 'dargs' #155

agracio opened this issue Feb 22, 2017 · 5 comments

Comments

@agracio
Copy link

agracio commented Feb 22, 2017

Hi,
Version 4.0.1 introduced a bug that causes any mocha options that are of object type to be removed from arguments.
Example gulp task:

gulp.task('coverage',  function() {
        return gulp.src(paths.test, {read: false})
            .pipe(mocha({
                'reporter': "mocha-jenkins-reporter",
                'reporterOptions': {
                    "junit_report_name": "Test",
                    "junit_report_path": "JUnit.xml",
                    "junit_report_stack": 1
                }
            }));
});

Initially the options in gulp-mocha are:

{ colors: true,
  suppress: false,
  reporter: 'mocha-jenkins-reporter',
  reporterOptions:
   { junit_report_name: 'ts-progress',
     junit_report_path: './coverage/JUnit.xml',
     junit_report_stack: 1 } }

However after converting options to arguments using dargs the output is:

[ '--colors', '--reporter=mocha-jenkins-reporter' ]
@agracio agracio changed the title object type mocha options are removed by 'dargs' Object type mocha options are removed by 'dargs' Feb 22, 2017
@sindresorhus
Copy link
Owner

Per release notes, it's now using the mocha binary. So you need to use whatever method the Mocha binary supports to pass reporter options. https://github.com/sindresorhus/gulp-mocha/releases/tag/v4.0.0

@agracio
Copy link
Author

agracio commented Feb 22, 2017

--reporter-options mocha flag requires additional parameters to be passed to it. Here is an example from Mocha page:

--reporter-options output=filename.xml

However I do not see how it would be possible to pass such parameters using new version, could you provide an example?

@sindresorhus
Copy link
Owner

{reporterOptions: 'output=filename.xml'}

@agracio
Copy link
Author

agracio commented Feb 22, 2017

This would become --reporter-options=output=filename.xml

@agracio
Copy link
Author

agracio commented Feb 23, 2017

Is there a planned resolution for this issue? It should not be closed as there is no workaround, so existing functionality is broken.

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