-
Notifications
You must be signed in to change notification settings - Fork 255
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
Use fs.FS
abstraction for filesystem
#550
Conversation
This is a great feature, thank you! I'm a bit concerned with the necessity of manual upgrade of existing code, as in var opts = godog.Options{
Paths: []string{"../testfiles/features"},
} becomes var opts = godog.Options{
Paths: []string{"testfiles/features"},
FS: os.DirFS("../"),
} It seems we can preserve backwards compatibility by having a special case for |
Sure we can do that, I'll see to sorting this at some point today. |
43cbcbe
to
7b48c25
Compare
@vearutop I fixed the build here, sorry about that.
|
Codecov Report
@@ Coverage Diff @@
## main #550 +/- ##
==========================================
+ Coverage 82.24% 82.94% +0.69%
==========================================
Files 27 28 +1
Lines 3340 3371 +31
==========================================
+ Hits 2747 2796 +49
+ Misses 484 461 -23
- Partials 109 114 +5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@vearutop Ok I've added tests to cover the new |
Hi @tigh-latte, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
🤔 What's changed?
Allow users to supply a
fs.FS
to files from. If not provided, we will fallback to the standardos
file operations.⚡️ What's your motivation?
As
fs.FS
is an interface it gives users flexibility beyond just the operating system's filesystem, such as mocking (see, for example, the tests. We no longer write data to/tmp
) or at the very least, an in-memory fs. But the key feature is that it allows us to compile the feature files into an executable test binary, allowing that binary to be shipped independent from the feature files.Then we can just:
Currently I embed all test data into my test suite, and sometimes deploy these tests into a restricted environment for some non-user facing service tests in a live environment. With the current set up of godog, I have to also be concerned with shipping the feature files and placing them the correct location on the filesystem. This change would let users just fire a test binary into a scratch container and run without being concerned the underlying filesystem.
🏷️ What kind of change is this?
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.