@@ -43,6 +43,9 @@ extended: base + sets "global" as alias for "globalThis"
4343 "" ,
4444 "output the end-of-test summary report to JSON file" ,
4545 )
46+ // TODO(@joanlopez): remove by k6 v2.0, once the new summary model is the default and the only one.
47+ flags .Bool ("new-machine-readable-summary" , false , "enables the new machine-readable summary, " +
48+ "which is used for summary exports and as handleSummary() argument" )
4649 flags .String ("traces-output" , "none" ,
4750 "set the output for k6 traces, possible values are none,otel[=host:port]" )
4851 return flags
@@ -78,15 +81,16 @@ func getRuntimeOptions(
7881
7982func runtimeOptionsFromFlags (flags * pflag.FlagSet ) lib.RuntimeOptions {
8083 opts := lib.RuntimeOptions {
81- TestType : getNullString (flags , "type" ),
82- IncludeSystemEnvVars : getNullBool (flags , "include-system-env-vars" ),
83- CompatibilityMode : getNullString (flags , "compatibility-mode" ),
84- NoThresholds : getNullBool (flags , "no-thresholds" ),
85- NoSummary : getNullBool (flags , "no-summary" ),
86- SummaryMode : getNullString (flags , "summary-mode" ),
87- SummaryExport : getNullString (flags , "summary-export" ),
88- TracesOutput : getNullString (flags , "traces-output" ),
89- Env : make (map [string ]string ),
84+ TestType : getNullString (flags , "type" ),
85+ IncludeSystemEnvVars : getNullBool (flags , "include-system-env-vars" ),
86+ CompatibilityMode : getNullString (flags , "compatibility-mode" ),
87+ NoThresholds : getNullBool (flags , "no-thresholds" ),
88+ NoSummary : getNullBool (flags , "no-summary" ),
89+ SummaryMode : getNullString (flags , "summary-mode" ),
90+ SummaryExport : getNullString (flags , "summary-export" ),
91+ NewMachineReadableSummary : getNullBool (flags , "new-machine-readable-summary" ),
92+ TracesOutput : getNullString (flags , "traces-output" ),
93+ Env : make (map [string ]string ),
9094 }
9195 return opts
9296}
@@ -133,6 +137,12 @@ func populateRuntimeOptionsFromEnv(opts lib.RuntimeOptions, environment map[stri
133137 opts .SummaryExport = null .StringFrom (envVar )
134138 }
135139
140+ if err := saveBoolFromEnv (
141+ environment , "K6_NEW_MACHINE_READABLE_SUMMARY" , & opts .NewMachineReadableSummary ,
142+ ); err != nil {
143+ return opts , err
144+ }
145+
136146 if envVar , ok := environment ["SSLKEYLOGFILE" ]; ! opts .KeyWriter .Valid && ok {
137147 opts .KeyWriter = null .StringFrom (envVar )
138148 }
0 commit comments