pocesar/grunt-mocha-istanbul

Using mochaOptions returns error

Closed this issue · 2 comments

I ran mocha directly with '--reporter mocha-teamcity-reporter' and it works well.

I then tried using mochaOptions and run it from grunt but it throws the following error
error: unknown option `--reporter mocha-teamcity-reporter'

The code looks like this:
grunt.initConfig({
mocha_istanbul: {
coverage: {
src: 'test/spec', // a folder works nicely
options: {
mochaOptions: ['--reporter mocha-teamcity-reporter'],
reportFormats: ['html', 'teamcity']
---------- rest of the code ---------

Ran in verbose mode and console shows

Will execute: node /home/ad_bvedamur/mfn-validator/node_modules/istanbul/lib/cli.js cover --dir=/home/ad_bvedamur/mfn-validator/coverage --report=html --report=teamcity /home/ad_bvedamur/mfn-validator/node_modules/mocha/bin/mocha -- --reporter mocha-teamcity-reporter test/spec/*/_.js
error: unknown option `--reporter mocha-teamcity-reporter'

Appears to be a bug. Appreciate your response. Thanks.

try using

mochaOptions: ['--reporter','mocha-teamcity-reporter'],

see if it change something (tho you are using the teamcity reporter type twice in mocha and istanbul, not sure if they are needed)

Thank you very much. That worked. The istanbul teamcity report generates the coverage and summary but does not output teamcity test status for each test. That is the reason I am using the mocha options. Now I get the consolidated report with each test status, coverage and summary.