computmaxer / karma-jspm

Other
74 stars 52 forks source link

Cannot start karma #161

Closed hadrienl closed 8 years ago

hadrienl commented 8 years ago

Hi,

I'm trying to start karma test with jspm to use it with this scaffold. But karma cannot start like I described it in this issue. So I tried to make karma-jspm work with an empty project. And it doesn't work neither.

I have the following package.js:

{
  "name": "test-jspm-karma",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel": "^6.5.2",
    "jspm": "^0.16.39",
    "karma": "^0.13.22",
    "karma-jspm": "^2.1.1",
    "karma-phantomjs-launcher": "^1.0.0",
    "phantomjs-prebuilt": "^2.1.7"
  }
}

and this karma.conf:

// Karma configuration
// Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST)

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: ['jspm', 'jasmine'],

    plugins: ['karma-jspm', 'karma-phantomjs-launcher'],

    jspm: {
      // Edit this to your needs
      loadFiles: ['src/**/*.js', 'test/**/*.js']
    },

    // list of files / patterns to load in the browser
    files: [],

    // 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: {
      'test/**/*.js': ['babel'],
      'src/**/*.js': ['babel']
    },
    'babelPreprocessor': {
      options: {
        sourceMap: 'inline',
        modules: 'system',
        moduleIds: false,
        optional: [
          "es7.decorators",
          "es7.classProperties"
        ]
      }
    },

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

    // 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: false
  });
};

Then, when I karma start :

karma start
(node:27514) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
WARN [plugin]: Cannot find plugin "karma-jspm".
  Did you forget to install it ?
  npm install karma-jspm --save-dev
/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9
      throw error('No provider for "' + name + '"!');
      ^

Error: No provider for "framework:jspm"! (Resolving: framework:jspm)
    at error (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:22:12)
    at Object.parent.get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9:13)
    at get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:54:19)
    at /usr/local/lib/node_modules/karma/lib/server.js:29:14
    at Array.forEach (native)
    at start (/usr/local/lib/node_modules/karma/lib/server.js:28:21)
    at invoke (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
    at Object.exports.start (/usr/local/lib/node_modules/karma/lib/server.js:307:12)
    at Object.exports.run (/usr/local/lib/node_modules/karma/lib/cli.js:220:27)
    at Object.<anonymous> (/usr/local/lib/node_modules/karma/bin/karma:3:23)
hadrienl commented 8 years ago

Well… I've tried with local binary (./node_modules/.bin/karma start) and it worked… so nevermind.