-
Notifications
You must be signed in to change notification settings - Fork 12k
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 (#3811)
Closes #3806
- Loading branch information
1 parent
ba477d3
commit e2b051f
Showing
15 changed files
with
209 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('build')); | ||
} |
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,14 @@ | ||
import {ng} from '../../../utils/process'; | ||
import {join} from 'path'; | ||
import {expectFileToExist} from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
const directiveDir = join('src', 'app'); | ||
return ng('generate', 'directive', 'test-directive') | ||
.then(() => expectFileToExist(join(directiveDir, 'test-directive.directive.ts'))) | ||
.then(() => expectFileToExist(join(directiveDir, 'test-directive.directive.spec.ts'))) | ||
|
||
// 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.directive'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('build')); | ||
} |
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.pipe'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('build')); | ||
} |
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.service'/)) | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('build')); | ||
} |