@@ -31,9 +31,11 @@ exports.info = "Browser-based test reporter";
31
31
*/
32
32
33
33
exports . run = function ( modules , options , callback ) {
34
- var start = new Date ( ) . getTime ( ) , div ;
35
- options = options || { } ;
36
- div = options . div || document . body ;
34
+ var start = new Date ( ) . getTime ( ) , div , textareas , displayErrorsByDefault ;
35
+ options = options || { } ;
36
+ div = options . div || document . body ;
37
+ textareas = options . textareas ;
38
+ displayErrorsByDefault = options . displayErrorsByDefault ;
37
39
38
40
function setText ( el , txt ) {
39
41
if ( 'innerText' in el ) {
@@ -82,8 +84,8 @@ exports.run = function (modules, options, callback) {
82
84
test . appendChild ( strong ) ;
83
85
84
86
var aList = document . createElement ( 'ol' ) ;
85
- aList . style . display = 'none' ;
86
- test . onclick = function ( ) {
87
+ aList . style . display = displayErrorsByDefault ? 'block' : 'none' ;
88
+ ( displayErrorsByDefault ? strong : test ) . onclick = function ( ) {
87
89
var d = aList . style . display ;
88
90
aList . style . display = ( d == 'none' ) ? 'block' : 'none' ;
89
91
} ;
@@ -92,7 +94,9 @@ exports.run = function (modules, options, callback) {
92
94
var a = assertions [ i ] ;
93
95
if ( a . failed ( ) ) {
94
96
li . innerHTML = ( a . message || a . method || 'no message' ) +
95
- '<pre>' + ( a . error . stack || a . error ) + '</pre>' ;
97
+ ( textareas ?
98
+ '<textarea rows="20" cols="100">' + ( a . error . stack || a . error ) + '</textarea>' :
99
+ '<pre>' + ( a . error . stack || a . error ) + '</pre>' ) ;
96
100
li . className = 'fail' ;
97
101
}
98
102
else {
0 commit comments