From 4eda438f141792690838ce2ed05d293a814be210 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sun, 6 Mar 2011 10:55:13 -0500 Subject: [PATCH] Outputting current test for browser - Output is hidden on success, but useful on failure --- test/test-combine.js | 7 ++++++- tools/browser-test.html | 2 +- tools/combine | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test-combine.js b/test/test-combine.js index 0c384da..cdf4574 100644 --- a/test/test-combine.js +++ b/test/test-combine.js @@ -26,7 +26,12 @@ var common = require( './common' ), assert = require( 'assert' ), Class = common.require( 'class' ), Script = process.binding( 'evals' ).Script, - sandbox = {}; + + // sandbox in which combined script will be run + sandbox = { + // stub document.write() so we don't blow up + document: { write: function() {} }, + }; var files = [ 'ease.js', 'ease-full.js' ], diff --git a/tools/browser-test.html b/tools/browser-test.html index 938505d..86eb485 100644 --- a/tools/browser-test.html +++ b/tools/browser-test.html @@ -24,7 +24,7 @@ catch ( e ) { body.style.color = 'red'; - body.innerHTML = '

' + e.message + '

' + + body.innerHTML += '

' + e.message + '

' + '

ease.js is not guaranteed to run properly within this ' + 'browser.

' + '

If building ease.js, remember to run `make combine` ' + diff --git a/tools/combine b/tools/combine index e6cd1b4..50b01b7 100755 --- a/tools/combine +++ b/tools/combine @@ -127,6 +127,10 @@ if [ "$INC_TEST" ]; then echo "{" echo " var exports = module.exports = {};" + # write out current test to make debugging easier in browsers with very + # little debugging support + echo " document.write( '$module...
' )" + # add the module, removing trailing commas cat $filename | $RMTRAIL