Artem Zakharchenko
@kettanaito.com
3.9K followers 200 following 3.5K posts
Software engineer. Helping you master automated testing at http://EpicWeb.dev. Author mswjs.io. Instructor egghead.io. I tell stories @zakarcher.com. My debut book "LOGGERHEADS" it out 👇 https://zakarcher.com/books/loggerheads
Posts Media Videos Starter Packs
Pinned
kettanaito.com
Huge news! I've written a book.

This is a story of light and dark that won't leave you indifferent. Illustrated, atmospheric, and meaningful. The kind that stays with you.

Please enjoy this cover reveal for Loggerheads:
zakarcher.com/blog/cover-...

📚💙
Cover reveal: Loggerheads
zakarcher.com
kettanaito.com
I could really use some test runner feature where it would run the same test on `main` and let me inspect both that and my feature branch live.

I really don't want to stash all my changes, go to main, run there, go back, unstash, run again, compare the diff in my head.
kettanaito.com
I am always using Proxy to spy over methods so I'd love for a .reverse() method to undo that spy. I know that's outside of the proxy's responsibility, but it appears odd to me as I've never seen anyone use proxies like

let p = new Proxy(o)

only

o = new Proxy(o)

Might be a me thing.
kettanaito.com
I am two days deep into the new architecture for MSW and it's looking pretty good. That is how the library was always meant to work. Migrating the existing APIs to release this without breaking changes.
kettanaito.com
Need to get it together and propose a revocable Proxy to the committee because Proxy.revocable() does not do what you think it does.

It does not revoke. It nukes the proxy. It starts throwing. Quite odd!
kettanaito.com
Got a type testing question: why do these two examples produce two different type errors?

I'd like to assert the *first* error (about the symbol mismatch). I'm getting something else though once I use type expect.
kettanaito.com
No big spoilers, but MSW 3.0 will be about controlling the network. Not requests or events. The network. Such a beautiful, layering change.
kettanaito.com
Just wish those weren't people authoring 10m+ downloads packages.
kettanaito.com
I freaking love automated tests. I can do crazy changes, full rewrites sometimes, and I've got these little fellows giving me rock-solid confidence I'm not breaking consumers (or tell me how exactly I'm breaking them). Love that.
kettanaito.com
I will never, ever understand some maintainer's hardcore commitment to CJS-only in 2025.

- Made-up module syntax.
- Doesn't work without a bundler.
- Thoroughly archaic and weird.
- Huge pain in the ass for other OSS maintainers.

Do not get it.
kettanaito.com
You know you are 10 layers deep into the abstraction when you reach out for a whiteboard. Cannot hold that all in my head anymore.
kettanaito.com
There's a certain music album that I either bought by accident or Apple forced on everyone at some point in time. I still don't know how to delete it. No, "delete" doesn't delete it. It just hides it. I don't think I will ever be able to delete it for good.
kettanaito.com
Thanks for the rec!
What I need is something quite more complex 😅 I need to make two processes talk to each other and exchange network. Also, exchange handler intentions, too. Thought I could use some RPC tools out there, but it looks like I need to build the serialization layer anyway.
kettanaito.com
So what Capn Web sees in new Response() is a complex object with methods it knows nothing about. Unless you wrap it in a custom RpcTransport, it will throw since you cannot do

JSON.stringify(new Response('hello world'))
kettanaito.com
You're thinking of them as what they represent but Capn Web doesn't support sending complex objects at all. You have to wrap them in RpcTransport and describe what they do in a serializable (i.e. JSON.stringify-friendly) manner. That's a huge bummer.
kettanaito.com
The answer is always yes.
kettanaito.com
So it seems we're back at square one. Building a simple custom protocol for request/response serialization + handler instructions on top. I really hoped I could cheat my way out of doing that 😅
kettanaito.com
- Doesn't support custom serialization/deserialization logic;
- Cannot stream data. Serializes the entire batch into a string, then sends it over the wire (if using the HTTP transport). We'd love to stream request/response bodies though!
kettanaito.com
Tried Cap'n Web to see if we can use it for cross-process network interception in MSW. It's a great lib but doesn't seem like it's going to work for our use case.

- Cannot serialize requests/responses;
- Cannot transfer complex objects at all (have to be wrapped in RpcTransport)
kettanaito.com
So it looks like I can use an RPC library but I still have to implement serialization/deserialization of the network primitives myself. That's not entire bad since the RPC part is handled, but I was expecting this to automagically work.
kettanaito.com
Me: tries to use RPC for sending responses cross-process.
RPC:

TypeError: Cannot serialize value: [object Response]

😬

I've looked into most of the suggestions I received and haven't found any logic that serializes requests/responses in the source code.
kettanaito.com
TIL about `es-toolkit`, which is an ESM-first, type-safe utility library. Think modern lodash. Interesting!

es-toolkit.dev/
kettanaito.com
You got this! Even a few words a day already gets you far. When I first started writing, I was putting out 100-200 words a night but tried my best to stay consistent. It was hard. There were nights I wrote nothing. That's also okay. Just keep going.