2013-10-30 40 views
1

噶角單元測試轉輪失敗,不運行任何測試,只是示出了(在CLI):噶角單元測試轉輪失敗無明顯原因沒有明顯的原因

Chrome 30.0.1599 (Linux) ERROR Uncaught SyntaxError: Unexpected token < at /home/Documents/Projects/angular/app/index.html:2 Chrome 30.0.1599 (Linux): Executed 0 of 0 ERROR (0.314 secs/0 secs)

但index.html文件只是標準..在它與應用程序完美運行。和 「攻擊線」 只是:

<!DOCTYPE html>

瀏覽器顯示只有默認:

噶v0.10.2 - 連接 鉻30.0.1599(Linux)的閒置

最的文件只是從角度種子。我證實,即使我在controllerSpec.js評論的一切到原來的狀態,我得到同樣的錯誤信息:

這是(我試過註釋的東西)的karma.config:

module.exports = function(config){ 
    config.set({ 
    basePath : '../', 

    files : [ 
     'app/lib/angular/angular.js', 
     'app/lib/angular/angular-resource.js', 
     'test/lib/**/*.js', 
     'test/lib/angular/**/*.js', 

//  'app/lib/bootstrap-gh-pages/assets/rainbow.js', 
     'app/lib/jquery/jquery.js', 
//  'app/lib/**/*.js', 
     'app/js/**/*.js', 

     'test/unit/**/*.js', 
     'app/index.html' 
    ], 

    autoWatch : true, 

    frameworks: ['jasmine'], 

    browsers : ['Chrome'], //fails with Firefox also 


    plugins : [ 
      'karma-junit-reporter', 
      'karma-chrome-launcher', 
      'karma-firefox-launcher', 
      'karma-jasmine', 
      'karma-coverage' 
      ], 

    junitReporter : { 
     outputFile: 'test_out/unit.xml', 
     suite: 'unit' 
    }, 

     reporters:['coverage','dots'], //also tried 'progress' removing 'coverage' and removing the while reporters block. nothing helped 


     preprocessors : { 
     '**/js/*.js': 'coverage' 
    }, 

//  

})} 

這是run-test.sh:

/斌/慶典

BASE_DIR = dirname $0

echo "" 
echo "Starting Karma Server (http://karma-runner.github.io)" 
echo "-------------------------------------------------------------------" 

karma start $BASE_DIR/../config/karma.conf.js $* 

沒有測試實際運行。我看到 e2e運行腳本確實有效。

任何線索? (運行在Ubuntu 13上) 我很樂意爲您提供幫助!

回答

2

套件失敗,因爲您在文件中包含了一個html文件。 <是一個意想不到的JavaScript字符。只有JavaScript文件應該在文件列表中。

+0

也可以添加json文件。用於夾具(模擬數據)。 – Markus