sudo npm install -g karma
除了安装所有必要的依赖项/预处理器之外,我还成功运行。
我的业力配置文件可以看到:
module.exports = function(config) {
config.set({
rootElement: '#receiveQuote',
browsers: ['PhantomJS'],
frameworks: [
'jasmine',
'phantomjs-shim',
'fixture'
],
captureTimeout: 60000,
reportSlowerThan: 1500,
reporters: [
'progress',
'coverage'
],
preprocessors: {
'**/*.html': 'ng-html2js',
'../app/**/*.html': 'ng-html2js',
'**/*.json': 'json_fixtures',
'../app/**/*.js': [
'coverage'
]
},
files: [
// bootstrap/dependencies
'../vendor/assets/bower_components/jQuery/dist/jquery.min.js',
'../vendor/assets/bower_components/lodash/lodash.min.js',
'../app/assets/javascripts/application.js',
'../app/assets/javascripts/bootstrap.min.js',
'../vendor/assets/bower_components/angular/angular.js',
'../vendor/assets/bower_components/angular-mocks/angular-mocks.js',
'../vendor/assets/bower_components/angular-animate/angular-animate.js',
'../vendor/assets/bower_components/angular-route/angular-route.js',
'../vendor/assets/bower_components/angular-touch/angular-touch.js',
'../vendor/assets/bower_components/angular-translate/angular-translate.js',
'../vendor/assets/bower_components/ng-token-auth/dist/ng-token-auth.js',
'../vendor/assets/bower_components/angular-messages/angular-messages.js',
'../vendor/assets/bower_components/messageformat/messageformat.js',
'../vendor/assets/bower_components/angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat.js',
'../vendor/assets/bower_components/angular-aria/angular-aria.js',
'../vendor/assets/bower_components/angular-placeholder-tai/lib/tai-placeholder.js',
'../vendor/assets/bower_components/angular-sanitize/angular-sanitize.js',
'../vendor/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'../vendor/assets/bower_components/angular-ui-mask/dist/mask.js',
'../vendor/assets/bower_components/moment/moment.js',
'../vendor/assets/bower_components/sinonjs/sinon.js',
'../vendor/assets/bower_components/angular-cookie/angular-cookie.js',
// app src files
'../app/assets/javascripts/main.js',
'../app/assets/javascripts/**/*.js',
//templates
'../app/**/*.html',
//test templates
'tests/**/*.html',
'tests/fixtures/**/*.json',
//test files
'spec_helper.js',
'tests/**/*.js'
],
exclude: [
'../app/assets/javascripts/qe/**/*.js'
],
ngHtml2JsPreprocessor: {
stripPrefix: '.*app/assets/javascripts/'
},
jsonFixturesPreprocessor: {
variableName: '__json__'
},
coverageReporter: {
dir : 'coverage/',
reporters: [
{ type: 'html', subdir: 'html' },
{ type: 'text', subdir: '.', file: 'report.txt' }
]
}
});
};
当我运行时出现问题,sudo npm install -g karma-cli
我收到错误:
Refusing to delete: /usr/bin/karma not in /usr/lib/node_modules/karma-cli File exists: /usr/bin/karma
Move it away, and try again.
究竟是什么导致了这个问题?