grafana / k6x

Run k6 with extensions
GNU Affero General Public License v3.0
13 stars 3 forks source link

Using pragmas on the command line #8

Closed szkiba closed 11 months ago

szkiba commented 11 months ago

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 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

k6x run --use "import allow k6/x/mock" --use "import deny k6/x/**" script.js

The above example disables the processing of all other extensions except k6/x/mock

szkiba commented 11 months ago

This feature is made obsolete by feature #10