This is documentation for the next version of K6. For the latest stable release, go to the latest version.
Mock
You can use this secret source to test your tests quick and easy.
$ k6 run --secret-source=cli=mysecret=value script.js
You can even use multiple ones and have some of them named or set as default.
import secrets from "k6/secrets";
export default async () => {
const my_secret = await secrets.get("cool");
console.log(my_secret == "cool secret");
const anothersource = await secrets.source("another")
console.log(await anothersource.get("cool") == "cool secret");
console.log(await anothersource.get("cool") == "not cool secret");
}