Testing javascript inside IIFE
问题 My team leader wants me to wrap my js code inside an IIFE immediatly-invoked function expression. I can't figure out how to spyOn in my jasmine spec file. How would I spyOn the follow: (function(){ function_1(){...} function_2(){...} }); spyOn(window,'function_1') doesn't work. Passing window into the IIFE doesn't work. Trying both (x=function()... and (function x() ... then spyOn(x,'function_1') doesn't work either. I couldn't find anything on-line about this. 回答1: @user29998, if you can