From e9bf466241e2b6bef9d768c8c2e5eefe461f4d34 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 28 Jul 2011 15:27:48 +0200 Subject: [PATCH 1/2] Added support for writing the steps in CoffeeScript. --- lib/brain/parse_gherkin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/brain/parse_gherkin.js b/lib/brain/parse_gherkin.js index 1085ff0..89a3474 100644 --- a/lib/brain/parse_gherkin.js +++ b/lib/brain/parse_gherkin.js @@ -41,7 +41,9 @@ var parseEnvFile = exports.parseEnvFile = function(callback) { var parseStepDefinitions = exports.parseStepDefinitions = function() { try { _(findit.findSync('features')).each(function(file) { - if (file.match(/\_steps.js$/) !== null) { + var match = null; + if ((match = file.match(/\_steps.(js|coffee)$/)) !== null) { + if (match[1] == "coffee") { require("coffee-script") } var correctFilePath = process.cwd() + '/' + file; delete require.cache[path.resolve(correctFilePath)]; require(correctFilePath); From 2f1d7159135b0f32c63034b37c1f9c56b62941dc Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 28 Jul 2011 16:14:38 +0200 Subject: [PATCH 2/2] Added support for writing the env file in CoffeeScript. --- bin/peanut | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/peanut b/bin/peanut index 9d324c5..0758604 100755 --- a/bin/peanut +++ b/bin/peanut @@ -87,7 +87,13 @@ __peanut__.envExists = true; try { fs.statSync(process.cwd()+'/features/support/env.js'); } catch(err) { - __peanut__.envExists = false; + // if it's not a JS file, check if it's a CS one + try { + fs.statSync(process.cwd()+'/features/support/env.coffee'); + require('coffee-script'); // So we load coffeescript! + } catch(err) { + __peanut__.envExists = false; + } } /**