You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MSW expects parentheses to be escaped in URLs but pretender does not. This prevents mirage-msw being a drop in replacement. Currently in my mirage setup I'm using a helper function to escape URL strings that contain parentheses if the test suite is running using mirage-msw. Migrating large number on mirage endpoint, small PR by small PR so need to support both MSW and pretender while migrating.
export default function mswEscapeUrl(stringUrl) {
if (ENV.useMsw) {
return stringUrl.replaceAll('(', '\\(').replaceAll(')', '\\)');
}
return stringUrl;
}
Here's the MSW test and mock showing this behaviour
The text was updated successfully, but these errors were encountered:
I guess this in an incompatibility between path matching in MSW using path-to-regexp and supporting regex URL matching and pretender using route-recognizer and not supporting regex.
mrloop
changed the title
Parathesis in request URL handled differently between pretender and MSW
Parentheses in request URL handled differently between pretender and MSW
Dec 20, 2023
MSW expects parentheses to be escaped in URLs but pretender does not. This prevents
mirage-msw
being a drop in replacement. Currently in my mirage setup I'm using a helper function to escape URL strings that contain parentheses if the test suite is running usingmirage-msw
. Migrating large number on mirage endpoint, small PR by small PR so need to support both MSW and pretender while migrating.Here's the MSW test and mock showing this behaviour
The text was updated successfully, but these errors were encountered: