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

Function getPathForFileGeneration

packages/create-wdio/src/utils.ts:191–217  ·  view source on GitHub ↗
(answers: Questionnair, projectRootDir: string)

Source from the content-addressed store, hash-verified

189}
190
191export function getPathForFileGeneration(answers: Questionnair, projectRootDir: string) {
192 const specAnswer = answers.specs || ''
193 const stepDefinitionAnswer = answers.stepDefinitions || ''
194 const pageObjectAnswer = answers.pages || ''
195
196 const destSpecRootPath = generatePathFromAnswer(specAnswer, projectRootDir).replace(/\*\*$/, '')
197 const destStepRootPath = generatePathFromAnswer(stepDefinitionAnswer, projectRootDir)
198 const destPageObjectRootPath = answers.usePageObjects
199 ? generatePathFromAnswer(pageObjectAnswer, projectRootDir).replace(/\*\*$/, '')
200 : ''
201 const destSerenityLibRootPath = usesSerenity(answers)
202 ? path.resolve(projectRootDir, answers.serenityLibPath || 'serenity')
203 : ''
204 const relativePath = (answers.generateTestFiles && answers.usePageObjects)
205 ? !(convertPackageHashToObject(answers.framework).short === 'cucumber')
206 ? path.relative(destSpecRootPath, destPageObjectRootPath)
207 : path.relative(destStepRootPath, destPageObjectRootPath)
208 : ''
209
210 return {
211 destSpecRootPath: destSpecRootPath,
212 destStepRootPath: destStepRootPath,
213 destPageObjectRootPath: destPageObjectRootPath,
214 destSerenityLibRootPath: destSerenityLibRootPath,
215 relativePath: relativePath.replaceAll(path.sep, '/')
216 }
217}
218
219/**
220 * Generates a valid file path from answers provided.

Callers 2

parseAnswersFunction · 0.85
utils.test.tsFile · 0.85

Calls 3

generatePathFromAnswerFunction · 0.85
usesSerenityFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…