-
Notifications
You must be signed in to change notification settings - Fork 5.1k
feat: toHaveURLPattern #38925
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: toHaveURLPattern #38925
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| const url = parseURL(urlString); | ||
| if (!url) | ||
| return false; | ||
| if (isURLPattern(match)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also update protocol to support url patterns on the server side? See RouteHandler.prepareInterceptionPatterns for the reference.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| private _initScripts: InitScript[] = []; | ||
| private _requestInterceptor: RouteHandler; | ||
| private _interceptionUrlMatchers: (string | RegExp)[] = []; | ||
| private _interceptionUrlMatchers: (string | RegExp | URLPattern | undefined)[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just URLMatch[]?
| private _clockPaused = false; | ||
| private _requestInterceptor: RouteHandler; | ||
| private _interceptionUrlMatchers: (string | RegExp)[] = []; | ||
| private _interceptionUrlMatchers: (string | RegExp | URLPattern | undefined)[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just URLMatch[]?
| // eslint-disable-next-line no-restricted-globals | ||
| export const isURLPattern = (v: unknown): v is URLPattern => typeof globalThis.URLPattern === 'function' && v instanceof globalThis.URLPattern; | ||
|
|
||
| export function serializeURLPattern(v: URLPattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's instead export serializeURLMatch() and handle all cases right here.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"5 failed 5 flaky34237 passed, 668 skipped Merge workflow run. |
Test results for "MCP"5 failed 3597 passed, 129 skipped Merge workflow run. |
Closes #38666