我正在尝试使用业力编写单元测试。我的申请,我已经通过亭子安装Karma为Angular和JQuery映射文件抛出“Uncaught SyntaxError:Unexpected token:”
"dependencies": {
.....
"angular": "1.2.16",
.....
"jquery": "~1.11.2",
.....
}
这里AngularJS和JQuery与其中包含一些设置键值对的.MAP文件中捆绑的角度和JQuery的依赖。要将这些映射文件加载到Karma中,我找到了一个名为karma-sourcemap-loader
的插件。我已经使用了以下配置因缘即karma.conf.js
files: [
{pattern: 'vendor/jquery/dist/jquery.min.js',included:true},
{pattern: 'vendor/jquery/dist/jquery.min.map',watched: true, served: true, included: true},
{pattern: 'vendor/angular/angular.min.js',included:true},
{pattern: 'vendor/angular/angular.min.js.map',watched: true, served: true, included: true},
......
],
preprocessors: {
'**/*.js': ['sourcemap']
},
当我检查了铬,控制台已经打印出以下错误 Resource interpreted as Script but transferred with MIME type text/plain: "http://localhost:9876/base/vendor/angular/angular.min.js.map?5ff6288d0408a1b41c74b7bd7541d68865d1e3f9
在控制台它显示了
Uncaught SyntaxError: Unexpected token :
为Chrome
SyntaxError: Parse error
为PhantomJS
而且我使用RequireJS导入文件。任何人都可以通过提供一个适当的方式来包括地图文件在业力中帮助我吗?