Skip to content

Commit 87a8c89

Browse files
committed
test(@angular/cli): Add more tests for running 'generate' in a subdirectory (#7135)
1 parent 3814683 commit 87a8c89

File tree

6 files changed

+31
-0
lines changed

6 files changed

+31
-0
lines changed

tests/e2e/tests/generate/component/component-module.ts

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export default function() {
1919
.then(() => expectFileToMatch(modulePath,
2020
/import { TestComponent2Component } from '.\/test-component2\/test-component2.component'/))
2121

22+
.then(() => process.chdir(join(root, 'src', 'app', 'sub-dir')))
23+
.then(() => ng('generate', 'component', 'test-component3', '--module', 'app.module.ts'))
24+
.then(() => expectFileToMatch(modulePath,
25+
/import { TestComponent3Component } from '.\/test-component3\/test-component3.component'/))
26+
2227
// Try to run the unit tests.
2328
.then(() => ng('build'));
2429
}

tests/e2e/tests/generate/directive/directive-module.ts

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export default function() {
1919
.then(() => expectFileToMatch(modulePath,
2020
/import { TestDirective2Directive } from '.\/test-directive2.directive'/))
2121

22+
.then(() => process.chdir(join(root, 'src', 'app', 'sub-dir')))
23+
.then(() => ng('generate', 'directive', 'test-directive3', '--module', 'app.module.ts'))
24+
.then(() => expectFileToMatch(modulePath,
25+
/import { TestDirective3Directive } from '.\/test-directive3.directive'/))
26+
2227
// Try to run the unit tests.
2328
.then(() => ng('build'));
2429
}

tests/e2e/tests/generate/guard/guard-module.ts

+5
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@ export default function() {
2121
.then(() => expectFileToMatch(modulePath,
2222
/import { TestGuard2Guard } from '.\/test-guard2.guard'/))
2323

24+
.then(() => process.chdir(join(root, 'src', 'app', 'sub-dir')))
25+
.then(() => ng('generate', 'guard', 'test-guard3', '--module', 'app.module.ts'))
26+
.then(() => expectFileToMatch(modulePath,
27+
/import { TestGuard3Guard } from '.\/test-guard3.guard'/))
28+
2429
.then(() => ng('build'));
2530
}

tests/e2e/tests/generate/module/module-import.ts

+6
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ export default function () {
5252
.then(() => expectFileToMatch(modulePath,
5353
/import { Test7Module } from '.\/test7\/test7.module'/))
5454
.then(() => expectFileToMatch(modulePath, /imports: \[(.|\s)*Test7Module(.|\s)*\]/m))
55+
56+
.then(() => process.chdir(join(root, 'src', 'app', 'sub-dir')))
57+
.then(() => ng('generate', 'module', 'test8', '--module', 'app.module.ts')))
58+
.then(() => expectFileToMatch(modulePath,
59+
/import { Test8Module } from '.\/test8\/test8.module'/))
60+
.then(() => expectFileToMatch(modulePath, /imports: \[(.|\s)*Test8Module(.|\s)*\]/m))
5561
}

tests/e2e/tests/generate/pipe/pipe-module.ts

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export default function() {
1919
.then(() => expectFileToMatch(modulePath,
2020
/import { TestPipe2Pipe } from '.\/test-pipe2.pipe'/))
2121

22+
.then(() => process.chdir(join(root, 'src', 'app', 'sub-dir')))
23+
.then(() => ng('generate', 'pipe', 'test-pipe3', '--module', 'app.module.ts'))
24+
.then(() => expectFileToMatch(modulePath,
25+
/import { TestPipe3Pipe } from '.\/test-pipe3.pipe'/))
26+
2227
// Try to run the unit tests.
2328
.then(() => ng('build'));
2429
}

tests/e2e/tests/generate/service/service-module.ts

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export default function() {
1919
.then(() => expectFileToMatch(modulePath,
2020
/import { TestService2Service } from '.\/test-service2.service'/))
2121

22+
.then(() => process.chdir(join(root, 'src', 'app', 'sub-dir')))
23+
.then(() => ng('generate', 'service', 'test-service3', '--module', 'app.module.ts'))
24+
.then(() => expectFileToMatch(modulePath,
25+
/import { TestService3Service } from '.\/test-service3.service'/))
26+
2227
// Try to run the unit tests.
2328
.then(() => ng('build'));
2429
}

0 commit comments

Comments
 (0)