diff --git a/test/javascripts/test_helper.js b/test/javascripts/test_helper.js
index 40855d3fd..49522e70b 100644
--- a/test/javascripts/test_helper.js
+++ b/test/javascripts/test_helper.js
@@ -83,7 +83,11 @@ window.assetPath = function() { return null; };
 
 var oldAjax = $.ajax;
 $.ajax = function() {
-  console.error("Discourse.Ajax called in test environment (" + arguments[0] + ")");
+  try {
+    this.undef();
+  } catch(e) {
+    console.error("Discourse.Ajax called in test environment (" + arguments[0] + ")\n caller: " + e.stack.split("\n").slice(2).join("\n"));
+  }
   return oldAjax.apply(this, arguments);
 };