TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

MSW 2.0 – Mock Service Worker

188 点作者 milkers超过 1 年前

8 条评论

dcre超过 1 年前
At my job we&#x27;ve found working with MSW + OpenAPI to be near miraculous. I work on a web frontend and do most of my development against a mock API powered by MSW. This live preview runs against the mock API running fully in-browser.<p><a href="https:&#x2F;&#x2F;oxide-console-preview.vercel.app" rel="nofollow noreferrer">https:&#x2F;&#x2F;oxide-console-preview.vercel.app</a><p>More details:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;oxidecomputer&#x2F;oxide.ts">https:&#x2F;&#x2F;github.com&#x2F;oxidecomputer&#x2F;oxide.ts</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;oxidecomputer&#x2F;console">https:&#x2F;&#x2F;github.com&#x2F;oxidecomputer&#x2F;console</a><p><a href="https:&#x2F;&#x2F;oxide.computer&#x2F;podcasts&#x2F;oxide-and-friends&#x2F;1426644" rel="nofollow noreferrer">https:&#x2F;&#x2F;oxide.computer&#x2F;podcasts&#x2F;oxide-and-friends&#x2F;1426644</a><p>Really excited about this next step for MSW — we&#x27;ll be upgrading soon. Building on web standards buys you so much.<p>(Reposted at top level because the parent got flagged.)
评论 #37993403 未加载
评论 #37991961 未加载
评论 #37991785 未加载
评论 #37989240 未加载
评论 #37989100 未加载
candylifter超过 1 年前
Nice to see more and more tools adopting standard Fetch API Request&#x2F;Response interfaces.
评论 #37989024 未加载
scottlamb超过 1 年前
How do folks test timing-related stuff with MSW? AFAIK, MSW doesn&#x27;t get along with jest.useFakeTimers. It drives me nuts; I have a bunch of disabled tests in an open-source project and at least one that is flaky because it uses real timers where I&#x27;d like to be using fake timers. [1, 2]<p>I&#x27;ve been thinking about ripping out MSW from my tests in favor of my own API-level mock for this reason. But it seems like many other folks are happy with MSW. I have to assume there&#x27;s something I&#x27;m not getting. I&#x27;m a fish out of water with frontend stuff in general...<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;scottlamb&#x2F;moonfire-nvr&#x2F;blob&#x2F;5ea5d27908f1a3e84daacebcc518a6961220b3de&#x2F;ui&#x2F;src&#x2F;Login.test.tsx#L36">https:&#x2F;&#x2F;github.com&#x2F;scottlamb&#x2F;moonfire-nvr&#x2F;blob&#x2F;5ea5d27908f1a...</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;scottlamb&#x2F;moonfire-nvr&#x2F;blob&#x2F;5ea5d27908f1a3e84daacebcc518a6961220b3de&#x2F;ui&#x2F;src&#x2F;List&#x2F;VideoList.test.tsx#L133">https:&#x2F;&#x2F;github.com&#x2F;scottlamb&#x2F;moonfire-nvr&#x2F;blob&#x2F;5ea5d27908f1a...</a>
IggleSniggle超过 1 年前
Super excited to see this land. I&#x27;ve been following this closely and experimenting with the beta branch; the ability to swap out real network requests with mocked ones <i>in process</i> is a huge upgrade for any kind of work you might have wanted to do with a proxy.<p>Congrats on the release!
danwee超过 1 年前
Off-topic: I think I&#x27;ve seen this page layout before <a href="https:&#x2F;&#x2F;mswjs.io&#x2F;docs" rel="nofollow noreferrer">https:&#x2F;&#x2F;mswjs.io&#x2F;docs</a> . Did they use a css-html template&#x2F;framework for it?
评论 #37989004 未加载
milkglass超过 1 年前
Why does the site need us to allow ads? On the getting started page I see this:<p>&quot;Please enable ads on this website. Thank you.&quot;
评论 #37990142 未加载
评论 #37989067 未加载
orthecreedence超过 1 年前
For a second I thought it was Magic Seaweed 2. RIP.
评论 #37990464 未加载
ok123456超过 1 年前
What is the benefit of using MSW over mocking a service with a small express server?
评论 #37989225 未加载
评论 #37988809 未加载
评论 #37994911 未加载
评论 #37994047 未加载
评论 #37993939 未加载