I want to add a guard clause to my k6 test to ensure a --config flag has been set.
How can I read the value of the --config flag passed into k6 during a test run?
I want to add a guard clause to my k6 test to ensure a --config flag has been set.
How can I read the value of the --config flag passed into k6 during a test run?
I don't think there is a way to detect that specifically
--configwas used to set an option, but it is possible to read the final, consolidated options from within your scripts:Reading
exec.test.optionswill show the actual option value used by your script, per order of precedence:If you want to check whether
--configwas used, you set a specific option only in this config file (e.g. a tag) and then check the consolidated options for its value.