简体   繁体   中英

How to inspect a function with console.log in karma tests

As an example, I am trying to debug this (pseudocode):

spyOn(form, 'append').and.callThrough();
baseRecord.$fillForm(form, params, '[namespace]');
console.log(JSON.stringify(form.append));
expect(form.append.argsForCall).toEqual(...);

karma gives me:

LOG: function () { ... }

with no information about the content of the function.

Check Stack Overflow first, like this for example: Existing Answer Link

And to answer your question,

console.log(functionName.toString());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM