惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
Recorded Future
Recorded Future
T
Threatpost
P
Privacy International News Feed
Engineering at Meta
Engineering at Meta
F
Full Disclosure
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
博客园 - 叶小钗
T
Tor Project blog
G
Google Developers Blog
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
C
CERT Recently Published Vulnerability Notes
V
Visual Studio Blog
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
Jina AI
Jina AI
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
The Blog of Author Tim Ferriss
小众软件
小众软件
L
LINUX DO - 热门话题
Scott Helme
Scott Helme
博客园 - 司徒正美
P
Proofpoint News Feed
Security Latest
Security Latest
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Spread Privacy
Spread Privacy
Project Zero
Project Zero
L
Lohrmann on Cybersecurity
J
Java Code Geeks
Vercel News
Vercel News
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 三生石上(FineUI控件)
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

Kent C. Dodds Blog

Implementing Hybrid Semantic + Lexical Search Simplifying Containers with Cloudflare Sandboxes Migrating to Workspaces and Nx Offloading FFmpeg with Cloudflare Building Semantic Search on my Content Helping YOU ask ME questions with AI How I used Cursor to Migrate Frameworks The Dow's Start on the Covenant Path 2025 in Review The next chapter: EpicAI.pro AI is taking your job How I increased my visibility Launching Epic Web 2023 in Review Stop Being a Junior RSC with Dan Abramov and Joe Savona Live Stream Fixing a Memory Leak in a Production Node.js App 2022 in Review My Car Accident I Migrated from a Postgres Cluster to Distributed SQLite with LiteFS I'm building EpicWeb.dev A review of my time at Remix Remix: The Yang to React's Yin How I help you build better websites Why I Love Remix The State Initializer Pattern How to React ⚛️ Get a catch block error message with TypeScript Building an awesome image loading experience How Remix makes CSS clashes predictable Introducing the new kentcdodds.com How I built a modern website in 2021 How to use React Context effectively Static vs Unit vs Integration vs E2E Testing for Frontend Apps The Testing Trophy and Testing Classifications Array reduce vs chaining vs for loop Don't Solve Problems, Eliminate Them Super Simple Start to Remix Super Simple Start to ESModules in Node.js JavaScript Pass By Value Function Parameters How to write a Constrained Identity Function (CIF) in TypeScript How to optimize your context value How to write a React Component in TypeScript TypeScript Function Syntaxes Listify a JavaScript Array Build vs Buy: Component Libraries edition Using fetch with TypeScript Wrapping React.useState with TypeScript Define function overload types with TypeScript 2020 in Review Business and Engineering alignment Hi, thanks for reaching out to me 👋 useEffect vs useLayoutEffect Super simple start to Firebase functions Super simple start to Netlify functions Super Simple Start to css variables Favor Progress Over Pride in Open Source Testing Implementation Details How getting into Open Source has been awesome for me useState lazy initialization and function updates Use ternaries rather than && in JSX Application State Management with React Use react-error-boundary to handle errors in React JavaScript to Know for React How I structure Express apps What open source project should I contribute to? When I follow TDD AHA Programming 💡 How I Record Educational Videos Stop mocking fetch Intentional Career Building Improve test error messages of your abstractions Tracing user interactions with React Eliminate an entire category of bugs with a few simple tools Common mistakes with React Testing Library Super Simple Start to React Stop using client-side route redirects The State Reducer Pattern with React Hooks Function forms Replace axios with a simple custom fetch wrapper How to test custom React hooks React Production Performance Monitoring Should I useState or useReducer? Stop using isLoading booleans Make Your Test Fail Make your own DevTools An Argument for Automation Fix the "not wrapped in act(...)" warning Super Simple Start to ESModules in the Browser Implementing a simple state machine library in JavaScript 2010s Decade in Review Why users care about how you write code Why I avoid nesting closures Don't call a React function component Why your team needs TestingJavaScript.com Inversion of Control Understanding React's key prop How to Enable React Concurrent Mode How to add testing to an existing project Profile a React App for Performance
Should I write a test or fix a bug?
2020-06-15 · via Kent C. Dodds Blog

Automated tests are no different from any other software we write. They play on the same playing field of priorities as anything else. You have features to spec out, designs to make, bugs to fix, requirements gathering meetings to have, feature flags to configure, etc. etc. etc. To be able to prioritize these activities, you need to know the cost of doing nothing and the benefit of getting it done. And when it comes to prioritizing, you're not saying you "won't" do something, you're just saying you'll do one thing first. So it can also help to know the relative cost/benefit of doing it later vs the cost/benefit of doing it now.

Let's take a few different scenarios.

  1. A bug prevents the user from changing their bio if they don't have an avatar first.
  2. Your product checkout flow is not covered by tests.

For the bug, the cost is an unreliable UI for the handful of users who don't have their avatar uploaded out but want to change their bio. Not a great experience.

For the checkout flow, that's pretty serious. Any change to the code that touches that flow could break the checkout flow (potentially costing real money for the seller and valuable time for the buyer).

I think for that, let's prioritize adding a test first, and then fix the bug.

Ok, another scenario.

  1. You're a startup and you haven't actually started selling your product yet because it's not quite feature complete enough to be useful. You're running out of money.
  2. You just wrote a small function to calculate the distance your scrollable list needs to scroll as the user presses the ArrowDown key and you're trying to decide whether to test it.

For goodness sakes! Skip the test, get your product shipped and sell that thing! Your money is burning away 🔥💵🔥

That said, you might find that your demos to potential clients aren't going well because your engineers constantly ship broken code. In that case, write one or two quick and simple E2E tests for the common flows your demos take and run that before you merge any code.

Let's try one last scenario. Just for kicks.

  1. You just finished implementing a new feature allowing the user to create a playlist of their favorite songs. You're wondering whether to add tests.
  2. You saw an amazing font and editor theme in a live stream from your favorite dev and you want to ask them what it is so you can try it out.

😐

What I'm trying to get across in this post is that testing is no different from any other thing you can do with your time. Consider the costs and benefits, and act accordingly. Keep in mind that tests are the gift that keeps giving.

Good luck!