我似乎有讓我的茉莉花單元測試,實際執行的問題。我已經驗證了我的所有腳本都得到通過設置日誌級別到LOG_DEBUG加載。我的單元測試是相同的服務測試@https://github.com/angular/angular-seed/blob/master/test/unit/servicesSpec.js。噶不執行任何單元測試
而且,我已經使用Testacular(之前它改名爲噶),我不記得有這個問題。我似乎讓Chrome運行,但我不得不手動點擊「調試」按鈕。即使我點擊這個按鈕,我的測試也不會運行。
系統細節:
- Windows 7的
- 節點v0.10.4
- 鉻26.0.14
- 噶0.8.5(安裝了3個警告 - 2所損失的精度和一個'沒有定義內聯函數v8 :: Persistent v8 :: Persistent :: New(v8 :: Handle)')
這是我的模塊代碼(腳本/ main.js):
angular.module('sb.services', []).value('version', '0.0.1').value('amplify', amplify);
angular.module('sb.directives', []);
angular.module('sb.filters', []);
angular.module('sb.controllers', []).controller('SbController', [
'$scope',
'amplify',
function ($scope, amplify) {
$scope.message = 'Hello World! (amplify exists?=' + !!amplify + ')';
}
]);
angular.module('sb', [
'sb.services',
'sb.directives',
'sb.filters',
'sb.controllers'
]);
這裏是我的規格(測試/單位/ servicesSpec.js):
'use strict';
describe('my services', function() {
beforeEach(module('sb.services'));
describe('version', function() {
it('should return current version', inject(function(version) {
expect(version).toEqual('0.0.1');
}));
});
});
這是我的karma.conf.js文件:
// Karma configuration
// Generated on Mon Apr 15 2013 20:56:23 GMT-0400 (Eastern Daylight Time)
// base path, that will be used to resolve files and exclude
basePath = '';
// list of files/patterns to load in the browser
files = [
JASMINE,
JASMINE_ADAPTER,
'Vendor/angular-1.0.6/angular.js',
'Vendor/angular-1.0.6/angular-*.js',
'Vendor/json2/json2.js',
'Vendor/jquery/jquery-1.8.2.js',
'Vendor/amplify/amplify.js',
'Scripts/main.js',
'Test/unit/*.js'
];
// list of files to exclude
exclude = [
];
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters = ['progress'];
// web server port
port = 9876;
// cli runner port
runnerPort = 9100;
// enable/disable colors in the output (reporters and logs)
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_WARN;
// enable/disable watching file and executing tests whenever any file changes
autoWatch = false;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers = ['Chrome'];
junitReporter = {
outputFile: 'Test/out/unit.xml',
suite: 'unit'
};
// If browser does not capture in given timeout [ms], kill it
captureTimeout = 60000;
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = false;
我想我有這個漂亮的晚了,但我認爲你必須設置要麼'singleRun'或'autoWatch'爲true。 – fodma1