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)
- Reactive forms form builder type issue HOT 10
- Angular compiler ignores tsconfig.json "references" field HOT 2
- Field value in component class updates but does not revert back HOT 1
- Route provider behaviour should align more with component providers (destroy them) HOT 1
- Chrome debugger hangs after hitting breakpoint HOT 7
- Module Federation Host to Remote Routing - inject error HOT 10
- defaultEncapsulation doesn't work HOT 1
- [docs] ViewChild examples aren't shown HOT 1
- Page broken after refresh HOT 3
- angular 17/18 read cookie in server side with ssr HOT 1
- UrlMatcher running twice when matching a url pattern HOT 5
- Class extends value undefined is not a constructor or null HOT 1
- devtools injector preview (inside components tab) displays invalid NgModule injector HOT 3
- Remove simple-server.js file under Zone.js package due to security issue HOT 3
- docs(update): Minor typo in V16 -> V17 migration guide
- Cannot find module 'webpack/lib/ParserHelpers' HOT 1
- Angular Universal Build Error: Module Parse Failed While Creating Server Bundle HOT 1
- Allow late instrumentation of `globalThis.fetch` HOT 3
- Canonical: consequences of macrotask scheduling
- Memory leak via TRACKED_LVIEWS with SSR HOT 13
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.