We use spyOn(this,"_new") to track a function call in jasmine. I need to check the children method call in jasmine. My code sample is given below,

Sample code:

function perform(option) {

My question is how to check the this.perform.sum(option.a+option.b) has been called with spyOn() in jasmine JavaScript?

I have tried the below way, but it was not worked as much I expected?

it("If we pass  arguments to the perform method, ensuring that the sum method has been called or not", function(done) {

    var option={a:10,b:6};



But above code has not worked. And also, I had posted an issue regarding this npm-jasmine:Issues. The Question details are given below:

how to check children method has been called in jasmine test cases

Can anybody tell me, how to check the children method call in jasmine using spyOn()?

  • Could you post the complete reproducible example? It's difficult to follow the this usage - do you have the test in the same file as the code under test?
    – alecxe
    Nov 15, 2017 at 14:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.