Upgrade to MSW 2.0#1809
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| db.projects.push(newProject) | ||
|
|
||
| return json(newProject, { status: 201 }) | ||
| return HttpResponse.json(newProject, { status: 201 }) |
There was a problem hiding this comment.
I wouldn’t say no to cutting this diff down by doing const json = HttpResponse.json
There was a problem hiding this comment.
Took a big of finagling but I got it to work. Diff is definitely smaller now.
|
For historical context, @david-crespo and I spent all of yesterday trying to debug an issue where E2E tests were failing in safari due to this browser error We traced it down to a bug in a safari work around in MSW which was causing an empty array buffer to be passed to the I've worked around the issue in Also, note to our future selves: console logs and debug output for service workers on safari are shuttled off to a different devtools instance hidden in the developer menu. |
david-crespo
left a comment
There was a problem hiding this comment.
Awesome. The Firefox E2E failure is likely due to GH's current outages.
oxidecomputer/console@bd65b9d...ae8218d * [ae8218df](oxidecomputer/console@ae8218df) bump msw to 2.0.3 for the real safari fix * [9a3f95a9](oxidecomputer/console@9a3f95a9) reduce dev console noise about local assets not served by MSW * [a61ecf24](oxidecomputer/console@a61ecf24) oxidecomputer/console#1809 * [50f3a5b2](oxidecomputer/console@50f3a5b2) bump recharts and react query * [1a2b5656](oxidecomputer/console@1a2b5656) oxidecomputer/console#1808 * [4c01cd68](oxidecomputer/console@4c01cd68) oxidecomputer/console#1800 * [57cc1892](oxidecomputer/console@57cc1892) oxidecomputer/console#1802 * [47d76dbf](oxidecomputer/console@47d76dbf) oxidecomputer/console#1806 * [eee0eb2e](oxidecomputer/console@eee0eb2e) oxidecomputer/console#1805 * [60c2285e](oxidecomputer/console@60c2285e) oxidecomputer/console#1804 * [d9cf1ef1](oxidecomputer/console@d9cf1ef1) bump sort imports plugin for vuln * [ba3a383e](oxidecomputer/console@ba3a383e) bump playwright to 1.39 (fix issue with z-index test)
### User-facing fixes * [57cc1892](oxidecomputer/console@57cc1892) oxidecomputer/console#1802 * [47d76dbf](oxidecomputer/console@47d76dbf) oxidecomputer/console#1806 * [60c2285e](oxidecomputer/console@60c2285e) oxidecomputer/console#1804 ### Full summary oxidecomputer/console@bd65b9d...ae8218d * [ae8218df](oxidecomputer/console@ae8218df) bump msw to 2.0.3 for the real safari fix * [9a3f95a9](oxidecomputer/console@9a3f95a9) reduce dev console noise about local assets not served by MSW * [a61ecf24](oxidecomputer/console@a61ecf24) oxidecomputer/console#1809 * [50f3a5b2](oxidecomputer/console@50f3a5b2) bump recharts and react query * [1a2b5656](oxidecomputer/console@1a2b5656) oxidecomputer/console#1808 * [4c01cd68](oxidecomputer/console@4c01cd68) oxidecomputer/console#1800 * [57cc1892](oxidecomputer/console@57cc1892) oxidecomputer/console#1802 * [47d76dbf](oxidecomputer/console@47d76dbf) oxidecomputer/console#1806 * [eee0eb2e](oxidecomputer/console@eee0eb2e) oxidecomputer/console#1805 * [60c2285e](oxidecomputer/console@60c2285e) oxidecomputer/console#1804 * [d9cf1ef1](oxidecomputer/console@d9cf1ef1) bump sort imports plugin for vuln * [ba3a383e](oxidecomputer/console@ba3a383e) bump playwright to 1.39 (fix issue with z-index test)
The v1 to v2 migration guide can be found here.
This PR depends on oxidecomputer/oxide.ts#215
Most of the changes here are fairly mechanical like renaming the
restexport frommswtohttp. The biggest change is the removal of the compositionalreqAPI from MSW which was a pseudo request object with extra metadata associate with it and the ability to compose utility functions on top of it. It now uses the standardRequestobject which includes some immediate tradeoffs like not havingcookieshanging off of it. Cookies are now passed to the handler and have to be piped down through the rest of the call chain. Given the removal of the compositional API, utilities likedelayare now stand alone functions which necessitates actually being able to write async handlers. I've wrapped all the handlers intype-fest'sPromisable(T | Promise<T>) and we were actually already awaiting the results so no changes were needed there.Overall, not too bad. Just remember to use
HttpResponsefor normal responses. I've also included ajsonhelper export from the generated API to cut down on the diff as suggested.