navi icon indicating copy to clipboard operation
navi copied to clipboard

Crawl fails for non-redirect matchers (matcher is not a function)

Open kmkr opened this issue 5 years ago • 2 comments

crawl doesn't work on certain older browsers and throws TypeError: matcher is not a function.

The problem seems to be caused by the returned promise from createCrawlTuplesPromise that resolves to incorrect data types. The resolved value is expected to be an array where the items is a tuple containing one function and one object, but is rather one string and one object.

Here is an example where the promise resolves incorrectly (on Chromium v 65.0.3325). Notice the string type in the first item of the result, starting from index 13:

crawl-tuples-with-different-data-types

Here's an example where the promise resolves correctly (latest Chromium):

crawl-tuples-with-correct-data-types

Here is the result of the paths-variable within the createCrawlTuplesPromise. I suspect the problem is within this function.

createCrawlTuplesPromise-paths

redirect matchers are resolved correctly but withView and mount matchers do not. I've debugged and went through the code but I'm having a hard time understanding the data flow and generators. Any idea what may be the cause?

kmkr avatar Aug 12 '19 10:08 kmkr

Thanks for brining this up! What a bizarre bug.

Any chance you could quickly run Object.entries({}) in the version of chrome that this is failing on, and see if it works?

jamesknelson avatar Aug 14 '19 06:08 jamesknelson

Yes, of course. It seems to generate the expected result:

Chromium 65:

chrome-65

Chromium 75:

chrome-75

I also ran the code in our webapp with the same result. I did that to cover the case where some polyfill could be messing with Object.entries.

kmkr avatar Aug 14 '19 08:08 kmkr