Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement unambiguous keywords #509

Merged
merged 10 commits into from
Jan 23, 2023

Conversation

otrava7
Copy link

@otrava7 otrava7 commented Oct 26, 2022

🤔 What's changed?

  • Introduced public functions Given(), When(), and Then() to test_context.go
  • Functions work identically to Step() but only match a feature step when their specific keyword is used

⚡️ What's your motivation?

Resolves #479

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@otrava7
Copy link
Author

otrava7 commented Oct 26, 2022

Linking cucumber/common#768

@codecov
Copy link

codecov bot commented Oct 29, 2022

Codecov Report

Merging #509 (5d6dcfd) into main (c035051) will decrease coverage by 0.43%.
The diff coverage is 96.00%.

❗ Current head 5d6dcfd differs from pull request most recent head 1323b4b. Consider uploading reports for the commit 1323b4b to get more accurate results

@@            Coverage Diff             @@
##             main     #509      +/-   ##
==========================================
- Coverage   82.10%   81.66%   -0.44%     
==========================================
  Files          27       27              
  Lines        3314     2302    -1012     
==========================================
- Hits         2721     1880     -841     
+ Misses        484      321     -163     
+ Partials      109      101       -8     
Impacted Files Coverage Δ
formatters/fmt.go 100.00% <ø> (ø)
suite.go 88.44% <95.00%> (-0.23%) ⬇️
test_context.go 79.03% <100.00%> (+10.35%) ⬆️
mod_version.go 0.00% <0.00%> (-20.00%) ⬇️
internal/formatters/fmt_multi.go 91.66% <0.00%> (-5.06%) ⬇️
flags_v0110.go 50.00% <0.00%> (-4.55%) ⬇️
internal/storage/storage.go 89.79% <0.00%> (-2.31%) ⬇️
internal/formatters/undefined_snippets_gen.go 41.46% <0.00%> (-1.94%) ⬇️
internal/formatters/fmt_cucumber.go 84.76% <0.00%> (-1.83%) ⬇️
stacktrace.go 62.90% <0.00%> (-1.66%) ⬇️
... and 20 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@otrava7
Copy link
Author

otrava7 commented Oct 31, 2022

Updated tests, should increase diff coverage to 100%

@vearutop
Copy link
Member

Looks good for the actual implementation, but for dependencies update it seems to be slightly misaligned with current strategy.

We were thinking to migrate to use common monorepo for the dependencies in the past, but then reconsidered and had another type of split (cucumber/common#2029). This also applies for gherkin.

I suggest we migrate to those new modules in a separate pull request, and then rebase this one to only cover actual unambiguous keywords improvement.

@otrava7
Copy link
Author

otrava7 commented Nov 10, 2022

Thanks for the review! I did see that there was a change in strategy for dependencies, but I was having trouble importing those dependencies from those new repos. The primary reason why I switched to the common repo to begin with is that this PR needed those dependencies to be updated but go mod would not allow me as it was saying that the new version declares its name differently than the path. I believe this would occur after this change:
cucumber/messages-go@79a9301
(This was probably done so that there would be a move to common for dependants)

I was facing the same issues importing cucumber/messages repo, due to the same issue, go mod was saying the following:

module declares its path as: github.com/cucumber/common/messages/go/v19
	        but was required as: github.com/cucumber/messages/go/v19

It seems these modules still declare themselves as common. Is this something that can be fixed through a different way of importing that I'm not aware of? Or do we need to change how these modules declare their path?

Either way I'm happy to open new PR's to fix this and then rebase.

otrava7 added 2 commits January 5, 2023 12:38
# Conflicts:
#	CHANGELOG.md
#	_examples/go.mod
#	_examples/go.sum
#	formatters/fmt.go
#	go.mod
#	go.sum
#	internal/formatters/fmt.go
#	internal/formatters/fmt_base.go
#	internal/formatters/fmt_cucumber.go
#	internal/formatters/fmt_events.go
#	internal/formatters/fmt_multi.go
#	internal/formatters/fmt_pretty.go
#	internal/formatters/fmt_progress.go
#	internal/formatters/undefined_snippets_gen.go
#	internal/models/feature.go
#	internal/models/stepdef.go
#	internal/models/stepdef_test.go
#	internal/parser/parser.go
#	internal/storage/storage.go
#	internal/storage/storage_test.go
#	internal/tags/tag_filter.go
#	internal/tags/tag_filter_test.go
#	internal/testutils/utils.go
#	run.go
#	run_progress_test.go
#	run_test.go
#	suite.go
#	suite_context_test.go
#	test_context.go
@otrava7
Copy link
Author

otrava7 commented Jan 5, 2023

Rebased branch to cover keyword functions only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement unambiguous keywords
4 participants