Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug: Browser reporter suite unhide is broken (only unhides half the suites) #2893

Open
ScottFreeCode opened this issue Jun 20, 2017 · 1 comment
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

Comments

@ScottFreeCode
Copy link
Contributor

ScottFreeCode commented Jun 20, 2017

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 their className 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 the for loop: start at .length - 1 and decrement while >= 0 instead of starting at 0 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.

@ScottFreeCode ScottFreeCode added area: browser browser-specific type: bug a defect, confirmed by a maintainer confirmed status: accepting prs Mocha can use your help with this one! area: reporters involving a specific reporter labels Jun 20, 2017
@ScottFreeCode ScottFreeCode removed the status: accepting prs Mocha can use your help with this one! label Jul 5, 2017
@ScottFreeCode
Copy link
Contributor Author

This could probably be fixed with array methods now that Mocha 4 supports only newer environments? In any case, it's mostly waiting on #2900, which I need to be able to devote some undivided time to per #2947 (comment)

@ScottFreeCode ScottFreeCode changed the title browser reporter suite unhide is broken browser reporter suite unhide is broken (only unhides half the suites) Nov 19, 2017
@JoshuaKGoldberg JoshuaKGoldberg changed the title browser reporter suite unhide is broken (only unhides half the suites) 馃悰 Bug: Browser reporter suite unhide is broken (only unhides half the suites) Dec 27, 2023
@JoshuaKGoldberg JoshuaKGoldberg added the status: accepting prs Mocha can use your help with this one! label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants