草庐IT

gulp-karma

全部标签

javascript - Gulp.js 以特定顺序阻塞运行任务

使用gulp.js我有三个任务(uglify、buildHTML、rmRevManifest)我想作为父构建任务的一部分运行。我的代码有效,除了它并行运行任务(即不保留顺序)。我怎样才能让任务阻塞并且在上一个完成之前不运行下一个?即现在执行顺序返回为:[11:50:17]gulp-notify:[Gulpnotification]Deleted'rev-manifest.json'.[11:50:17]gulp-notify:[Gulpnotification]Created'build/index.html'.[11:50:17]gulp-notify:[Gulpnotificati

javascript - 如果满足条件,停止 Gulp 任务

我正在努力做到这一点,如果未指定--theme标志,它会停止gulp任务并想知道以DRY方式完成它的最佳方法。如果未指定--theme,我希望每个单独的任务都停止,如果不满足,我也希望默认任务停止。到目前为止,我已经尝试了一些没有运气的事情。谢谢,gulp.task('test',function(){if(typeof(args.theme)=='undefined'||args.theme===true){console.log(msg.noTheme);return;//endtask}//runrestoftask...});gulp.task('test-2',functio

javascript - karma 和 phantomJS 有什么区别

我知道Karma是Jasmine或Mocha等JS单元测试框架的测试运行器。PhantomJS提供headless浏览器来运行Jasmine或Mocha测试。但是,Karma和PhantomJS有什么区别?它们是两个相互竞争的工具,还是我在Karma之上使用PhantomJS在没有浏览器的情况下运行我的单元测试? 最佳答案 PhantomJS与测试无关。在单元测试范围内,它将成为目标浏览器之一。PhantomJS允许您在不存在桌面环境时在浏览器中运行单元测试。Karma是一个运行器,它提供关于测试成功程度的完成报告。Jasmine是

javascript - Gulp.js,保存文件时观察任务运行两次

鉴于我的gulpfile.js中的以下代码,每次我保存或更改文件时,任务都会运行两次而不是一次,这是为什么?我只希望它运行一次。vargulp=require('gulp');gulp.task('default',function(){gulp.watch('server/**/*.js',function(){console.log('ThisrunstwiceeverytimeIchange/saveajavascriptfilelocatedatserver/**/*.js');});});我对grunt和名为grunt-contrib-watch的插件也有同样的经历。

javascript - gulp-usemin 可以接受多个文件吗?

我有一个关于usemin的问题,我不确定它是否是一个错误。我的应用程序结构很简单:-root|-gulpfile.js|-app||-index.html||-about.html||-contact.html||-js||-a.js||-b.js||-c.js||-d.js||-e.js||-dist我的每个html文件中都有一个useminblock来包含所有脚本,例如:当我运行以下任务时:gulp.task('usemin'.function(){gulp.src('app/*.html').pipe(usemin({assetDir:'app/**/'})).pipe(dest

javascript - 使用 gulp-jasmine 指定依赖关系

我有以下gulpfile.js:vargulp=require('gulp'),jasmine=require('gulp-jasmine');gulp.task('default',function(){returngulp.src('spec/test.js').pipe(jasmine());});spec/test.js中的代码使用全局angular变量,但是,当我运行gulptaskdefault时会抛出一个关于它未定义的错误。假设angular是在全局范围内的文件spec/lib.js中定义的。在test.jsdescribe()之前,我如何告诉jasmine()它需要首先

javascript - Foundation-Apps angular 站点与 karma-jasmine 单元测试的集成

我认为在尝试运行karmajasmine单元测试时使用angular-mocks和foundation-apps存在问题。也可能是我错过了什么。由于要看的代码太多,我在github上发布了一个示例项目以供审查。基本上网站运行良好,karma运行测试,但是当您调试到angular.mocks.module函数时,您会发现您的应用程序中的模块没有被加载。如果您将foundation-apps排除在外,它将正常工作。这会不会是版本冲突,因为foundation-apps对angular-mocks有较旧的依赖性?fatestongithub 最佳答案

javascript - yeoman gulp-angular projekt 设置后单元测试出错

...设置有问题。我使用yeoman并使用创建我的项目yogup-angular设置完成后我开始单元测试gulptest但它失败了:PSP:\projects\test-logbook>gulptest[15:15:14]UsinggulpfileP:\projects\mydisk-logbook\gulpfile.js[15:15:14]Starting'scripts'...[15:15:15]allfiles14.08kB[15:15:15]Finished'scripts'after840ms[15:15:15]Starting'test'...2809201715:15:1

javascript - 将 angular-route 1.5.0 更新为 1.5.1 时出现 Karma 错误

当我将angular-route1.5.0更新到1.5.1时,出现错误:Angular单元测试:错误:意外请求:GET当我启动karma时,我收到一条错误消息:1)CallgetAllmethod[AppCategory]Error:Unexpectedrequest:GEThttp://myapp.com/app-category?is_active=trueNomorerequestexpectedin/node_modules/angular-mocks/angular-mocks.jsapp_category.model.test.jsdescribe('[AppCategor

javascript - 使用 Karma Jasmine 进行 Angular JS 测试

我有一个像这样的示例路线:angular.module('appRouter',['ui.router']).config(function($stateProvider,$urlRouterProvider){$stateProvider...........state('settings.account',{url:'/account',templateUrl:'templates/account.html',controller:function(resolveData){console.log(resolveData);},resolve:{resolveData:functi