In some cases, it may be useful to specify the "use k6 ..." pragma on the command line. For example, additional pragmas can be specified for a specific test run without modifying the test script.
The --use option can be used to specify pragmas on the command line.
Usage:
--use pragma specifying the use k6 ... pragma to be evaluated before the test script (can be used multiple times), where pragma is a k6x pragma without the use k6 prefix
Using pragmas on the command line
In some cases, it may be useful to specify the
"use k6 ..."
pragma on the command line. For example, additional pragmas can be specified for a specific test run without modifying the test script.The
--use
option can be used to specify pragmas on the command line.Usage:
--use pragma
specifying theuse k6 ...
pragma to be evaluated before the test script (can be used multiple times), wherepragma
is a k6x pragma without theuse k6
prefixThe above example disables the processing of all other extensions except
k6/x/mock