🐛 Bug: Browser reporter suite unhide is broken (only unhides half the suites) #2893
Labels
area: browser
browser-specific
area: reporters
involving a specific reporter
status: accepting prs
Mocha can use your help with this one!
type: bug
a defect, confirmed by a maintainer
Found out exactly what's going on in #2754: the HTMLCollection returned by
document.getElementsByClassName
, at least in some browsers, actually drops elements that get theirclassName
changed such that they no longer match the criteria on which the collection was based; thus, Mocha will only unhide the first half of the hidden suites or every other one of them.#2754 attempted to fix this by converting the collection to an array. Currently Mocha runs in some pretty old environments. If we have a shim for the array
slice
method we should use that rather than assuming the native[].slice
. If we don't have such a shim, we should simply reverse thefor
loop: start at.length - 1
and decrement while>= 0
instead of starting at0
and incrementing while< .length
.(We should also get a test for the unhiding of more than one suite. I will incorporate this into my work on testing the HTML reporter and mark it as
.skip
until a fix can also be PR'd.)I'd like to thank @ZeroBinbin for bringing this to our attention, and apologize for taking so long to get around to digging into it.
The text was updated successfully, but these errors were encountered: