This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
k6 deps command
The k6 deps command analyzes your k6 test script and outputs information about the dependencies your script uses.
Usage
k6 deps [options] <script>Description
When you run k6 deps, k6 analyzes your test script and its imports to identify k6 extensions (such as k6/x/faker, k6/x/redis) and k6 itself that your script uses.
The command outputs dependency information in human-readable format by default, or JSON format with the --json flag. You can use this information to:
- Understand what k6 extensions your script uses
- Share dependency information with your team
- Use it to know if you need a custom binary or if the current one can run the script
The command, like
automatic extension resolution, is only able to find dependencies using import/export syntax and “use” directives in already found files. It doesn’t follow potential require calls.
The command also takes into account any provided
dependency manifest and applies it during k6 run.
Options
Examples
Generate dependency information
Analyze your test script and output dependency information:
k6 deps script.jsThis outputs dependency information in human-readable format to stdout.
Generate JSON output
Output the dependency information in JSON format:
k6 deps --json script.jsOutput format
The k6 deps command outputs dependency information in human-readable format by default. When using the --json flag, the output is a JSON object.
Human-readable output
The default human-readable output shows:
- Build Dependencies: Lists k6 extensions and k6 itself with version constraints (or
(none)if there are no build dependencies) - Imports: Lists all imports including file paths and module names
- Custom Build Required: Indicates
yesornowhether a custom build is required
Example:
Build Dependencies:
k6: >1.2.0
k6/x/faker: *
Imports:
file:///path/to/script.js
k6/execution
k6/x/faker
Custom Build Required: yesJSON output
When using the --json flag, the output is a JSON object with three fields:
buildDependencies: An object mapping k6 extension names (ork6itself) to version constraintsimports: An array of strings listing all importscustomBuildRequired: A boolean indicating whether a custom build is required
Example:
{
"buildDependencies": {
"k6": ">1.2.0",
"k6/x/faker": "*"
},
"imports": [
"file:///path/to/script.js",
"k6/execution",
"k6/x/faker"
],
"customBuildRequired": true
}

