|
| 1 | +// TODO: fix CLI tests when Shai or Maieul have more time to work on Qwik UI CLI |
| 2 | + |
| 3 | +// import { execSync } from 'child_process'; |
| 4 | +// import { existsSync, mkdirSync, rmSync } from 'fs'; |
| 5 | +// import { join } from 'path'; |
| 6 | + |
| 7 | +// describe('Qwik UI CLI Smoke test', () => { |
| 8 | +// let projectDirectory: string; |
| 9 | +// let tempDirectory: string; |
| 10 | + |
| 11 | +// beforeAll(() => { |
| 12 | +// const { projectDirectory: projDir, tempDir } = createTestQwikProject(); |
| 13 | + |
| 14 | +// projectDirectory = projDir; |
| 15 | +// tempDirectory = tempDir; |
| 16 | +// }); |
| 17 | + |
| 18 | +// afterAll(() => { |
| 19 | +// // Cleanup the test project |
| 20 | +// rmSync(tempDirectory, { |
| 21 | +// recursive: true, |
| 22 | +// force: true, |
| 23 | +// }); |
| 24 | +// }); |
| 25 | + |
| 26 | +// it('should be installed and add the button file', () => { |
| 27 | +// execSync( |
| 28 | +// 'npx -y qwik-ui@e2e init --e2e --projectRoot ./ --uiComponentsPath "src/components/ui" --rootCssPath "src/global.css" --installTailwind --style "simple" --components=button', |
| 29 | +// { |
| 30 | +// cwd: projectDirectory, |
| 31 | +// env: process.env, |
| 32 | +// stdio: 'inherit', |
| 33 | +// }, |
| 34 | +// ); |
| 35 | +// execSync('npx -y qwik-ui@e2e add button', { |
| 36 | +// cwd: projectDirectory, |
| 37 | +// env: process.env, |
| 38 | +// stdio: 'inherit', |
| 39 | +// }); |
| 40 | +// const buttonIsInTheRightPlace = existsSync( |
| 41 | +// join(projectDirectory, 'src/components/ui/button/button.tsx'), |
| 42 | +// ); |
| 43 | +// expect(buttonIsInTheRightPlace).toBeTruthy(); |
| 44 | +// }); |
| 45 | +// }); |
| 46 | + |
| 47 | +// /** |
| 48 | +// * Creates a test project |
| 49 | +// * @returns The directory where the test project was created |
| 50 | +// */ |
| 51 | +// function createTestQwikProject() { |
| 52 | +// const projectName = 'test-qwik-project'; |
| 53 | +// const tempDir = join('/tmp', 'tmp-qwik-ui-cli-e2e'); |
| 54 | + |
| 55 | +// // Ensure projectDirectory is empty |
| 56 | +// rmSync(tempDir, { |
| 57 | +// recursive: true, |
| 58 | +// force: true, |
| 59 | +// }); |
| 60 | +// mkdirSync(tempDir, { |
| 61 | +// recursive: true, |
| 62 | +// }); |
| 63 | + |
| 64 | +// execSync(`pnpm create qwik@latest empty ${projectName}`, { |
| 65 | +// cwd: tempDir, |
| 66 | +// stdio: 'inherit', |
| 67 | +// env: process.env, |
| 68 | +// }); |
| 69 | +// console.log(`Created test project in "${tempDir}"`); |
| 70 | + |
| 71 | +// const projectDirectory = join(tempDir, projectName); |
| 72 | + |
| 73 | +// return { |
| 74 | +// projectDirectory, |
| 75 | +// tempDir, |
| 76 | +// }; |
| 77 | +// } |
0 commit comments