From ddd9588391733349fac7449df4f5ca37b5efd387 Mon Sep 17 00:00:00 2001 From: Julien Guimont Date: Wed, 14 Sep 2011 11:55:06 -0400 Subject: [PATCH] When an uncaught exception is caught in watch mode, print it in the console and continue watch. --- bin/vows | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/vows b/bin/vows index 99bacf0..81b1274 100755 --- a/bin/vows +++ b/bin/vows @@ -194,7 +194,6 @@ if (args.length === 0 || options.watch) { abort("runner", "couldn't find test folder"); } msg('bin', 'discovered', "./" + testFolder); - if (args.length === 0) { args = paths(testFolder).filter(function (f) { return new(RegExp)('(-|_)' + testFolder + '.(js|coffee)$').test(f); @@ -280,8 +279,7 @@ if (! options.watch) { lastRun, colors = ['32m', '33m', '31m'], timer = setInterval(tick, 100); - - process.on('uncaughtException', cleanup); + process.on('uncaughtException', exception); process.on('exit', cleanup); process.on('SIGINT', function () { process.exit(0); @@ -321,6 +319,7 @@ if (! options.watch) { function cursorHide() { esc("?25l") } function cursorShow() { esc("?25h") } function cleanup() { eraseLine(), cursorShow(), clearInterval(timer), print('\n') } + function exception(err) { print(err.stack || err.message || JSON.stringify(err)), running = 0} // // Get a matching test for a given file