Mock Service Worker 🇺🇦

1.7K posts

Mock Service Worker 🇺🇦 banner
Mock Service Worker 🇺🇦

Mock Service Worker 🇺🇦

@ApiMocking

Industry standard API mocking for JavaScript.

Katılım Haziran 2020
8 Takip Edilen6.8K Takipçiler
Sabitlenmiş Tweet
Mock Service Worker 🇺🇦
Mock Service Worker 🇺🇦@ApiMocking·
The biggest change. The brightest change. Available for everyone to use. Migrate today and enjoy standard-driven API mocking!
Artem Zakharchenko@kettanaito

🎉 Announcing MSW 2.0! 🎉 🌎 Migration guidelines: mswjs.io/docs/migration… 📰 Release notes: github.com/mswjs/msw/rele… 365+ days in development, 200+ commits, 40+ contributors involved. The future of API mocking is here, and it has never been brighter.

English
3
13
88
31K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
Enjoy this introduction into E2E testing from my latest workshop "React End-to-End Testing with Playwright"! 🎉 Let's talk about what E2E testing is, how it has nothing to do with the browser, and what is its true goal.
English
2
5
44
9.9K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
More and more people are asking me about testing resources so let's put everything I've written in one post. Bookmark, share, and, most importantly, please read these. The True Purpose of Testing epicweb.dev/the-true-purpo… Developers often overlook the fundamentals and rush into writing tests without properly understanding what a test is and what is its function. No test is inherently useful just because it exists. Read this one to learn what makes it useful. The Golden Rule of Assertions epicweb.dev/the-golden-rul… There's a lot of debate over what makes a good test. In this one, I'm defining a short and objective way to grade a test's quality no matter the language or the tested system. This is, without a tinge of exaggeration, a game-changer in how you approach your tests. Anatomy of a Test epicweb.dev/anatomy-of-a-t… Let's talk about the building blocks that make up any automated test. From JavaScript to Go and Rust—these blocks power tests everywhere. Know your blocks. Implicit Assertions epicweb.dev/implicit-asser… Did you know there's a way to express expectations in tests without writing "expect"? Those are called implicit assertions and they are tremendously powerful because they help you express more by writing less. Inverse Assertions epicweb.dev/inverse-assert… Sometimes you need to assert that something did not happen. That can be tricky, especially if that something is asynchronous. The last thing you want are false positives. What you actually want is inverse assertions. Making Use of Code Coverage epicweb.dev/making-use-of-… Code coverage has been an ongoing debate in the engineering circles. Is 100% code coverage in tests good? Bad? When should you strive for it? Why do people say it's harmful? I'm answering all those questions in this one and giving you practical tips on when to use (and not to use) code coverage. Good Code, Testable Code. epicweb.dev/good-code-test… You've gathered by now that some code is easier to test than the other. But why? Let's take a look at the characteristic of code's testability, what defines it, what is its relationship with complexity, and how to make your code more testable. What is a Test Boundary? epicweb.dev/what-is-a-test… Automated tests rarely involve your entire system (yes, even the end-to-end ones have exceptions). There's often a place where you draw the line. The boundary. Learn what it is and how to use test boundaries efficiently to focus on the exact behaviors you want to test. Be S.M.A.R.T. About Flaky Tests epicweb.dev/be-smart-about… Flakiness is the scourge of reliability. If you've written a test before, you likely had experience with flakiness. But what is it at its core and what causes it? And how should you deal with flakiness? Writing Tests That Fail epicweb.dev/writing-tests-… You write tests for them to fail. We all enjoy a green CI, but the true value of tests is when they fail. What matters is when and how they fail.
Artem Zakharchenko tweet media
English
4
46
375
42.8K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
I'm excited to announce "React End-to-end Testing with Playwright"! 🎉 Complete your testing journey by learning how to use Playwright to test your entire app. I'm talking full browser automation, user journeys, auth, search, test setup, debugging tips... Here's what's inside 👇
Artem Zakharchenko tweet media
English
7
14
96
17.7K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
📦 msw@2.14.4 introduces a new API called "finalize" for scheduling cleanups after the request handler is finished. This is your go-to choice for managing side effect cleanup in your mocks.
Artem Zakharchenko tweet media
English
2
2
52
5.4K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
It's undocumented, but I released an "onUpgrade" callback to handle connection upgrades from HTTP to WebSocket for matching handlers. This is only relevant for Node.js and custom environments.
Artem Zakharchenko tweet media
English
0
2
12
2.6K
Mock Service Worker 🇺🇦 retweetledi
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
I built Data as the means to do data-first API mocking, but it turned out that all you need is schema seeding and ORM-like querying, which are general purpose. Could you give it a try? Experiment, try breaking it, that kind of stuff. Thanks! github.com/mswjs/data
English
4
6
76
7.3K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
🧑‍🔬 JSON Server vs MSW. These two solutions might look similar, but the way they approach the same problem cannot be more different. Here's why.
Artem Zakharchenko tweet media
English
5
1
41
6.6K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
@jarredsumner Hi, Jarred 👋 I think it's time we made MSW work in Bun. I'm working on the new architecture right now that might actually make that possible. Would you be interested in sponsoring my work and bring first-class API mocking to all Bun users?
English
2
2
60
7.5K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
💡 Fun fact: Nock uses MSW's interception algorithm under the hood! I've created it as a standalone library anyone can use to build their own MSW and it warms my heart to see Nock adopt it for powerful and unified interception for everyone. kettanaito.com/blog/mocking-i…
English
1
2
24
1.2K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
🧑‍🔬 Nock vs Mock Service Worker. Here's a detailed comparison between the two API mocking libraries to help you understand them better. Enjoy.
Artem Zakharchenko tweet media
English
4
10
132
14.7K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
If you're building anything AI-related, you should be using @ApiMocking for testing and then sponsoring the project. Just saying 😊
English
0
1
12
1.5K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
Super excited to announce that @coderabbitai is joining MSW partners to help make the future of API mocking on the web more sustainable. Huge thank you! 🎉
Artem Zakharchenko tweet media
English
3
8
34
6.3K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
Would you pay a small one-time fee to download hand-crafted agent skills for MSW? Best practices, common mistakes, getting the most out of your mocks. This kind of stuff.
English
1
1
0
1.4K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
If you like MSW and would like to help make it more sustainable, please consider nominating it at endowment.dev/funding/ Share a short feedback about how it improved your development life. Costs you nothing. Might be a game-changer for its future. Thank you ❤️
English
2
5
16
4.6K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
Every time I talk to a team that doesn't use mswjs.io:
GIF
English
0
1
7
1.4K
Mock Service Worker 🇺🇦 retweetledi
React Prague
React Prague@react_prague·
Ever needed to handle API mocking? Our final speaker, @kettanaito, is the creator of @ApiMocking. He'll be joining us to talk about how the library became a standard for modern development. We're just 2 days away! Grab one of the last spots! See you there💛
React Prague tweet media
English
1
2
5
1.1K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
MSW has nearly doubled in downloads since last year. Huge.
Artem Zakharchenko tweet media
English
2
1
27
1.5K
Mock Service Worker 🇺🇦 retweetledi
Artem Zakharchenko
Artem Zakharchenko@kettanaito·
I genuinely want to understand developers that struggle with MSW. If you are one, please share your feedback! I've worked so hard to make it the best API mocking solution on the web. It's years ahead of the "competition", promotes web standards, has the richest feature set you can find. But there are still developers who struggle with it, apparently. I want to turn those struggles into features I can add and bugs I can fix. But I need to know them first! In Node.js, using MSW is no different than using any other solution you're familiar with. Some of them literally use MSW under the hood, providing a different flavor of UX. That part is subjective and I'm fine if some prefer other APIs to what MSW offers. As long as you're using the interception algorithm that doesn't diminish the value of your tests. In the browser, the only inconvenience I can think of is having to register a Service Worker. I get it, it's an extra step, not everybody is familiar with what that is and why that's needed. I used to wish to get rid of this step, but I find it both educational and secure. There is no better way to intercept the network in the browser than a Service Worker. And that means learning a bit about them and keeping your worker yours. Please share the things you struggled with in MSW, if any. I'd be grateful.
English
3
2
8
1.2K
Mock Service Worker 🇺🇦 retweetledi
Santosh Yadav
Santosh Yadav@SantoshYadavDev·
The last part of my sponsorship budget goes to @ApiMocking, happy to support work by @kettanaito always a big fan of his work.
Santosh Yadav tweet media
English
0
1
6
1.8K