karma-jasmine icon indicating copy to clipboard operation
karma-jasmine copied to clipboard

Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)

Open onlywei opened this issue 7 years ago • 3 comments

Hi guys, is the documentation for this wrong or something?

If I do this:

// karma.conf.js
module.exports = function(config) {
  config.set({
    frameworks: ['jasmine'],
  });
}

I get the error:

Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)

But if I add karma-jasmine to plugins as well, it works:

// karma.conf.js
module.exports = function(config) {
  config.set({
    plugins: ['karma-jasmine'],
    frameworks: ['jasmine'],
  });
}

Why do I need it in both?

onlywei avatar Apr 05 '18 19:04 onlywei

AFAICT, the 'plugins' entry is a list of npm modules, it tells karma what node modules to load. The frameworks entry is telling jasmine what to expect from some plugin. So your error occurs because you declared that you want to use jasmine framework but did not list an npm module in plugings that provides jasmine.

It appears that the design supports listing lots of plugins but then selecting one or more of them with frameworks. I don't understand why the existence of a plugin karma-jasmine is not enough.

But you reported this a documentation bug: which page are you reading that is incorrect?

johnjbarton avatar Apr 06 '18 23:04 johnjbarton

The version that @onlywei reported as not working is taken almost directly from the "Configuration" section of the karma-jasmine README.md, which tells the user to populate the "frameworks" section but doesn't mention the plugins anywhere.

mdb07a avatar May 03 '18 20:05 mdb07a

Your pull request to improve the readme would be welcomed.

johnjbarton avatar May 03 '18 20:05 johnjbarton