草庐IT

gulp-jasmine

全部标签

javascript - 在一次执行中多次运行 Jasmine Spec

我想在一次执行中多次运行我的jasmine测试用例。是否有任何循环或任何其他方法在一次执行中执行特定规范。 最佳答案 您可以像这样在普通的for循环中运行规范:for(vari=0;i=0&&r如果你想用不同的参数运行它,那就有点棘手了。您必须将循环参数绑定(bind)到闭包范围,否则将始终使用循环参数的最后一个值调用测试。//WRONG:testcalled10timeswithi==10for(vari=0;i 关于javascript-在一次执行中多次运行JasmineSpec,我

javascript - 标签 Protractor + Jasmine 运行套件

我正在尝试找出一种方法,以相同的方式,或者更确切地说,以类似的方式使用cucumberJS与protractor的标记选项,但是使用Jasmine,有没有办法标记不同的场景,例如:@smoke、@regression等。然后告诉控制台与那些一起运行?我拒绝使用Cucumber,因为它的支持似乎变得不稳定了!任何帮助将不胜感激! 最佳答案 使用jasmine2,您可以使用正则表达式过滤测试。也许你可以在你的测试中添加@smoke、@regressions之类的东西,然后只通过传递grep标志来运行那些:it('shoulddostuf

javascript - 通过 gulp 从 index.html 中删除脚本

我在我们的应用程序中使用gulp,我们在Gulpfile.js中有2个流程,一个用于生产,第二个用于开发,但我不想保留2个index.html文件,例如index.html和index.dev。html,我想要一个index.html文件,但是对于生产构建,我有一些不需要的脚本,例如.问题是:如何通过Gulp从html中删除某些内容? 最佳答案 您可以使用专用于此特定目的的gulp-html-replace插件:https://www.npmjs.org/package/gulp-html-replace

javascript - Gulp:如何按顺序组合任务?

我需要通过顺序处理不同的源来组合gulp任务,因为它们之间存在依赖关系。根据文档,这应该完成我的合并流,但我看不到如何强制对它们进行排序和序列化。在Gulp3中建模的正确方法是什么?我通常使用函数作为各个构建步骤的容器,然后从构建和监视任务中调用它们:functionbuildModule(module){varstreams=[];//steponestreams.push(gulp.src(path.join('./modules',module,'*.js'))//...seriesofchainedcalls);//steptwostreams.push(gulp.src([T

javascript - 在 Jasmine 测试中 stub e.preventDefault()

我最近在我的一个javascript函数中添加了一个e.preventDefault(),它破坏了我的jasmine规范。我试过spyOn(e,'preventDefault').andReturn(true);但我得到eisundefined错误。如何stube.preventDefault()?showTopic:function(e){e.preventDefault();midParent.prototype.showTopic.call(this,this.model,popup);this.topic.render();}it("callstheparent",functi

javascript - 使用 gulp 进行丑化时,Angular-ui-router 会中断

我有以下简单的angular.js应用程序,遵循概述的最佳实践here.angular.module('myApp',['ui.router']);(function(){functionroutes($stateProvider,$urlRouterProvider){$urlRouterProvider.otherwise("/404");$stateProvider.state('createCluster',{url:'/create-cluster',templateUrl:'templates/create-cluster.html'})}angular.module('m

javascript - 我用 gulp 收到 Malloc 错误

有趣的是我是如何使用gulp得到内存分配错误的,不管错误的输出是什么:gulpcompile:development[15:33:51]Warning:gulpversionmismatch:[15:33:51]Globalgulpis3.8.7[15:33:51]Localgulpis3.8.6[15:33:52]Usinggulpfile~/Dropbox/AisisGit/Zen/gulpfile.js[15:33:52]Starting'bower'...[15:33:52]Usingcwd:./[15:33:52]Usingbowerdir:./bower_component

javascript - 使用 Jasmine 2.0 对 $scope.$evalAsync 函数进行单元测试

我正在尝试对$scope.$evalAsync函数进行单元测试。这是我的代码:$scope.$evalAsync(function(done){//enablethepopoverplugindone();jQuery('[data-toggle="popover"]').popover();$scope.isKioskIdLoaded.state=true;});我很难理解如何让evalAsync在我的Jasmine测试中运行。我正在尝试利用Jasmine2.0中的done()函数。 最佳答案 您需要将$scope.$digest

javascript - Gulp 监视任务不会在 Ctrl C 上退出

背景我有这个gulpwatch任务来处理sass编译:importgulpfrom'gulp';importsassfrom'gulp-sass';importconcatfrom'gulp-concat';gulp.task("compile-scss",()=>{returngulp.src("assets/scss/**/*.scss").pipe(sass({outputStyle:'compressed'}).on("error",sass.logError)).pipe(concat("style.css")).pipe(gulp.dest("dist/css"));});

javascript - 如何使用 Jasmine 在 AngularJS 中为数组函数创建单元测试

我有xf数组:varxf=[];我有一个函数是这个数组中的一个元素和一个使用它的函数:$scope.checkEmailValid=function(){varresult=false;Iif(xf.validateEmail($scope.email,'256')){result=true;}returnresult;};xf.validateUsername=function(sText){varisValid=false;do{//Checkforvalidstring.isValid=typeofsText==='string';if(!isValid){break;}//Ch