草庐IT

run-jasmine

全部标签

javascript - 如何处理 "a script on this page is causing internet explorer to run slowly"警报?

我正在从javascript调用网络方法。在IE中,如果我向该Web方法传递一个巨大的参数,则会弹出警告“停止运行此sciprt?此页面上的脚本导致InternetExplorer运行缓慢”。是否可以处理"is"按钮上的点击,以便如果用户决定取消脚本执行我可以运行一些替代脚本(在这种情况下,我的“替代”脚本包括关闭一些进度条我在运行长时间脚本之前弹出)。我看过很多解释如何防止显示此警报的帖子,但我不想停止显示警报:我只想能够处理用户决定停止显示的情况脚本执行。 最佳答案 我之前在一个内部应用程序中处理过这个问题,他们不关心浏览器处理

javascript - 如何监视 Jasmine 中的自定义事件?

我定义了一个自定义事件。我想用Jasmine来窥探它。但我遇到的问题是,当我使用spyOn监视该事件时,它失败了。当我监视某些功能时,它工作正常。这是我尝试过的:describe("Test:",function(){it("Expectseventwillbespied:",function(){vareventSpy=spyOn(window,'myEvent').andCallThrough();expect(eventSpy).toHaveBeenCalled();//Alsotriedthis://expect(eventSpy).not.toHaveBeenCalled()

javascript - npm run dev 命令不适用于 vuejs 的 hackernews 示例

我正在尝试从vuejs的githubrepository运行vue-hackernews-2.0示例在设置部分,它解释了如何安装项目:#installdependenciesnpminstall#oryarn#serveindevmode,withhotreloadatlocalhost:8080npmrundev#buildforproductionnpmrunbuild#serveinproductionmodenpmstart我安装了npm。在server.js中将端口更改为8888后,我在命令行中键入“npmrundev”。>vue-hackernews-2.0@devD:\U

javascript - npm run build 失败并显示 "Error: custom keyword definition is invalid: data.errors should be boolean"

当我尝试构建VueJS应用程序时,我发现npm出错。我在GitLabCI的build阶段看到这个错误。我找不到任何关于错误消息的提及。我以前能够成功运行npmrunbuild并且我没有对Vue应用程序代码进行任何更改,所以我不确定是什么导致了这个错误。-Buildingforproduction...ERRORError:customkeyworddefinitionisinvalid:data.errorsshouldbebooleanError:customkeyworddefinitionisinvalid:data.errorsshouldbebooleanatAjv.addK

javascript - 为什么 jasmine-node 找不到我的规范文件?

我已经使用npm安装了jasmine-node。我的项目目录结构如下:|-lib\|-taxCalc.js|-spec\|-taxCalc.spec.coffee|-taxCalc.spec.js|-src\|-taxCalc.coffee当我使用以下命令(对于CoffeeScript)从根文件夹运行jasmine-node时:jasmine-node--coffee--verbosespecFinishedin0.015seconds0tests,0assertions,0failures如果我运行JavaScript版本,则相同。如果我明确指向spec文件测试运行正常:jasmin

javascript - 是否可以在一个函数中定义一个 Jasmine 规范并且仍然有 beforeEach 应用于它?

我有很多几乎相同的测试。为了DRY和可扫描性,我想将测试抽象为一个函数,然后使用一些参数调用该函数。然后该函数将调用它并将规范添加到套件中。它似乎可以工作,除了规范不会以与其他规范相同的方式运行,并且beforeEach不会在公共(public)函数中定义的规范之前被调用。define(['modules/MyModule','jasmine/jasmine'],function(MyModule){describe('myModule',function(){functioncommonTests(params){it('shouldpassthistestOK',function(

javascript - 让 Jasmine 在服务器端运行

我正在尝试开始使用Node.JS在服务器端测试JavaScript我正在使用grunt,和grunt-jasmine-node,但我无法让它运行我的测试。它只是记录PSC:\Development\NET\Source\jsn>gruntRunning"jasmine_node"taskundefinedFinishedin0.001seconds0tests,0assertions,0failuresDone,withouterrors.这是我的Gruntfile.jsmodule.exports=function(grunt){grunt.initConfig({pkg:grunt

javascript - jquery-jasmine - 夹具无法加载

我正在尝试加载一些固定装置以进行测试。至此我已经准备好了一个json文件。我确实设置了应该加载特定文件的beforeEach函数,但出现错误:Error:Fixturecouldnotbeloaded:tests/license_filter/license_test_data.json(status:error,message:undefined)部分测试函数:beforeEach(function(){jasmine.getFixtures().fixturesPath='tests/license_filter';loadFixtures('license_test_data.j

javascript - Jasmine Controller 测试,预计 spy 已被调用

我在AngularJSController中定义了一个方法,该方法在初始化时调用。我想使用Jasmine("jasmine-core":"^2.3.4","karma":"^0.12.37")测试它。我遵循了Internet上的一些教程和StackOverflow问题,但找不到正确的答案。请看一下这段代码:ControllerusersAddUserController:(function(){'usestrict';angular.module('app.users.addUser').controller('usersAddUserController',['$scope','us

javascript - AngularJs Jasmine 单元测试中的 $httpBackend

我无法让我的单元测试正常工作。我有一个开始为空的$scope数组,但应该用$http.get()填充。在真实环境中,数组中大约有15个左右的对象,但对于我的单元测试,我只抓取了2个。对于单元测试,我有:expect($scope.stuff.length).toBe(2);但jasmine的错误是:Expected0tobe2.这是我的controller.js:$scope.stuff=[];$scope.getStuff=function(){varurl=site.root+'api/stuff';$http.get(url).success(function(data){$sc