Comments (2)
Context:
angular/packages/core/src/render3/reactivity/effect.ts
Lines 175 to 182 in 28fb385
Effects do log their error to the error handler, so you're on correct path.
You could just spy the handleError
method for example:
test('should throw error', () => {
const fixture = TestBed.configureTestingModule({
imports: [MyComponent],
}).createComponent(MyComponent);
const errorHandler = TestBed.inject(ErrorHandler);
const spy = vi.spyOn(errorHandler, 'handleError');
fixture.detectChanges();
expect(spy).toBeCalledWith(new Error('foobar'));
});
https://stackblitz.com/edit/angular-vitest-starter-v18-ryiakv
from angular.
sounds good, thanks for the clarification. Do you think this should be mentioned somewhere in the docs?
from angular.
Related Issues (20)
- Unexpected tags (`@description`, `@syntax`) instead of headings in `@for` docs
- The inherited component cannot be fully destroyed. HOT 1
- error connection timeout HOT 1
- API abort error occurs specifically when rendering the page in Mozilla Firefox HOT 1
- The inherited component cannot be fully destroyed. HOT 2
- TypeError: Cannot set property 'nodeValue' of undefined HOT 1
- registerOnValidatorChange not called when bind in template form on the form element
- numberAttribute transform is not working when passing null HOT 3
- Support for Opening URLs in New Tab with State in Angular Router HOT 2
- UrlMatcher no longer receives the full url SegmentGroup after redirect HOT 2
- Improve misleading error message for control flow when HTML close tags are missing
- toSignal's runtime error message does not get tree shaken away in prod build
- Suggested fixes for first-app/14-http Step 3 Sample JSON HOT 1
- ErrorHandler stop working on Angular 18?
- Problem adding firebase HOT 1
- new Lifecycle hook ngOnServer HOT 1
- Support configuration of attachShadow when Custom Elements are created
- Deprecate "waitForAsync" in @angular/core/testing
- Use WebGL for testing in continuous integration HOT 1
- JIT compiler unavailable error with blank screen ( after updated from Angular 15.1.0 -> 16.2.14) HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.