Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k
stars
786
forks
source link
Crash when incomplete custom watermarks are used #358
As a result it is not possible to pass custom watermarks to reporters that simply want to override some of the defaults without causing a crash later in lib/report/common/defaults.classFor which does not check that watermarks[type] actually returns an array. There are also some places in other reporters that will suffer the same fate (getReportClass in html reporter at least).
Seems like it would be better to always use defaults.watermarks() and copy over the properties from this.opts.watermarks if it is set. Do you agree? If so I will patch and send a PR.
This pattern is used by all the reporters that use watermarks:
As a result it is not possible to pass custom watermarks to reporters that simply want to override some of the defaults without causing a crash later in
lib/report/common/defaults.classFor
which does not check thatwatermarks[type]
actually returns an array. There are also some places in other reporters that will suffer the same fate (getReportClass
in html reporter at least).Seems like it would be better to always use
defaults.watermarks()
and copy over the properties fromthis.opts.watermarks
if it is set. Do you agree? If so I will patch and send a PR.