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

Improve the UX when a user tries to import a wrong module name #2818

Open
na-- opened this issue Dec 13, 2022 · 0 comments
Open

Improve the UX when a user tries to import a wrong module name #2818

na-- opened this issue Dec 13, 2022 · 0 comments
Labels
enhancement evaluation needed proposal needs to be validated or tested before fully implementing it in k6 ux

Comments

@na--
Copy link
Member

na-- commented Dec 13, 2022

#2805 solved #1741 by adding a list of the xk6 extensions and their versions bundled in the current k6 binary in the k6 version sub-command. While having the capability to generate and show this list is great progress, displaying it in just k6 version is not very visible to most users.

Originally, #2805 also showed the bundled extensions in the k6 run output as well. However, that only added more things to the already noisy k6 run command, so we decided to hold off on that change, for now. We might choose to add it back in the future, if users request it, so please comment here with your use case if you'd like us to do that.

For example, a lighter alternative would be to log the list of extensions if --verbose mode is used in k6 run (and maybe also k6 archive, k6 inspect and k6 cloud 🤔).

Another better and less invasive approach might be to improve the error message when a user imports an unknown module. For example, if the import path starts with k6/x, instead of a simple error like unknown module: k6/x/browser, maybe we can show the list of extensions that were bundled in k6 as part of the error? Or mention that there were no extensions bundled and have a link to https://k6.io/docs/extensions/ 🤔

This way, the output of k6 run won't be crowded by a (potentially long) list of extensions on every run, but they will be visible if --verbose is enabled (which seems appropriate) or if there was a script error and the script tried to import a missing module name.

As an addition, maybe we can also offer suggestions, if users had a typo. Similarly to how when someone types k6 ryn, k6 will exit with an error and print something like this:

unknown command "ryn" for "k6"

Did you mean this?
	run 

This will have UX benefits even for regular import script errors, like mistyped import paths, etc., not just for extensions.

Finally, grafana/xk6#52 probably deserves a mention here. We should probably figure out some way to warn users of old k6 versions. This can be a result of xk6 building an extension that relies on an old k6 version, or it can be just a stale install that hasn't been updated in ages. However, we have had cases where users were confused that they couldn't import k6/execution, for example, even though they just built their k6 binary with xk6 recently, just because xk6 used the super-old k6 version in the extension's go.mod file during the build... Maybe we should even revisit grafana/xk6#44? 🤔

@na-- na-- added enhancement ux evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement evaluation needed proposal needs to be validated or tested before fully implementing it in k6 ux
Projects
None yet
Development

No branches or pull requests

1 participant