forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(generate): add ability to specify module for import
Closes angular#3806
- Loading branch information
Showing
15 changed files
with
213 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {ng} from '../../../utils/process'; | ||
import {expectToFail} from '../../../utils/utils'; | ||
|
||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => expectToFail(() => | ||
ng('generate', 'component', 'test-component', '--module', 'app.moduleXXX.ts'))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {join} from 'path'; | ||
import {ng} from '../../../utils/process'; | ||
import {expectFileToMatch} from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
const modulePath = join('src', 'app', 'app.module.ts'); | ||
|
||
return ng('generate', 'component', 'test-component', '--module', 'app.module.ts') | ||
.then(() => expectFileToMatch(modulePath, | ||
/import { TestComponentComponent } from '.\/test-component\/test-component.component'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('test', '--single-run')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {join} from 'path'; | ||
import {ng} from '../../../utils/process'; | ||
import {expectFileToExist} from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
const directiveDir = join('src', 'app', 'test-directive'); | ||
|
||
return ng('generate', 'directive', 'test-directive') | ||
.then(() => expectFileToExist(directiveDir)) | ||
.then(() => expectFileToExist(join(directiveDir, 'test-directive.directive.ts'))) | ||
.then(() => expectFileToExist(join(directiveDir, 'test-directive.directive.spec.ts'))) | ||
.then(() => expectFileToExist(join(directiveDir, 'test-directive.directive.html'))) | ||
.then(() => expectFileToExist(join(directiveDir, 'test-directive.directive.css'))) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('test', '--single-run')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {ng} from '../../../utils/process'; | ||
import {expectToFail} from '../../../utils/utils'; | ||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => expectToFail(() => | ||
ng('generate', 'directive', 'test-directive', '--module', 'app.moduleXXX.ts'))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {join} from 'path'; | ||
import {ng} from '../../../utils/process'; | ||
import {expectFileToMatch} from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
const modulePath = join('src', 'app', 'app.module.ts'); | ||
|
||
return ng('generate', 'directive', 'test-directive', '--module', 'app.module.ts') | ||
.then(() => expectFileToMatch(modulePath, | ||
/import { TestDirectiveDirective } from '.\/test-directive\/test-directive.directive'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('test', '--single-run')); | ||
} |
4 changes: 2 additions & 2 deletions
4
tests/e2e/tests/generate/pipe.ts → tests/e2e/tests/generate/pipe/pipe-basic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {ng} from '../../../utils/process'; | ||
import {expectToFail} from '../../../utils/utils'; | ||
|
||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => expectToFail(() => | ||
ng('generate', 'pipe', 'test-pipe', '--module', 'app.moduleXXX.ts'))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {join} from 'path'; | ||
import {ng} from '../../../utils/process'; | ||
import {expectFileToMatch} from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
const modulePath = join('src', 'app', 'app.module.ts'); | ||
|
||
return ng('generate', 'pipe', 'test-pipe', '--module', 'app.module.ts') | ||
.then(() => expectFileToMatch(modulePath, | ||
/import { TestPipePipe } from '.\/test-pipe\/test-pipe.pipe'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('test', '--single-run')); | ||
} |
4 changes: 2 additions & 2 deletions
4
tests/e2e/tests/generate/service.ts → ...e/tests/generate/service/service-basic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {ng} from '../../../utils/process'; | ||
import {expectToFail} from '../../../utils/utils'; | ||
|
||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => expectToFail(() => | ||
ng('generate', 'service', 'test-service', '--module', 'app.moduleXXX.ts'))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {join} from 'path'; | ||
import {ng} from '../../../utils/process'; | ||
import {expectFileToMatch} from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
const modulePath = join('src', 'app', 'app.module.ts'); | ||
|
||
return ng('generate', 'service', 'test-service', '--module', 'app.module.ts') | ||
.then(() => expectFileToMatch(modulePath, | ||
/import { TestServiceService } from '.\/test-service\/test-service.service'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('test', '--single-run')); | ||
} |