@@ -67,6 +67,18 @@ function validateConfigurationEntry(
6767 `Expected an object (json), but got ${ util . inspect ( value ) } `
6868 ) ;
6969 }
70+ let args : string [ ] | undefined ;
71+ if ( hasOwnProperty ( value , "args" ) ) {
72+ if ( Array . isArray ( value . args ) && value . args . every ( isString ) ) {
73+ args = value . args ;
74+ } else {
75+ throw new Error (
76+ `Expected an array of strings (json.args), but got ${
77+ util . inspect ( value )
78+ } `
79+ )
80+ }
81+ }
7082 if (
7183 ! hasOwnProperty ( value , "enabled" ) ||
7284 typeof value . enabled !== "boolean"
@@ -96,6 +108,7 @@ function validateConfigurationEntry(
96108 }
97109 }
98110 const messagesConfig = {
111+ args,
99112 enabled : value . enabled ,
100113 formatter,
101114 output,
@@ -172,6 +185,20 @@ function validateEnvironmentOverrides(
172185 }
173186 }
174187
188+ if ( hasOwnProperty ( environment , "jsonArgs" ) ) {
189+ let { jsonArgs } = environment ;
190+ if ( isString ( jsonArgs ) ) {
191+ jsonArgs = JSON . parse ( jsonArgs ) ;
192+ }
193+ if ( Array . isArray ( jsonArgs ) && jsonArgs . every ( isString ) ) {
194+ overrides . jsonArgs = jsonArgs ;
195+ } else {
196+ throw new Error (
197+ `Expected a string array (jsonArgs), but got ${ util . inspect ( jsonArgs ) } `
198+ ) ;
199+ }
200+ }
201+
175202 if ( hasOwnProperty ( environment , "jsonEnabled" ) ) {
176203 const { jsonEnabled } = environment ;
177204
@@ -266,6 +293,7 @@ export interface IPreprocessorConfiguration {
266293 output ?: string ;
267294 } ;
268295 readonly json ?: {
296+ args ?: string [ ] ;
269297 enabled : boolean ;
270298 formatter ?: string ;
271299 output ?: string ;
@@ -278,6 +306,7 @@ export interface IEnvironmentOverrides {
278306 stepDefinitions ?: string | string [ ] ;
279307 messagesEnabled ?: boolean ;
280308 messagesOutput ?: string ;
309+ jsonArgs ?: string [ ] ;
281310 jsonEnabled ?: boolean ;
282311 jsonFormatter ?: string ;
283312 jsonOutput ?: string ;
@@ -326,6 +355,10 @@ export class PreprocessorConfiguration implements IPreprocessorConfiguration {
326355
327356 get json ( ) {
328357 return {
358+ args :
359+ this . environmentOverrides . jsonArgs ??
360+ this . explicitValues . json ?. args ??
361+ [ ] ,
329362 enabled :
330363 this . environmentOverrides . jsonEnabled ??
331364 this . explicitValues . json ?. enabled ??
0 commit comments