Hi! I have trouble running it as you showed. If i try to run it as you did I get an error saying .env is not a valid boolean. If i try to use -f flag to specify .env file dotenv is giving me an error that "k6" is not a valid command even though it's installed globally and added to path. I tried doing it on windows 10 and on ubuntu subsystem through WSL with same results.
Sir but I think it wouldn't be working if we use k6 web dashboard, so I've already tried the command like this: ``dotenv -e .env k6 run --out 'web-dashboard' main.js`` it's to run the test and the output of the test is from web dashboard k6.
@@AdnanErlansyah-nx7xp I haven't needed to do this, maybe there is something in the docs. The dotenv vars are separate from k6 command, so if k6 has a way of passing the args, then yes
I had a similar issue but it worked when I set up the arguments in the .env file. My command is `dotenv -e .env.test k6 run ./k6-tests/test_name.js` I then added the dashboard arguments to my .env file like so: K6_WEB_DASHBOARD=true K6_WEB_DASHBOARD_EXPORT=test-report.html K6_WEB_DASHBOARD_OPEN=true And now it works great! Hope this helps :)
Love your style and feel the same. I have adopted a pattern of having an 'env' object in each test file to encapsulate the config and keep it nice and simple for the tests that I thought you might like: const env = { endpoint: __ENV.SOMEOLDSYSTEM_ENDPOINT || fail('Missing SOMEOLDSYSTEM_ENDPOINT environment variable'), pathA: 'home' get endPointWithPath() { `${this.endpoint}/${this.pathA}` } }; Gives nice fast feedback to testers when they miss out environment variables and allows me to compose complex config whilst keeping it DRY. Environment config does get very complex!
This is great, thank you! I also struggled getting the xk6 binary working with the extension and then came across your suggestion. Thank you!
Thank you! Awesome solution!
Hi! I have trouble running it as you showed. If i try to run it as you did I get an error saying .env is not a valid boolean. If i try to use -f flag to specify .env file dotenv is giving me an error that "k6" is not a valid command even though it's installed globally and added to path. I tried doing it on windows 10 and on ubuntu subsystem through WSL with same results.
you have other problems there
need to isolate dotenv CLI and make it work just by itself, do the same for k6, and try to combine them later
Sir but I think it wouldn't be working if we use k6 web dashboard, so I've already tried the command like this:
``dotenv -e .env k6 run --out 'web-dashboard' main.js``
it's to run the test and the output of the test is from web dashboard k6.
never used dashboard, can't say
@@MuratKeremOzcan is there another way to pass the env but we can still use the other arguments of k6 sir?
@@AdnanErlansyah-nx7xp I haven't needed to do this, maybe there is something in the docs. The dotenv vars are separate from k6 command, so if k6 has a way of passing the args, then yes
I had a similar issue but it worked when I set up the arguments in the .env file.
My command is `dotenv -e .env.test k6 run ./k6-tests/test_name.js`
I then added the dashboard arguments to my .env file like so:
K6_WEB_DASHBOARD=true
K6_WEB_DASHBOARD_EXPORT=test-report.html
K6_WEB_DASHBOARD_OPEN=true
And now it works great! Hope this helps :)
Love your style and feel the same. I have adopted a pattern of having an 'env' object in each test file to encapsulate the config and keep it nice and simple for the tests that I thought you might like:
const env = {
endpoint: __ENV.SOMEOLDSYSTEM_ENDPOINT || fail('Missing SOMEOLDSYSTEM_ENDPOINT environment variable'),
pathA: 'home'
get endPointWithPath() {
`${this.endpoint}/${this.pathA}`
}
};
Gives nice fast feedback to testers when they miss out environment variables and allows me to compose complex config whilst keeping it DRY. Environment config does get very complex!
Thanks Murat, It works for me !!
There is a typescript template you can use for k6 which uses webpack to compile to vanilla js.
Thank you. You saved my day!