本文介绍了噶覆盖preprocessor解析不正确的CoffeeScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的code是:
$scope.$watch(->
userService.getUser()
, ->
user = userService.getUser()
$scope.authRoles = user.authRoles
)
这是pretty无害的。但是,当我跑我的测试,我得到:
which is pretty innocuous. But when I run my test, I get:
ERROR [preprocessor.coverage]: Syntax error on line 19, column 6: unexpected ',' (\u002C)
16 :
17 : $scope.$watch(->
18 : userService.getUser()
19 : , ->
^^ :~~~~~~^
20 : user = userService.getUser()
21 : $scope.authRoles = user.authRoles
22 : )
我的 karma.conf.coffee
如下:
module.exports = (config) ->
config.set
basePath: '../../'
files: [
'dist/assets/vendor.js'
'bower_components/angular-mocks/angular-mocks.js'
'public/scripts/**/*.coffee'
'test/webapp/unit/**/*.coffee'
]
preprocessors:
'public/scripts/**/*.coffee': ['coverage']
'test/webapp/unit/**/*.coffee': ['coffee']
singleRun: true
frameworks: ['jasmine']
browsers: ['PhantomJS']
reporters: ['story', 'coverage']
coverageReporter:
type: 'html'
dir: 'test/webapp/coverage/'
任何帮助吗?谢谢!
Any help? thanks!
推荐答案
的方式code覆盖的CoffeeScript完成留下了很多有待改进。它使用它仍然没有完成特定的编译器(CoffeeScriptRedux)。尝试用间距玩(怎么样缩进?多了一个等级)或提取此功能,并在这里把他们的名字。你没有太多的选择。
The way code coverage is done in coffeescript leaves a lot to be desired. It uses specific compiler (CoffeeScriptRedux) which is still not completed. Try to play with spacing (how about one more level of indent?) or extract this functions and put their names here. You have not much choice.
这篇关于噶覆盖preprocessor解析不正确的CoffeeScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!