2013-04-26 31 views
2

我終於決定從易俗(0.4.0)遷移到業力0.8.5。我的測試是用CoffeeScript編寫的Jasmine。遷徙到業力

這裏是karma start path/to/karma.conf.js輸出:

INFO [karma]: Karma server started at http://localhost:9876/ 
INFO [launcher]: Starting browser Chrome 
INFO [Chrome 26.0 (Mac)]: Connected on socket id MOOnxLR89NKLGrrzbTI_ 

Chrome 26.0 (Mac) ERROR 
Uncaught SyntaxError: Unexpected string 
at /Users/genghis/Projects/chirper/client/test/spec/authenticationSpec.coffee:1 
Chrome 26.0 (Mac): Executed 0 of 0 ERROR (1.246 secs/0 secs) 

望着調試器控制檯,還有每個測試文件類似的錯誤。我配置了預處理器,但似乎coffeescript沒有被編譯?這裏是我的karma.conf.js

basePath = ''; 

files = [ 
    JASMINE, 
    JASMINE_ADAPTER, 
    '../app/components/angular/angular.js', 
    '../app/components/angular-mocks/angular-mocks.js', 
    '../app/scripts/*.js', 
    '../app/scripts/**/*.js', 
    '../app/components/socket.io-client/dist/socket.io.js', 
    '../test/spec/**/*.coffee' 
]; 

exclude = []; 
reporter = 'progress'; 
port = 9876; 
runnerPort = 9100; 
colors = true; 
logLevel = LOG_INFO; 
autoWatch = true; 
browsers = ['Chrome']; 
singleRun = false; 

preprocessors = { 
    '**/*.coffee': 'coffee' 
}; 

任何想法?提前致謝!

UPDATE:

我可以通過運行帶有節點CLI的CS測試文件重現錯誤。所以顯然咖啡標記沒有被編譯。該文件的第一行(失敗)如下所示:

describe 'Authentication', -> 

回答

0

reporter ='progress';

應該是

reporter = ['progress'];

而且,你的錯誤就在於投機/ authenticationSpec.coffee

+0

感謝您的注意。我試過了,但得到了同樣的錯誤。 – 2013-04-26 20:17:22

1

編輯:嘗試指定預處理器時改變'coffee'['coffee']

對於未來人士:

我也在爲此而苦苦掙扎。

我不能告訴你使它工作的確切修復,但這裏是我的配置文件。 (這是在咖啡館,但不應該有所作爲,除了將它保存爲.coffee)。

注意我已經明確設置了插件,coffeePreprocessor,預處理器和basePath的具體值。

# Karma configuration 

module.exports = (config) -> 
    config.set({ 

     basePath: '../', 

     frameworks: ['jasmine'], 

     preprocessors: { 
      '**/*.coffee': ['coffee'] 
     }, 

     coffeePreprocessor: { 
      # options passed to the coffee compiler 
      options: { 
      bare: true, 
      sourceMap: false 
      }, 
      # transforming the filenames 
      transformPath: (path) -> 
      return path.replace('.js', '.coffee') 
     }, 

     files: [ 
      'app/assets/vendor/angular.js' 
      'app/assets/vendor/angular-mocks.js' 
      'app/assets/javascript/*.coffee' 
      'spec/clientjs/**/*Spec.*', 

     ], 

     reporters: ['progress'], 

     port: 9876, 

     colors: true, 

     logLevel: config.LOG_INFO, 


     plugins: [ 
      'karma-coffee-preprocessor', 
      'karma-jasmine', 
      'karma-chrome-launcher'] 

     autoWatch: true, 

     browsers: ['Chrome'], 

     captureTimeout: 60000, 

     singleRun: false 
    })