(type: QwikProjectType)
| 9 | |
| 10 | export type QwikProjectType = 'playground' | 'library' | 'empty'; |
| 11 | export function scaffoldQwikProject(type: QwikProjectType): { |
| 12 | tmpDir: string; |
| 13 | cleanupFn: () => void; |
| 14 | } { |
| 15 | const tmpHostDirData = getTmpDirSync( |
| 16 | process.env.TEMP_E2E_PATH ? `${process.env.TEMP_E2E_PATH}/${type}` : undefined |
| 17 | ); |
| 18 | const cleanupFn = () => { |
| 19 | if (!tmpHostDirData.overridden) { |
| 20 | cleanup(tmpHostDirData.path); |
| 21 | } else { |
| 22 | log('Custom E2E test path was used, skipping the removal of test folder'); |
| 23 | } |
| 24 | }; |
| 25 | try { |
| 26 | const tmpDir = runCreateQwikCommand(tmpHostDirData.path, type); |
| 27 | log(`Created test application at "${tmpDir}"`); |
| 28 | replacePackagesWithLocalOnes(tmpDir); |
| 29 | return { cleanupFn, tmpDir }; |
| 30 | } catch (error) { |
| 31 | cleanupFn(); |
| 32 | throw error; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | function cleanup(tmpDir: string) { |
| 37 | log(`Removing tmp dir "${tmpDir}"`); |
no test coverage detected
searching dependent graphs…