webdriverio/query-selector-shadow-dom

Unreachable code path can be reached

mariusandra opened this issue · 1 comments

Hey, after upgrading to version 0.8.0 of this library we started getting errors in our code. I traced it back to this commit:

86fe168

Because collectAllElementsDeep is also exported, it can be called with various parameters. I was calling collectAllElementsDeep("", document) to get and cache all the elements, since I'm calling querySelectorAllDeep a lot of times later on.

Changing this to collectAllElementsDeep("*", document) solved the issue.

Not sure if there's anything to change, but just thought I'd let you know that the unreachable code path is very reachable since the component is exported. It's probably not an issue for new users since they'll see the error directly if they try passing in an empty string.

Sorry for the delay in reply, sorry about the breakage! I've now put the check back in and added a test case :)