From 381c0a38f961a28e72d50c0f8fa6368e08c8f778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Hietam=C3=A4ki?= Date: Sun, 27 Feb 2011 00:40:14 +0800 Subject: [PATCH] Fixed CoffeeScript support on Node 0.3+ --- bin/vows | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/vows b/bin/vows index 5386225..7013b59 100755 --- a/bin/vows +++ b/bin/vows @@ -14,7 +14,14 @@ var fileExt, specFileExt; try { var coffee = require('coffee-script'); - require.registerExtension('.coffee', function (content) { return coffee.compile(content) }); + if(require.extensions) { + require.extensions['.coffee'] = function(module, filename) { + var content = coffee.compile(fs.readFileSync(filename, 'utf8')); + return module._compile(content, filename); + }; + } else { + require.registerExtension('.coffee', function (content) { return coffee.compile(content) }); + } fileExt = /\.(js|coffee)$/; specFileExt = /[.-](test|spec)\.(js|coffee)$/; } catch (_) {