jeudi 22 décembre 2016

Log and inspect objects and arrays with Karma and Jasmine and Angular 2

I am trying to run tests in Angular 2, and would like to log some of the stuff to the console so I can see what it actually is. Looking through blogs and documentation show me I should do things like: fixture = TestBed.createComponent(TestComponent); component = fixture.debugElement.children[0].componentInstance; elm = fixture.nativeElement;

but what does that even mean? I would like to be able to log 'fixture' and inspect it but I only get [object Object]. when I use console.dir() it shows me that it's an object or array with a dropdown arrow, but clicking the arrow doesn't do anything. I used the debugger to see what I needed but logging is just easier for what I'm trying to do. Any help is greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire