2015-06-15 24 views
0

你好,我正在試圖對業力和茉莉花的angularjs進行單元測試。因此,我跟着這個教程: http://tech.pro/tutorial/1473/getting-started-with-angularjs-unit-testing配置karma/jasmine來測試angularjs拋出:沒有「framework:jasmine」的提供者!

在點Running Your First測試我得到,因爲一個錯誤吸:

無提供者「的框架:茉莉花」!

我對它進行了搜索並嘗試了建議的事情,例如再次安裝業力茉莉花和卡瑪鉻發射器,但沒有一個爲我工作。

我的package.json看起來是這樣的:

{ 
    "name": "projectName", 
    "version": "1.0.0", 
    "description": "a description", 
    "dependencies": { 
    "gulp": "^3.5.6", 
    "gulp-sass": "^1.3.3", 
    "gulp-concat": "^2.2.0", 
    "gulp-minify-css": "^0.3.0", 
    "gulp-rename": "^1.2.0" 
    }, 
    "devDependencies": { 
    "bower": "^1.3.3", 
    "gulp-util": "^2.2.14", 
    "jasmine-core": "^2.3.4", 
    "karma": "^0.12.36", 
    "karma-chrome-launcher": "^0.1.12", 
    "karma-jasmine": "^0.3.5", 
    "karma-safari-launcher": "^0.1.1", 
    "shelljs": "^0.3.0" 
    }, 
    "cordovaPlugins": [ 
    "org.apache.cordova.device", 
    "org.apache.cordova.console", 
    "com.ionic.keyboard" 
    ], 
    "cordovaPlatforms": [ 
    "android", 
    "ios" 
    ] 
} 

我的人緣配置karma.conf.js:

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


    // list of files/patterns to load in the browser 
    files: [ 
     'test/*/Specs.js', 
     'test/*' 
    ], 


    // 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 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: ['Chrome', 'Safari'], 


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

如果我跑karma start karma.conf.js我總是得到錯誤。我甚至改變了這兩個文件的權限而沒有任何影響。這裏有什麼問題?

+0

可能是幫助http://stackoverflow.com/questions/22367059/no-provider-for-frameworkjasmine-resolving-frameworkjasmine –

+0

我也發現這篇文章,但它並沒有爲我工作。 – Kingalione

回答

0

原來,我已經在全球安裝了業力npm install -g karma和本地業力茉莉花​​。我在全球範圍內重新安裝了業力茉莉花,現在它的工作。

相關問題