angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Expose the built-in karma config.

Open nicojs opened this issue 4 years ago • 5 comments

Command

test

Description

Angular 15 hides the cli config files. This is admirable, but this means that tools depending on this config cannot work. For example, StrykerJS needs this configuration. See https://github.com/stryker-mutator/stryker-js/issues/3871

Describe the solution you'd like

I would love for the cli to expose this built-in config, similar to how the vue cli exposes webpack config as a file.

An added benefit is that users of Angular 15 can expand their custom karma config upon it instead of needing to copy it entirely and make adjustments.

Describe alternatives you've considered

No response

nicojs avatar Nov 21 '22 14:11 nicojs

We did discuss this previously about either creating a file in a hidden directory or provide the option to create such file using a generate command.

Exposing the file like https://cli.vuejs.org/guide/webpack.html#using-resolved-config-as-a-file is not really something that we considered, the main reason for this is that the file is not static, and has certain settings that vary per project. Example the code-coverage directory.

alan-agius4 avatar Nov 21 '22 15:11 alan-agius4

Thanks for the fast reply 🙏

The file was static before. What exactly changed?

Looking through the code, it seems to be the workspaceRoot (used to require the plugins from) and projectName (used for the coverageFilderName). We might be able to fill both with default values from a karma.conf.js file we could ship. I could send a PR your way.

https://github.com/angular/angular-cli/blob/6f9c84bbd14d15375efec79a009e5b538b450b30/packages/angular_devkit/build_angular/src/builders/karma/index.ts#L186-L227

Btw the IntelliJ karma plugin needs this as well. They use a similar setup as StrykerJS: https://github.com/JetBrains/intellij-plugins/blob/master/js-karma/resources/js_reporter/karma-intellij/lib/intellij.conf.js#L66

nicojs avatar Nov 21 '22 21:11 nicojs

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.

angular-robot[bot] avatar Nov 22 '22 13:11 angular-robot[bot]

I've created a draft PR to illustrate a fix. Would you be comfortable with this approach?

nicojs avatar Nov 22 '22 20:11 nicojs

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.