Skip to main content

k6 inspect

Inspect a script or archive and output its configuration as JSON.

Synopsis

Description

The k6 inspect command analyzes a k6 test script or archive and outputs its configuration in JSON format. This is useful for:
  • Understanding what options are configured in a script
  • Debugging configuration issues
  • Validating test configuration before execution
  • Calculating execution requirements
The command parses the script, extracts all options (from both the script and CLI flags), and outputs them in a structured format.

Arguments

string
required
Path to the script file or archive to inspect

Examples

Flags

boolean
Include calculations of execution requirements for the test. This adds:
  • totalDuration - The total expected duration of the test
  • maxVUs - The maximum number of VUs that will be used

Runtime Options

The following runtime option flags are also available:
string[]
Add/override environment variable with VAR=value
boolean
Pass the real system environment variables to the runtime
string
default:"extended"
JavaScript compatibility mode: extended or base
string
Override test type: js or archive

Output Format

Standard Output

The standard output contains the test’s lib.Options structure:

Extended Output (with —execution-requirements)

With the --execution-requirements flag, additional fields are included:

Use Cases

Pre-flight Validation

Validate your test configuration before running:

Configuration Debugging

Check how options from different sources are merged:

Capacity Planning

Calculate resource requirements:

Exit Codes

  • 0 - Inspection successful
  • Non-zero - Error occurred (invalid script, parsing error, etc.)

See Also