From 5b1990bd18c50fad1aa96e4b8a93eb319dbd8646 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 30 Oct 2012 09:15:25 +0100 Subject: [PATCH] [IMP] make failure of rpc cleanup fail the owning test bzr revid: xmo@openerp.com-20121030081525-i611as22kjlhcex5 --- addons/web/static/src/js/testing.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js index 983c8650e31..32a3624eb93 100644 --- a/addons/web/static/src/js/testing.js +++ b/addons/web/static/src/js/testing.js @@ -299,20 +299,29 @@ openerp.testing = {}; + "number of assertions they expect"); } } - return $.when(result).fail(function (error) { - if (options.fail_on_rejection === false) { - return; - } - ok(false, typeof error === 'object' && error.message - ? error.message - : JSON.stringify([].slice.call(arguments))); - }) + return $.when(result); }).pipe(function () { return opts.teardown(instance, $fixture, mock); }, function () { return opts.teardown(instance, $fixture, mock); }).always(function () { start(); + }).fail(function (error) { + if (options.fail_on_rejection === false) { + return; + } + var message; + if (typeof error !== 'object' + || typeof error.message !== 'string') { + message = JSON.stringify([].slice.apply(arguments)); + } else { + message = error.message; + if (error.data && error.data.debug) { + message += '\n\n' + error.data.debug; + } + } + + ok(false, message); }); }); };