Loading...
「ツール」は右上に移動しました。
利用したサーバー: natural-voltaic-titanium
81いいね 3412回再生

How to mock an npm package with Vitest/Jest

Mocking an npm package / module in Vitest can be a tricky thing. The mock function works in such a way that it can easily confuse you and get you stuck, especially when you want part of your test cases to use the mocked version of it, but the other part the original. In this video I'll show you how you can achieve that.

--

🤝 Become a friend of the channel! Start your membership today and get extra benefits: youtube.com/channel/UCTexaJMnN_Pv6TVueQ61-oQ/join
💬 A bunch of us are hanging out at discord.creatures.sh/. Join us!
🐦 Find me on the bird app: twitter.com/NikolovLazar
🎥 What I use for coding and making videos: nikolovlazar.com/uses

--

Chapters:
00:00 - Intro
00:39 - The problem
01:20 - The reason
01:53 - What you think might be the solution
03:11 - Solution #1
04:07 - Solution #2
09:21 - R

コメント