# HG changeset patch # User RĂ©mi Cardona # Date 1432218004 -7200 # Node ID f5ec46a6867a89028987c4e67959de8a2e1a793e # Parent 7628a14d220952282b08bf1f557977d83b163d95 [devtools] qunit: show helpful data when an assertion fails Related to #5533333. diff -r 7628a14d2209 -r f5ec46a6867a devtools/qunit.py --- a/devtools/qunit.py Wed May 20 17:25:40 2015 +0200 +++ b/devtools/qunit.py Thu May 21 16:20:04 2015 +0200 @@ -212,7 +212,15 @@ def handle_log(self): result = self._cw.form['result'] message = self._cw.form.get('message', '') - self._log_stack.append('%s: %s' % (result, message)) + actual = self._cw.form.get('actual') + expected = self._cw.form.get('expected') + source = self._cw.form.get('source') + log = '%s: %s' % (result, message) + if result == 'false' and actual is not None and expected is not None: + log += ' (got: %s, expected: %s)' % (actual, expected) + if source is not None: + log += '\n' + source + self._log_stack.append(log) class QUnitView(View): @@ -276,6 +284,9 @@ url: BASE_URL + 'qunit_result', data: {"event": "log", "result": details.result, + "actual": details.actual, + "expected": details.expected, + "source": details.source, "message": details.message}, async: false}); });''')