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)
- Images used in the training are not available HOT 1
- Standalone from a global config HOT 1
- Pipes documentation missing at https://angular.dev/api/common#pipes HOT 1
- activatedRoute.getAllParams() which includes all params from children
- An Angular.io page seems to be down HOT 6
- ERR_INVALID_URL thrown during prerendering ngSrc with priority attribute
- Tutorial assets unavailable HOT 1
- Access to options object in ControlValueAccessor's writeValue method HOT 1
- Signal in Service not working HOT 2
- Wrong Link
- Issue with code preview on Angular tutorial page (1-components-in-angular and 9-output) HOT 1
- 404 link -> https://angular.dev/guide/cheatsheet HOT 1
- Missing RouterCreateURL HOT 1
- contentChildren signal value changes before child components are initialised HOT 5
- Make built-in validator directives standalone
- Incomplete docs for NgComponentOutlet directive
- Invalid route for esbuild documentation link
- Animation transform scale not working correctly
- :leave animation in route child breaks route transition
- HTTP client - Test requests heads to wrong angular.dev link HOT 1
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.