diff --git a/CHANGELOG b/CHANGELOG index dd42f09..ac6289a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add line numbers to failures when unit testing in Firefox. Closes #9231. [John Resig] + * Fix Function#argumentNames for Opera and IE. [Thomas Fuchs] * Add Object.isString, Object.isNumber, and Object.isUndefined, and clean up the source to make use of Object.isXXX where possible. [sam] diff --git a/test/lib/unittest.js b/test/lib/unittest.js index 73883ae..da849e1 100644 --- a/test/lib/unittest.js +++ b/test/lib/unittest.js @@ -277,7 +277,15 @@ Test.Unit.Assertions.prototype = { }, fail: function(message) { this.failures++; - this.messages.push("Failure: " + message); + + var line = ""; + try { + throw new Error("stack"); + } catch(e){ + line = (/\.html:(\d+)/.exec(e.stack || '') || ['',''])[1]; + } + + this.messages.push("Failure: " + message + (line ? " Line #" + line : "")); }, info: function(message) { this.messages.push("Info: " + message);