Testing Error Paths
Test failures and edge inputs deliberately, assert the error type and message, and stop the happy path from hiding bugs.
Focused explanations and longer guides, with worked scenarios, common mistakes and interview exercises across every chapter.
Showing 241–264 of 825 articles
Test failures and edge inputs deliberately, assert the error type and message, and stop the happy path from hiding bugs.
Separate fast isolated unit tests from integration tests that use real dependencies, and find the balance that catches real bugs.
Run tests in parallel without interfering by removing shared state, isolating resources, and randomizing order.
Write a failing test first, make it pass minimally, then refactor under green, and understand why the order matters.
Keep snapshots small and intentional, review every diff, and stop large snapshots from becoming rubber-stamped assertions.
Build valid test objects with defaults and override only what a test cares about, to keep tests readable and robust.
Share behavior with abstract classes, enforce required members, and decide when an interface or composition is the better contract.
Write .d.ts files for JavaScript packages, declare modules, and expose types with the package.json types field.
Compare enums with unions of string literals: runtime cost, serialization, exhaustiveness and which one fits application code.
Give type parameters defaults to make them optional, and order them so inference still works without explicit arguments.
Model keyed collections with index signatures, type the value side, and avoid the loose any that hides real type errors.
Rename mapped-type keys with an as clause, filter keys by mapping to never, and build getter and prefixed types generically.
Turn on strict checks, know which flags strict bundles, and layer the non-strict extras such as noUncheckedIndexedAccess.
Compose string types with template literals, interpolate unions to generate combinations, and understand how they stay type-level only.
Use polymorphic this return types for builders, keep chaining correct through subclasses, and constrain this parameters.
Fix Angular NG8002 Can't bind to 'ngModel' since it isn't a known property of 'input': import FormsModule, then fix formControl and inputs.
Fix 'blocked by CORS policy' errors when Angular ng serve calls a backend: proxy.conf.json, angular.json wiring and production CORS setup.
Fix Angular NG0100 ExpressionChangedAfterItHasBeenCheckedError: why the dev-mode check fires, and data-flow fixes that beat setTimeout.
Fix Angular NG8001 'app-x' is not a known element: standalone imports, selector typos, NgModule exports, schemas and TestBed setup.
Fix Angular NullInjectorError: No provider for X! (NG0201): read the injector path, add provideHttpClient(), providedIn root or a token.
Why a Docker container exits immediately: check the exit code, read docker logs, open a shell and fix a command that only starts a background job.
Fix 'exec format error' in Docker: confirm the CPU architecture mismatch with uname and docker inspect, then rebuild with the right --platform or buildx target.
Fix Docker 'no space left on device' during build or pull: measure with docker system df, prune in a safe order, and cap logs and build cache.
Fix 'permission denied while trying to connect to the Docker daemon socket': docker group, re-login, rootless mode, contexts and a dead daemon.
No notes match that… try another filter.