Skip to content

Commit 74d3dbc

Browse files
Edits to Run a test with extensions
1 parent c6b680d commit 74d3dbc

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

docs/sources/k6/next/extensions/run/_index.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ weight: 03
77

88
# Run a test with extensions
99

10-
As explained in the [Explore extensions](https://grafana.com/docs/k6/<K6_VERSION>/extensions/explore) page, there are extensions that can be used directly in your test script, and others that require building a custom k6 binary.
10+
There are two different ways to run your k6 test script depending on the k6 extension you want to use: using the automatic extension resolution, or building a custom k6 binary.
1111

12-
## Using automatic extension resolution
12+
## Before you begin
1313

14-
It is as easy as importing them. Example with [xk6-faker](https://github.com/grafana/xk6-faker):
14+
- [Install k6](https://grafana.com/docs/k6/<K6_VERSION>/set-up/install-k6/) v1.2.0 or higher.
15+
16+
## Use automatic extension resolution
17+
18+
It's as easy as importing them. Example with [xk6-faker](https://github.com/grafana/xk6-faker):
1519

1620
```javascript
1721
import faker from 'k6/x/faker';
@@ -21,7 +25,7 @@ export default function () {
2125
}
2226
```
2327

24-
Then, you can run your script as usual, and k6 will automatically detect the extension and load it:
28+
Then, you can run your script as usual, and k6 automatically detects the extension and loads it:
2529

2630
```sh
2731
k6 run script.js
@@ -40,11 +44,11 @@ K6_ENABLE_COMMUNITY_EXTENSIONS=true k6 run test.js
4044
### Limitations
4145

4246
- Only works with Official and Community extensions.
43-
- Output extensions are not supported.
44-
- Running scripts from stdin is not supported.
47+
- Output extensions aren't supported.
48+
- Running scripts from stdin isn't supported.
4549
- Only files with extensions `.js`, `.ts` or `.tar` can be used.
4650

47-
### How to disable this feature
51+
### Disable automatic extension resolution
4852

4953
You can disable this feature by setting the environment variable `K6_AUTO_EXTENSION_RESOLUTION` to `false`. If provided, the previous example
5054
fails because k6 can't load the extension dynamically.
@@ -53,11 +57,11 @@ fails because k6 can't load the extension dynamically.
5357
K6_AUTO_EXTENSION_RESOLUTION=false k6 run test.js
5458
```
5559

56-
## Using extensions that require building a custom k6 binary
60+
## Use extensions with a custom k6 binary
5761

5862
To run other extensions (including ones you create), you need to build a custom k6 binary with [xk6](https://github.com/grafana/xk6/).
5963

60-
You can do this locally with [Go](https://grafana.com/docs/k6/<K6_VERSION>/extensions/run/build-k6-binary-using-go/) or use the [xk6 Docker image](https://grafana.com/docs/k6/<K6_VERSION>/extensions/run/build-k6-binary-using-docker/).
64+
You can do this locally with Go or use the xk6 Docker image.
6165

6266
{{< code >}}
6367

@@ -74,4 +78,7 @@ docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \
7478

7579
{{< /code >}}
7680

77-
<br/>
81+
For more details, refer to:
82+
83+
- [Build a k6 binary using Go](https://grafana.com/docs/k6/<K6_VERSION>/extensions/run/build-k6-binary-using-go/)
84+
- [Build a k6 binary using Docker](https://grafana.com/docs/k6/<K6_VERSION>/extensions/run/build-k6-binary-using-docker/)

0 commit comments

Comments
 (0)