MCPcopy
hub / github.com/vitest-dev/vitest / formatTemplateString

Function formatTemplateString

packages/runner/src/suite.ts:1079–1095  ·  view source on GitHub ↗
(cases: any[], args: any[])

Source from the content-addressed store, hash-verified

1077}
1078
1079function formatTemplateString(cases: any[], args: any[]): any[] {
1080 const header = cases
1081 .join('')
1082 .trim()
1083 .replace(/ /g, '')
1084 .split('\n')
1085 .map(i => i.split('|'))[0]
1086 const res: any[] = []
1087 for (let i = 0; i < Math.floor(args.length / header.length); i++) {
1088 const oneCase: Record<string, any> = {}
1089 for (let j = 0; j < header.length; j++) {
1090 oneCase[header[j]] = args[i * header.length + j] as any
1091 }
1092 res.push(oneCase)
1093 }
1094 return res
1095}

Callers 2

createSuiteFunction · 0.85
createTaskCollectorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected