Clarify how to test for errors in effects #55753
Labels
area: core
Issues related to the framework runtime
area: docs
Related to the documentation
area: testing
Issues related to Angular testing features, such as TestBed
core: reactivity
Work related to fine-grained reactivity in the core framework
cross-cutting: signals
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone
Describe the problem that you experienced
Given a component that has an effect that throws an error, it's not clear what is the correct way to write a unit test to test for that error. Please see the code below. This is a standard way to test that something throwing an error. However, this unit test does not pass saying that exception was not thrown. Notably, the expected thrown error is visible in the terminal.
I figured out a way to make test pass using custom
ErrorHandler
. However, that seems very hacky:Enter the URL of the topic with the problem
https://twitter.com/dmitryaefimenko/status/1788714569420173689
Describe what you were looking for in the documentation
Clear instructions on how to test for errors in effects
Describe the actions that led you to experience the problem
No response
Describe what you want to experience that would fix the problem
No response
Add a screenshot if that helps illustrate the problem
No response
If this problem caused an exception or error, please paste it here
No response
If the problem is browser-specific, please specify the device, OS, browser, and version
No response
Provide any additional information here in as much as detail as you can
No response
The text was updated successfully, but these errors were encountered: