Skip to content

Commit 086e39d

Browse files
authored
feat: support string array for ArgParams (#120)
* feat: support string array for ArgParams Signed-off-by: Trae Yelovich <[email protected]> * refactor: address lint errors and improve readability Signed-off-by: Trae Yelovich <[email protected]> * refactor: remove code duplication, optimize arg reduce fn Signed-off-by: Trae Yelovich <[email protected]> --------- Signed-off-by: Trae Yelovich <[email protected]>
1 parent b0c30a3 commit 086e39d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/service.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,17 @@ export default class VSCodeWorkerService implements Services.ServiceInstance {
159159

160160
const binary = path.join(__dirname, 'chromium', `index.${process.platform === 'win32' ? 'exe' : 'js'}`)
161161
const args = Object.entries({ ...customArgs, ...this._vscodeOptions.vscodeArgs }).reduce(
162-
(prev, [key, value]) => [
163-
...prev,
164-
`--${decamelize(key, { separator: '-' })}${getValueSuffix(value)}`
165-
],
162+
(prev, [key, value]) => {
163+
const decamelizedKey = decamelize(key, { separator: '-' })
164+
if (Array.isArray(value)) {
165+
const expandedArgs = value.map(
166+
(val) => `--${decamelizedKey}${getValueSuffix(val)}`
167+
)
168+
return [...prev, ...expandedArgs]
169+
}
170+
171+
return [...prev, `--${decamelizedKey}${getValueSuffix(value)}`]
172+
},
166173
[] as string[]
167174
)
168175

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export interface ServerOptions {
5252
port: number
5353
}
5454

55-
export type ArgsParams = Record<string, string | boolean>
55+
export type ArgsParams = Record<string, string | string[] | boolean>
5656

5757
/**
5858
* wdio-vscode-service options

0 commit comments

Comments
 (0)