From 20685c99416f93f54e7ed6cd93913e3fad621566 Mon Sep 17 00:00:00 2001
From: Thomas Goyne <tg@realm.io>
Date: Thu, 31 Aug 2017 15:28:37 -0700
Subject: [PATCH] Improve error reporting on test failures a little

---
 tests/js/user-tests.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/js/user-tests.js b/tests/js/user-tests.js
index 4d2a24ab..d8b95708 100644
--- a/tests/js/user-tests.js
+++ b/tests/js/user-tests.js
@@ -67,7 +67,7 @@ function assertIsAuthError(error, code, type) {
 
 function failOnError(error) {
   if (error) {
-    throw new Error(`Error ${error} was not expected`);
+    throw new Error(`Unexpected error in test: ${error}\n${error.stack}`);
   }
 }
 
@@ -89,7 +89,7 @@ function callbackTest(requestFunc, callback) {
 }
 
 module.exports = {
-  
+
   testLogout() {
     var username = uuid();
     return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', username, 'password', callback), (error, user) => {
@@ -132,7 +132,7 @@ module.exports = {
         TestCase.assertUndefined(user);
       });
     });
-  }, 
+  },
 
   testRegisterMissingUsername() {
     return new Promise((resolve, _reject) => {
@@ -301,7 +301,7 @@ module.exports = {
       if (!isNodeProcess) {
         resolve();
       }
-      
+
       if (!global.testAdminUserInfo) {
         reject("Test requires an admin user");
       }