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

Issue using plugin #63

Closed
mikeerickson opened this issue May 17, 2016 · 6 comments
Closed

Issue using plugin #63

mikeerickson opened this issue May 17, 2016 · 6 comments

Comments

@mikeerickson
Copy link

If i have the plugin defined

plugins: ['karma-mocha-reporter']

I receive the following error (remove this line and all works just fine as expected) Curious what functionality does the plugin supply


/home/merickson/code/angular/angular-sandbox/node_modules/di/lib/injector.js:9
      throw error('No provider for "' + name + '"!');
      ^

Error: No provider for "framework:mocha"! (Resolving: framework:mocha)
@4kochi
Copy link
Collaborator

4kochi commented May 17, 2016

I am not sure if it's a problem with the reporter, because it is registered as reporter

'reporter:mocha'

It seems more like the testing framework mocha is missing. (karma-mocha)

Can you please share your complete config for further investigations.

@mikeerickson
Copy link
Author

Here you go (and karma-mocha is installed). It all works fine so long as I dont reference it in the plugin. Also included a screenshot of installed modules

// karma.conf.js
// Created: 5/9/2016 1:07 PM
// =============================================================================

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha','sinon','chai-things','chai'],


    // list of files / patterns to load in the browser
    files: [
      'node_modules/angular/angular.js',
      'node_modules/angular-mocks/angular-mocks.js',
      'dist/bundle.js',
      'src/**/*.spec.js',
      'dist/_index.html',
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'src/**/*.html': ['ng-html2js'],
      'src/**/!(*.mock|*.spec).js': ['coverage']
    },


    ngHtml2JsPreprocessor: {
      // strip this from the file path
      stripPrefix: 'src/',
      // create a single module that contains templates from all the files
      moduleName: 'templates'
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['mocha','coverage'],


    superDotsReporter: {
      icon: {
        success : ' ✔ ',
        failure : ' ✖ ',
        ignore  : ' ℹ '
      }
    },

    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    },


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['PhantomJS'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true
  });
};

karma-modules

@4kochi
Copy link
Collaborator

4kochi commented May 17, 2016

Could it be that your plugins section looks like this:

plugins: [
  'karma-mocha-reporter'
]

If so, karma only loads the reporter plugin but not the others, so karma-mocha is not loaded. So either you remove the plugin section from the config and karma takes care of loading all plugins. Or if you specify the plugins section, you have to enter all plugin names.

@mikeerickson
Copy link
Author

Yep, that seemed to be the issue. Just had to specifically list all the plugins and all worked.

But, the reporter doesnt look much different than the existing mocha reporter karma-mocha?

@4kochi
Copy link
Collaborator

4kochi commented May 17, 2016

I am not aware that karma-mocha ships it's own reporter. I thought it's only the test framework and the default karma reporter is used.

@mikeerickson
Copy link
Author

@4kochi yes, you are indeed correct. My bad ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants