Home / Companies / Cypress / Blog / Post Details
Content Deep Dive

Experimental Fetch Polyfill

Blog post from Cypress

Post Details
Company
Date Published
Author
Gleb Bahmutov
Word Count
872
Company Posts That Month
8
Language
English
Hacker News Points
-
Post removed?
No
Summary

Gleb Bahmutov's tutorial explores how to test an application that loads a random list of fruits using Ajax, focusing on challenges such as handling random data and testing loading indicators. The text demonstrates how to use Cypress, a testing framework, to stub the `window.fetch` method with the help of Sinon.js and Bluebird.js to simulate different server response scenarios, such as delayed responses and server errors, ensuring the application's loading behavior is correctly displayed. The tutorial also addresses limitations of stubbing `window.fetch` directly by using Cypress's built-in network control and experimental fetch polyfill, which makes Ajax requests visible to the Test Runner, enhancing test reliability. Bahmutov acknowledges the advice of Kent C. Dodds, who suggests mocking the server outside the application to avoid tying tests to implementation details, and highlights ongoing improvements in Cypress's network control capabilities to address these concerns.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Real-time 1 649 198 73 +5%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.