MCPcopy Create free account
hub / github.com/webdriverio/webdriverio / buildNewConfigArray

Function buildNewConfigArray

packages/create-wdio/src/utils.ts:874–886  ·  view source on GitHub ↗
(str: string, type: string, change: string)

Source from the content-addressed store, hash-verified

872}
873
874function buildNewConfigArray(str: string, type: string, change: string) {
875 const newStr = str
876 .split(`${type}s: `)[1]
877 .replace(/'/g, '')
878
879 const newArray = newStr.match(/(\w*)/gmi)?.filter(e => !!e).concat([change]) || []
880
881 return str
882 .replace('// ', '')
883 .replace(
884 new RegExp(`(${type}s: )((.*\\s*)*)`), `$1[${newArray.map(e => `'${e}'`)}]`
885 )
886}
887
888function buildNewConfigString(str: string, type: string, change: string) {
889 return str.replace(new RegExp(`(${type}: )('\\w*')`), `$1'${change}'`)

Callers 1

replaceConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…