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; + } } /** 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);