pocesar / grunt-mocha-istanbul

Almost config-free Istanbul code coverage reporter for Mocha usage in Grunt
MIT License
75 stars 23 forks source link

Using mochaOptions returns error #24

Closed bvedam closed 9 years ago

bvedam commented 9 years ago

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.

pocesar commented 9 years ago

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)

bvedam commented 9 years ago

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.