Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9231 (reopened enhancement)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Add line numbers to Unit Test Failure ouput

Reported by: jeresig Assigned to: sam
Priority: normal Milestone: 2.x
Component: Prototype Version: edge
Severity: normal Keywords: mozilla opera test
Cc:

Description

In the results from unittest.js it's impossible to determine where a specific assertion failed (or even which assertion failed). This simple patch adds a line number to the failure output to help you to debug your contents further.

This patch was developed to be used in the test suite running in the Mozilla test suite (since there was a regression and we couldn't figure out where the error was coming from).

Attachments

line.patch (0.6 kB) - added by jeresig on 08/09/07 20:52:57.
Add Line Numbers to Failures
both.diff (0.6 kB) - added by fearphage on 08/13/07 09:08:56.
Line numbers from mozilla and opera

Change History

08/09/07 20:52:57 changed by jeresig

  • attachment line.patch added.

Add Line Numbers to Failures

08/09/07 21:48:18 changed by madrobby

  • status changed from new to closed.
  • resolution set to fixed.

(In [7298]) Add line numbers to failures when unit testing in Firefox. Closes #9231.

08/13/07 09:03:45 changed by fearphage

  • keywords changed from mozilla test to mozilla opera test.
  • status changed from closed to reopened.
  • resolution deleted.

This patch breaks with the nocache rake setting. The current code expects hrefs to end with ".html" instead of ".html?resultsURL=...". I've also added support for retreiving line numbers from Opera. I changed the way the error was thrown because throw new Error('stack') caused the stack trace to be lost in Opera.

08/13/07 09:08:56 changed by fearphage

  • attachment both.diff added.

Line numbers from mozilla and opera

08/13/07 20:07:52 changed by fearphage

This is less than useful in Opera as of now. I found out Opera reports line numbers of inline scripts relative to the start of the <script> tag. I filed a bug with Opera. #278053 if anyone is concerned.