|
| 1 | +import {join} from 'path'; |
| 2 | +import {ng} from '../../../utils/process'; |
| 3 | +import {createDir, expectFileToExist} from '../../../utils/fs'; |
| 4 | + |
| 5 | + |
| 6 | +export default function() { |
| 7 | + const subDir = 'sub-dir'; |
| 8 | + const componentDir = join('src', 'app', subDir, 'test-component'); |
| 9 | + |
| 10 | + return Promise.resolve() |
| 11 | + // .then(() => process.chdir('src/app')) |
| 12 | + .then(() => process.chdir('src')) |
| 13 | + .then(() => process.chdir('app')) |
| 14 | + .then(() => createDir(subDir)) |
| 15 | + .then(() => process.chdir(subDir)) |
| 16 | + .then(() => console.log('curent dir: ' + process.cwd())) |
| 17 | + .then(() => ng('generate', 'component', 'test-component')) |
| 18 | + .then(() => process.chdir('../../..')) |
| 19 | + .then(() => expectFileToExist(componentDir)) |
| 20 | + .then(() => expectFileToExist(join(componentDir, 'test-component.component.ts'))) |
| 21 | + .then(() => expectFileToExist(join(componentDir, 'test-component.component.spec.ts'))) |
| 22 | + .then(() => expectFileToExist(join(componentDir, 'test-component.component.html'))) |
| 23 | + .then(() => expectFileToExist(join(componentDir, 'test-component.component.css'))) |
| 24 | + |
| 25 | + // Try to run the unit tests. |
| 26 | + .then(() => ng('test', '--single-run')); |
| 27 | +} |
0 commit comments