cucumberjs: initial implementation#286
Conversation
codeinabox
left a comment
There was a problem hiding this comment.
👍
Thank you for this, for a first foray into Vim scripting it LGTM
janko
left a comment
There was a problem hiding this comment.
Other than the minor comment, looks great! 👍
There was a problem hiding this comment.
I think we actually do want to activate CucumberJS when there are JS files in the features/ directory, so I think the condition should be negated: && !empty(glob('features/**/*.js'))
I was thinking that, just like Behat (the PHP version of Cucumber) is activated when there are PHP files in the features/ directory, we could activate the Ruby Cucumber only if there are Ruby files in the features/ directory, and CucumberJS only if there are JS files. What do you think?
There was a problem hiding this comment.
I stuck with the approach that was there because I'm not clear how vim-test deals with scenarios where multiple runners qualify. For example, how would vim-test address having both .rb and .php files under the features directory? Does a capability currently exist to help address this conflict?
There was a problem hiding this comment.
For JavaScript we can check in package.json, is that sufficient or do we need something similar to check composer.json for PHP or the gem lock file for Ruby?
There was a problem hiding this comment.
For example, how would vim-test address having both .rb and .php files under the features directory?
I'm just hoping that no setup will use two languages for implementing Cucumber steps 😃. I think we can ignore this possibility for now, and revisit it if someone opens a ticket.
There was a problem hiding this comment.
Okay folks, I've updated the algorithm for selecting which cucumber runner to execute.
There was a problem hiding this comment.
I'm scared of breaking existing Ruby users. The existing setup essentially has Ruby as the "default" runner for .feature files. I considered making the Ruby version search for cucumber in the Gemfile but thought that checking for .rb files in the features directory would be safer.
+ use JS if package.json contains cucumber module + use Ruby if `.rb` files exist in `feature`

Adds support for running Cucumber.js tests from
.featurefiles.I would appreciate a thorough review as this is my first foray into non-trivial vim script authoring.
Breaking Change
This PR may break existing Ruby users that don't have
.rbfiles in theirfeaturesdirectory. The existing setup had Ruby as the "default" runner for.featurefiles. I considered making the Ruby version search for cucumber in theGemfilebut thought that checking for.rbfiles in the features directory would be safer.