侃侃尔雅
只需要在Karma中定义好配置文件启动它,接下来它就会在预期的测试环境下的自动执行测试用例。你可以在配置文件中制定相关的测试环境。angular-seed,是我强烈推荐的可以快速实施的方案。在我近期的项目中Karma 的配置如下:module.exports = function(config) {config.set({basePath: '../',files: ['app/lib/angular/angular.js','app/lib/angular/angular-*.js','app/js/**/*.js','test/lib/recaptcha/recaptcha_ajax.js','test/lib/angular/angular-mocks.js','test/unit/**/*.js'],exclude: ['app/lib/angular/angular-loader.js','app/lib/angular/*.min.js','app/lib/angular/angular-scenario.js'],autoWatch: true,frameworks: ['jasmine'],browsers: ['PhantomJS'],plugins: ['karma-junit-reporter','karma-chrome-launcher','karma-firefox-launcher','karma-jasmine','karma-phantomjs-launcher'],junitReporter: {outputFile: 'test_out/unit.xml',suite: 'unit'}})}