cucumberjs: initial implementation by mpareja · Pull Request #286 · vim-test/vim-test · GitHub
Skip to content

cucumberjs: initial implementation#286

Merged
janko merged 4 commits into
vim-test:masterfrom
mpareja:cucumberjs
Mar 24, 2018
Merged

cucumberjs: initial implementation#286
janko merged 4 commits into
vim-test:masterfrom
mpareja:cucumberjs

Conversation

@mpareja

@mpareja mpareja commented Mar 20, 2018

Copy link
Copy Markdown
Contributor

Adds support for running Cucumber.js tests from .feature files.

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 .rb files in their features directory. The existing setup had 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.

@codeinabox codeinabox left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Thank you for this, for a first foray into Vim scripting it LGTM

@janko janko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the minor comment, looks great! 👍

Comment thread autoload/test/ruby/cucumber.vim Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay folks, I've updated the algorithm for selecting which cucumber runner to execute.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`
@mpareja

mpareja commented Mar 22, 2018

Copy link
Copy Markdown
Contributor Author

@janko janko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@janko janko merged commit ab77e4a into vim-test:master Mar 24, 2018
@mpareja mpareja deleted the cucumberjs branch March 26, 2018 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants