-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(test): Add --config-file flag option to ng test
command
#1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I don't feel this is the correct approach to handle this scenario... I think the option to define the location of a default config file should be set within the Also, prior to merging this will need to be consolidated down to a single commit. |
I agree with you on that, and that behavior will remain the same for identifying the default path for the karma config file. This optional flag will give the developer the option to specify a path for different karma config file when using |
Having an option in |
Please update this PR after rebasing on latest master |
@Brocco for this feature merge, are you expecting for the dev to define for example a staging environment test file and they could then define that in their project config file as follows: |
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
CLAs look good, thanks! |
The config flag on the `ng test` command allows for users to refer to a different configuration file for Karma based on the path in the config flag.
Made the requested changes and committed
…On Wed, Nov 23, 2016 at 9:12 PM, Mike Brocchi ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Please make the suggested change and appropriate e2e tests.
------------------------------
In packages/angular-cli/tasks/test.ts
<#1102 (review)>
:
> @@ -13,7 +13,8 @@ export default Task.extend({
const projectRoot = this.project.root;
return new Promise((resolve) => {
const karma = requireDependency(projectRoot, 'karma');
- const karmaConfig = path.join(projectRoot, this.project.ngConfig.config.test.karma.config);
+ const karmaConfigFile = this.project.ngConfig.config.test.karma[options.config];
I don't think this should be looking the path up in the config file. The
default file location will suffice, just need to update the content of that
file if different configuration is needed. If an alternative (read:
secondary) config file is needed, for whatever reason than the path to the
new config file is what should be supplied with the --config option.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1102 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJ9WvTMxaYTsJOfmBHBaC_qXwOsguMx0ks5rBPKmgaJpZM4I282C>
.
--
*Marc Sensenich*
email: [email protected]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One little nit. I like this approach more than the e2e. Also, make sure to use the proper path separator in Windows.
return ng('test', '--single-run') | ||
.then(() => ng('test', '--watch=false')); | ||
.then(() => ng('test', '--watch=false')) | ||
.then(() => ng('test', '--watch=false', `--config=${karmaConfigPath}`)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to have a test for an alternative configuration, not just the default one.
#4564 got merged meanwhile. Sorry it wasn't your PR instead, which was much older :/ |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Allow for users to optionally specify a path to a karma config file on the
ng test
command whichwill allow for the usage of a karma config file different from that set as the default in the
angular-cli.json file
Fixes: #976