Skip to content
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

Angular v11 ignores karma plugin config karma-* and throws error #19993

Closed
2 of 15 tasks
iftee-hussain opened this issue Feb 7, 2021 · 1 comment · Fixed by #19994
Closed
2 of 15 tasks

Angular v11 ignores karma plugin config karma-* and throws error #19993

iftee-hussain opened this issue Feb 7, 2021 · 1 comment · Fixed by #19994

Comments

@iftee-hussain
Copy link
Contributor

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

karma-coverage was made required in angular 11 and strict checking of karma-coverage was also introduced in v11. So, no it is not a regression

Description

According to https://karma-runner.github.io/6.1/config/configuration-file.html

List of plugins to load. A plugin can be a string (in which case it will be required by Karma) or an inlined plugin - Object. By default, Karma loads all sibling NPM modules which have a name starting with karma-*.

I have added karma-coverage in package.json and installed it
and added karma-* to the plugins config in karma.conf.js
Angular cli ignores the installed package as it seems karma-* config is ignored while validating karma-coverage is installed
It works when in plugins configuration one of these is added
'karma-coverage' or require('karma-coverage')

🔬 Minimal Reproduction

  1. Add karma-coverage in package.json and install it (npm install)
"karma-coverage": "^2.0.3",
  1. Add 'karma-*' in karma.conf.js . Example:
plugins: [
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
    ]
  1. Run tests ng test

🔥 Exception or Error



 ERROR [karma-server]: Server start failed on port 9876: Error: karma-coverage must be installed in order to run code coverage.

🌍 Your Environment




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.1.1
Node: 12.16.1
OS: linux x64

Angular: 11.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router, upgrade
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.7
@angular-devkit/build-angular   0.1100.7
@angular-devkit/core            10.1.7
@angular-devkit/schematics      11.0.7
@angular/cdk                    9.2.4
@schematics/angular             11.0.7
@schematics/update              0.1101.1
ng-packagr                      10.1.2
rxjs                            6.6.3
typescript                      4.1.3

Anything else relevant?

iftee-hussain added a commit to iftee-hussain/angular-cli that referenced this issue Feb 7, 2021
Previouslt `karma-coverage` was validated only when in karma plugins config one of these was added
``'karma-coverage'` or `require('karma-coverage')`

This change will allow cli to validate `karma-coverage` plugin if in `karma.conf.js` `'karma-*'` is used. Example:
```
plugins: [
      ...
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
      ...
    ]
```

Fixes angular#19993
iftee-hussain added a commit to iftee-hussain/angular-cli that referenced this issue Feb 7, 2021
…onfig

Previously `karma-coverage` was validated only when in karma plugins config one of these was added
``'karma-coverage'` or `require('karma-coverage')`

This change will allow cli to validate `karma-coverage` plugin if in `karma.conf.js` `'karma-*'` is used. Example:
```
plugins: [
      ...
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
      ...
    ]
```

Fixes angular#19993
@ngbot ngbot bot modified the milestone: needsTriage Feb 7, 2021
@alan-agius4 alan-agius4 added the freq1: low Only reported by a handful of users who observe it rarely label Feb 7, 2021
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Feb 7, 2021
iftee-hussain added a commit to iftee-hussain/angular-cli that referenced this issue Feb 8, 2021
…onfig

Previously `karma-coverage` was validated only when in karma plugins config one of these was added
``'karma-coverage'` or `require('karma-coverage')`

This change will allow cli to validate `karma-coverage` plugin if in `karma.conf.js` `'karma-*'` is used. Example:
```
plugins: [
      ...
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
      ...
    ]
```

Fixes angular#19993
clydin pushed a commit that referenced this issue Feb 8, 2021
…onfig

Previously `karma-coverage` was validated only when in karma plugins config one of these was added
``'karma-coverage'` or `require('karma-coverage')`

This change will allow cli to validate `karma-coverage` plugin if in `karma.conf.js` `'karma-*'` is used. Example:
```
plugins: [
      ...
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
      ...
    ]
```

Fixes #19993
clydin pushed a commit that referenced this issue Feb 8, 2021
…onfig

Previously `karma-coverage` was validated only when in karma plugins config one of these was added
``'karma-coverage'` or `require('karma-coverage')`

This change will allow cli to validate `karma-coverage` plugin if in `karma.conf.js` `'karma-*'` is used. Example:
```
plugins: [
      ...
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
      ...
    ]
```

Fixes #19993

(cherry picked from commit a7ffce1)
clydin pushed a commit that referenced this issue Feb 8, 2021
…onfig

Previously `karma-coverage` was validated only when in karma plugins config one of these was added
``'karma-coverage'` or `require('karma-coverage')`

This change will allow cli to validate `karma-coverage` plugin if in `karma.conf.js` `'karma-*'` is used. Example:
```
plugins: [
      ...
      'karma-*',
      require('@angular-devkit/build-angular/plugins/karma'),
      ...
    ]
```

Fixes #19993

(cherry picked from commit a7ffce1)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants