Closed AmyAmy closed 8 years ago
Thanks - this is definitely a good idea! Will get right on it
It seems that ESDoc itself has issues (104, 83, 208) with logging and the developer is thankfully aware, however this means that unless there's a patch to ESDoc I can't really do anything to the output. This appears to also be an issue for gulp-esdoc too.
That said, I've come up with a solution that does accomplish what is needed, even if it probably is bad practice.
If I temporarily override console.log
to capture and parse the output from the call to esdoc.generate
(and then obviously return it to its original state) then it works as desired. Normally overriding a global, especially one like console.log
, is unequivocally bad behaviour but I think we're safe in Grunt because:
esdoc
task.grunt.fail.fatal
The output will now be determined by the following:
esdoc.generate
as before.grunt.log.ok
is used, if coverage is not complete then grunt.log.warn
is used.grunt-esdoc@0.0.3
includes the requested changes, note that this version also requires version 4 or greater of Node
Works like charm!
one tiny issue, my coverage is currently reported as Coverage: 17.89% (158/883) and the current regex doesn't account for non-integer coverage, I've made a pull-request with the fix.
There is a load of output, such as a complete list of generated files, which i only expect when the verbose flag is on.
Would it be possible to only output a simple "done" (and perhaps the coverage), and use grunt.verbose.writeln for the list of files?