Fix instanceof bug between execution contexts
First encountered at jest-playwright repo: https://github.com/mmarkelov/jest-playwright/issues/38 Solution based on: https://stackoverflow.com/questions/4339288/typeof-for-regexp#comment4724685_4339350
This commit is contained in:
parent
e65897844f
commit
3382c56c06
|
|
@ -222,7 +222,7 @@ export function urlMatches(urlString: string, match: types.URLMatch | undefined)
|
||||||
return true;
|
return true;
|
||||||
if (helper.isString(match))
|
if (helper.isString(match))
|
||||||
match = helper.globToRegex(match);
|
match = helper.globToRegex(match);
|
||||||
if (match instanceof RegExp)
|
if (match instanceof RegExp || match.constructor.name === "RegExp")
|
||||||
return match.test(urlString);
|
return match.test(urlString);
|
||||||
if (typeof match === 'string' && match === urlString)
|
if (typeof match === 'string' && match === urlString)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue