To check if your JavaScript test is running Karma, verify that window.__karma__ exists: function isKarma() { return typeof window === 'object' && typeof window.__karma__ === 'object'; }