|
| 1 | +import * as fs from 'fs-extra'; |
1 | 2 | import { join } from 'path';
|
2 | 3 | import { ng } from '../../../utils/process';
|
3 | 4 | import { expectFileToMatch } from '../../../utils/fs';
|
4 | 5 |
|
5 | 6 | export default function () {
|
6 |
| - const modulePath = join('src', 'app', 'app.module.ts'); |
| 7 | + const root = process.cwd(); |
| 8 | + const modulePath = join(root, 'src', 'app', 'app.module.ts'); |
7 | 9 | const subModulePath = join('src', 'app', 'sub', 'sub.module.ts');
|
8 | 10 | const deepSubModulePath = join('src', 'app', 'sub', 'deep', 'deep.module.ts');
|
9 | 11 |
|
| 12 | + fs.mkdirSync('./src/app/sub-dir'); |
| 13 | + |
10 | 14 | return Promise.resolve()
|
11 | 15 | .then(() => ng('generate', 'module', 'sub'))
|
12 | 16 | .then(() => ng('generate', 'module', 'sub/deep'))
|
@@ -40,4 +44,16 @@ export default function () {
|
40 | 44 | .then(() => expectFileToMatch(deepSubModulePath,
|
41 | 45 | /import { Test6Module } from '.\/..\/..\/test6\/test6.module'/))
|
42 | 46 | .then(() => expectFileToMatch(deepSubModulePath, /imports: \[(.|\s)*Test6Module(.|\s)*\]/m)));
|
| 47 | + |
| 48 | + .then(() => process.chdir(join(root, 'src', 'app'))) |
| 49 | + .then(() => ng('generate', 'module', 'test7', '--module', 'app.module.ts'))) |
| 50 | + .then(() => expectFileToMatch(modulePath, |
| 51 | + /import { Test7Module } from '.\/test7\/test7.module'/)) |
| 52 | + .then(() => expectFileToMatch(modulePath, /imports: \[(.|\s)*Test7Module(.|\s)*\]/m)) |
| 53 | + |
| 54 | + .then(() => process.chdir(join(root, 'src', 'app', 'sub-dir'))) |
| 55 | + .then(() => ng('generate', 'module', 'test8', '--module', 'app.module.ts'))) |
| 56 | + .then(() => expectFileToMatch(modulePath, |
| 57 | + /import { Test8Module } from '.\/test8\/test8.module'/)) |
| 58 | + .then(() => expectFileToMatch(modulePath, /imports: \[(.|\s)*Test8Module(.|\s)*\]/m)) |
43 | 59 | }
|
0 commit comments