This is very confusing and assumes that hook was already called and variable has being set, could you maybe move all the assertions into the `onNewGlobalObject` hook, it would make it more obvious.