Open inancgumus opened 2 years ago
This seems like another facet of #3 to me :thinking:
I think that apart from printing a better and earlier warning there isn't much we can do for the other case.
For xk6 run
I feel like that needs a lot of work. Currently, it won't reuse a directory which means the build takes ... a while, although in reality it should be instantaneous if there are no changes or very few ones.
So I feel more like xk6 run
needs to either be deprecated and users to be told to replicate what xk6 does - which is pretty simple to do either way. Or we need spend some more time to make it less slow and as this issue shows ... broken.
I don't know how common k6
directory in extensions are though ... seems rare as only you and I have hit it and I hit really early on in a really "w/e I have experimental" directory.
Oh, I missed #3 🤦
Would it be better to document that there should not be a k6
directory or file in the same directory while running xk6
?
Currently, it won't reuse a directory which means the build takes ... a while, although in reality, it should be instantaneous if there are no changes or very few ones.
Yup, this is another problem. Not a biggie but it makes developing with an extension slower.
I don't know how common k6 directory in extensions is though
We've created a package named k6
for communicating with the k6 core. We could have named it core
too, but making it k6
kept it concise.
In the meantime, I found a dummy solution and it works for me for now:
Update (a better version—only for zsh, though):
kbr () {
set -o err_return
trap "unsetopt err_return && rm -f k6x" EXIT
xk6 build --output k6x --with github.com/grafana/xk6-browser=.
[[ -f ./k6x ]] && ./k6x run -q "$@"
}
xk6 cannot run the k6 command if there is a
k6
directory (or a non-executable file, I guess) in the extension folder:fork/exec ./k6: permission denied
.Reproduce:
git clone https://github.com/grafana/xk6-browser
(or any extension)cd xk6-browser
mkdir k6
xk6 run something.js
Output: