Перейти к содержимому

Migrating from Jest to Node.js Native Test Runner || Testing || Erick Wendel

Erick Wendel

0:00 / 0:00

Migrating from Jest to Node.js Native Test Runner || Testing || Erick Wendel

12 158 просмотров · 3 г. назад
Erick Wendel
169 тыс. подписчиков
12 158 просмотров · 3 г. назад
Are you looking for a native testing solution that's faster and more efficient than Jest? Then this video is for you! In this step-by-step guide, you'll learn how to migrate from Jest to Node.js native test runner. You'll walk through the process, from setting up your environment to running your tests, and I'll prove that Node.js test runner is faster and more reliable than Jest. By the end of this video, you'll have the knowledge and confidence to take advantage of the full power of Node.js native test runner and simplify your testing workflow. So let's dive in and take your testing game to the next level! Are you ready? Grab a drink and let's begin! #Jest #Nodejs #testing ✅ SOURCE CODE ▸ https://bit.ly/migrating-from-jest-to... ✅ Access My Premium Content ▸ Ebook on Recreating Node.js from Scratch: https://bit.ly/ebook-recreating-nodejs ▸ Mastering Node.js Streams: https://bit.ly/nodejs-streams-training ✅ REFERENCES ▸ Pull Request on Fake Timers: https://bit.ly/faketimers-pr-nodejs-ew ▸ Node.js v20: https://nodejs.org/en/blog/announceme... ✅ FOLLOW ME ▸ Linkedin:   / erickwendel   ▸ Blog: https://erickwendel.com.br/ ▸ Facebook: https://fb.com/page.erickwendel ▸ Medium:   / erickwendel   ▸ Twitter:   / erickwendel_   ▸ Telegram: https://bit.ly/canalerickwendel ✅ TIMELINE 00:00 - Subscribe now 00:50 - Free content about javascript 01:00 - What is Jest? 01:15 - About the new Node.js native Test Runner 01:33 - The Fake Timers Nojde.js native Test Runner feature 2:24 - The project in this class 02:44 - Node.js version used in the demonstration project 02:58 - Starting the project - initialize configurations 04:06 - 1 - Spies: basic configuration (Jest) 05:33 - Configure the test suite and create the run function 07:16 - Verify Items with expect 08:20 - 2 - Stubs: create basis structure (Jest) 08:48 - Create a Service class to get talks 09:37 - Prepare a graphQL query 11:56 - Create a graphQL request in the getTalks method 13:40- Remove the run function and call getTalks 15:38 - Create a mapResponse function to getTalks data 16:56 - Create the run function 18:18 - Mock the results with Jest 20:42 - Improve the mapResponse log 21:10 - Validate the data with expected 22:21 - Validade if Service was called just once 23:16 - Validade if Service was called with the right property 23:50 - Validate if the result is equal the expected result 24:14 - Using BeforeEach to restore mocks 25:22- Stub different values for API calls 28:42 - 3 - Understand how Fake Timers works 31:42 - Tips about paid and free Javascript content 32:32 - Migrate all the functions to de Node.js test runner 33:45 - Change the code of example 1 (Spies) to use the Node.js test runner 37:57 - Convert example 2 (Stubs) to Node.js test runner 42:40 - Mocking different values for every call 46:47 - How the example 3 (faker timers) could work in node.js 47:51 - Compare speed on both approaches (jest and node.js test runner) 48:55 - Final thoughts 49:32 - Blooper reels 50:20 - THANK YOU! #unittesting #javascript #erickwendel #howtounittest #stubs #mockingtechniques #faketimers #javascript #nodejs #webdevelopment #webapps #webtesting #js