草庐IT

gulp-jasmine

全部标签

javascript - 依赖任务的 gulp 错误处理

请找到gulpfile.js的内容如下。任务uglify依赖于任务jshint。目前,当我运行gulp时,无论jshint任务的结果如何,这两个任务都会执行。我不希望在出现“jshint”错误时执行uglify任务。换句话说,当存在依赖任务时,如果前面的任务检测到错误,我不希望执行后续任务。在gulp中有可能吗?vargulp=require('gulp');varjshint=require('gulp-jshint');varuglify=require('gulp-uglify');gulp.task('jshint',function(){returngulp.src(['as

javascript - 类型错误 : module is not a function AngularJS & Jasmine

在我的示例应用程序中,我像这样测试运行器收藏夹Controller:varmodule=angular.module('AngularSampleApp',[]);varFavoritesController=module.controller('FavoritesController',functionfavoritesController($scope){$scope.phones=[{'name':'NexusS','snippet':'FastjustgotfasterwithNexusS.'},{'name':'MotorolaXOOM™withWi-Fi','snippet

javascript - 我如何使用 gulp 在不同的文件中而不是在 javascript 文件中创建 Typescript sourcemaps?

我有一个使用gulp的项目。我想将typescript文件转换为javascript并拥有源map。这是我现在拥有的:varsourcemaps=require('gulp-sourcemaps');vartypescript=require('gulp-typescript');gulp.task('typescript',function(){gulp.src('app/**/*.ts').pipe(typescript()).pipe(sourcemaps.init()).pipe(sourcemaps.write()).pipe(gulp.dest('app'))});这部分有

javascript - grunt Jasmine Node 测试运行两次

我设置了grunt来运行node.jsJasmine测试。出于某种原因,使用此配置,结果总是显示双倍的测试。这是我的配置:我正在使用jasmine-node插入grunt。/spec/some-spec.js:varmyModule=require('../src/myModule.js');describe('test',function(){it('works',function(done){setTimeout(function(){expect(1).toBe(1);done();},100);});});Gruntfile.js:module.exports=function

javascript - gulp karma 测试 TypeError : Server is not a function

尝试使用gulp运行karma以运行测试,但遵循以下示例:https://github.com/karma-runner/gulp-karma我的gulp文件:vargulp=require('gulp');varServer=require('karma').Server;/***Runtestonceandexit*/gulp.task('test',function(done){newServer({configFile:__dirname+'/karma.conf.js',singleRun:true},done).start();});/***Watchforfilechan

javascript - 语义 ui 的 `gulp build` 给出错误 'ENOENT: no such file or directory'

版本:gulp@3.9.1我已经通过npminstall安装了semantic-ui并在交互式设置过程中给出了默认设置。但是当我从/semantic文件夹执行gulpbuild时,我收到以下错误:[20:52:27]Starting'build'...BuildingSemantic[20:52:27]Starting'build-javascript'...BuildingJavascript[20:52:27]Starting'build-css'...BuildingCSS[20:52:27]Starting'build-assets'...Buildingassets[20:5

javascript - 使用 Gulp 和 Babel 缩短构建时间

我试图在添加gulp-babel后加快构建时间到我的构建过程...起初我以为gulp-cached可能会有所帮助,但这会导致编译后的文件仅包含最近编辑过的那些文件(我现在明白了gulp-cached是如何工作的)。没有babel我的构建时间是使用babel最多1.5秒。我当然希望它回到200ms...有什么想法吗? 最佳答案 使用gulp-cached和gulp-remember。只有已更改的文件才会通过管道,然后gulp-remembers将它们全部添加回去。:)returngulp.src(array).pipe(cached(

javascript - 如何从 GULP 将变量值注入(inject) JS 文件

希望这是一个快速的问题。我正在尝试做的是在使用GULP构建文件时将时间戳添加到JS文件中的Javascript对象中。基本上,在“file.js”中,我有一个对象,我希望其中的object.timeStamp等于GULP构建的时间。我目前正在使用gulp-header在文件顶部添加时间戳,但系统要求我将时间戳添加到对象中的属性。我的想法是从GULP中注入(inject)值,但目前我发现的所有注入(inject)插件都是将一个文件的内容注入(inject)到目标文件中。如有任何帮助,我们将不胜感激。 最佳答案 你在使用任何类型的模块吗

javascript - Jasmine 测试中未调用 AngularJS 指令链接函数

我正在创建一个在其link函数中调用服务的元素指令:app.directive('depositList',['depositService',function(depositService){return{templateUrl:'depositList.html',restrict:'E',scope:{status:'@status',title:'@title'},link:function(scope){scope.depositsInfo=depositService.getDeposits({status:scope.status});}};}]);目前该服务很简单:ap

javascript - 为什么 Gulp 在运行依赖它的任务之前没有完成我的 'clean' 任务?

我有一个gulpfile,它应该在压缩代码之前清理我的dist目录。有时,清理任务仍在运行,而代码正在缩小,导致一些文件丢失。是什么导致它这样做?我的理解是任务的依赖将在任务运行之前完成,并且一个依赖只会运行一次,即使它是多个任务的依赖。vargulp=require('gulp');vargulpLoadPlugins=require('gulp-load-plugins');varplugins=gulpLoadPlugins();vardel=require('del');gulp.task('default',['css','js','fonts']);gulp.task('c