(answers: Questionnair, projectRootDir: string)
| 189 | } |
| 190 | |
| 191 | export 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. |
no test coverage detected
searching dependent graphs…