-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[fs] Add a fs.opensync
function to the k6/experimental/fs
module
#3203
Conversation
fs.opensync
function to the k6/experimental/fs
modulefs.opensync
function to the k6/experimental/fs
module
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## experimental/fs #3203 +/- ##
==================================================
Coverage ? 73.17%
==================================================
Files ? 263
Lines ? 20010
Branches ? 0
==================================================
Hits ? 14642
Misses ? 4433
Partials ? 935
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a228a8a
to
85738db
Compare
66e56c9
to
fb6aa54
Compare
85738db
to
44cbe26
Compare
44cbe26
to
9d4c7f3
Compare
4461b00
to
ac9cef1
Compare
9d4c7f3
to
30747f8
Compare
6a1658b
to
9dd1a26
Compare
30747f8
to
5445d8e
Compare
5445d8e
to
937deff
Compare
fs.opensync
function to the k6/experimental/fs
modulefs.opensync
function to the k6/experimental/fs
module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document it as such and make it explicit that it won't be supported any further once we address the core issue and that the following syntax is possible
I'm not very happy with it. We are adding something that in a cycle could be removed.
If it is useful a lot of people will use it then removing it will make them a lot unhappy.
If it isn't useful then we could just not add.
I would wait for one more cycle before adding it to see the evolution around JS ES modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sharing concerns with @codebien regarding adding something temporary.
On the other side, it's an experimental module, and by our definition, the API isn't stable, so it's OK to have this for a few releases.
There seems to be a consensus that we should not add I'm happy to oblige and will close this Pull Request as a result 🙇🏻 I would consider support for |
What?
This Pull Request adds an
fs.openSync
function to thek6/experimental/fs
module, as per #3143.It allows to open a file as such:
As opposed to the current workaround necessary to go around the limitation of not being able to use await in the init context:
Why?
This function acts as a workaround for the lack of support for the
await
keyword in the init context and is meant to go away as soon as we do. It aims at ensuring a good UX that's more intuitive than the existing workaround ☝🏻We should document it as such and make it explicit that it won't be supported any further once we address the core issue and that the following syntax is possible:
Checklist
make ci-like-lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
closes #3143