angular.js - angular 指令中包含webworker 在单元测试中一直报找不到worker 文件错误 如何解决?
问题描述
//directive.js var option = { ’typeNumber’: 4, ’errorCorrectLevel’:’L’, ’text’: $scope.text }$scope.worker = new Worker(’/js/myworkers.js’);$scope.myworker.postMessage(option);//test.jsdescribe(’Directives test’, function(){ var $compile, $scope, $templateCache, $httpBackend,workerValue,$timeout; beforeEach(module(’directives’)); ... ... ...it(’qrcode test’, function(){$httpBackend.expectGET(’webroot/js/myworkers.js’).respond(200,’woker’);var link = $compile(’<my-qrcode value='qrcode_text' change='false'></my-qrcode>’);var element = link($scope);$scope.$digest();console.log(element.html());//expect(element.html()).toEqual(workerValue)});//karma.conf.js... // list of files / patterns to load in the browser files: [ ’testjs/jquery.js’, ’webroot/js/lib/angular/angular.js’, ’webroot/js/lib/angular/angular-route.js’, // ’webroot/js/lib/angular/angular-animate.js’, ’webroot/js/lib/angular/angular-resource.js’, ’webroot/js/lib/angular/angular-sanitize.js’, ’webroot/js/lib/angular/*.min.js’, ’webroot/js/lib/bootstrap-ui/*.js’, // ’webroot/js/lib/angular/angular-loader.js’, ’webroot/js/lib/angular/angular-mocks.js’, ’webroot/js/myworkers.js’, ’webroot/js/bootstrap.js’, ’webroot/js/services.js’, ’webroot/js/directives.js’, ’webroot/js/filters.js’, ’webroot/js/app.js’, ’webroot/js/controllers.js’, ’testjs/*.js’ ], ...
报错报错提示
][2]
debug中的 resource

我看到有人说 这样就可以了但是现在不行 谁能说说这是什么情况吗??怎么解决呢??
问题解答
回答1:..把路径写好就好了。。。。 new work('base/webroot/js/myworker.js')
相关文章:
1. centos下mysql启动报错2. 乱码 - VS2013+PTVS,python编码问题3. linux - 编译安装mysql 5.6.234. MYSQL中如何把SELECT A AS B中的B作为WHERE筛选条件5. 前端 - 微信浏览器 css3圆角问题6. sqlserver - mysql如何将数据库文件备份出来?7. mysql - 求一个sql语句,比较简单。8. mysql - 这种分级一对多,且分级不平衡的模型该怎么设计表?9. python - 如何让dataframe A 的一列与dataframe B的一列相减 相加结果记到A的c列?10. 数据库 - mysql中怎样修改带点的字段名的位置?

网公网安备