草庐IT

gulp-babel

全部标签

javascript - jest snapshot 使用 enzyme 打破情绪 10/babel 7

所以我的开Jest快照可以正常工作,使用babel6/emotion9在快照中生成css和html但是我需要更新到babel7和emotion10但是我的enzyme快照测试不再有效。代码编译并在更新所需代码后工作正常,只是测试被破坏(迁移文档中没有显示与测试设置更新相关的任何内容)。test('rendersproperly',()=>{//thisworksgeneratingthecorrectcss/htmlsnapshotoutputexpect(renderer.create(test).toJSON()).toMatchSnapshot();//thisdoesnotco

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 - 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 - 为什么我会在 gulp 中得到 "task completion callback called too many times"?

给定以下gulp任务,为什么我会收到以下错误?Error:taskcompletioncallbackcalledtoomanytimesfunctionmyTask(options,cb){//cbisthegulpcbvarserverInstance=http.createServer(dispatch({/*routes*/}));serverInstance.listen(options.port,function(){cb();//Stacktraceidentifiesthislineasthrowingtheerror});}functionpartial(fn){va

javascript - Gulp-inject 转换不起作用

我尝试设置gulp-inject以将依赖项注入(inject)index.html。除了转换功能外,一切正常。我需要按以下方式替换部分文件路径:/frontend/src/-->/static/我试过这样做(从某处复制粘贴):transform:function(filePath,file,i,length){varnewPath=filePath.replace('/frontend/src','');console.log('injectscript='+newPath);return'';}执行后,控制台中没有任何内容(标准gulp输出除外),结果文件中出现未转换的文件路径。看起

javascript - gulp.dest 没有创建目标文件夹

我的gulp代码部分如下所示gulp.src(['../application-base/**/**.js','!../application-base/assets/**/**.js'],{base:'./'}).pipe(gulpPlumber({errorHandler:function(error){console.log(`\nError${error}`);this.emit('end');}})).pipe(gprint(filePath=>"Transpiling:"+filePath.replace('..\\application-base\\',''))).pip

javascript - 为什么我们在使用 babel-loader 时要排除 node_modules?

网站上问的大多数问题是如何排除node_modules但相反,我想知道为什么我们要排除node_modules?module.exports={mode:'production',entry:'./src/index.js',output:{path:path.join(__dirname,'dist'),filename:'app.bundle.js'},module:{rules:[{test:/\.js$/,loader:'babel-loader',exclude:/node_modules/,options:{presets:['@babel/preset-env']}}]}

javascript - 使用 Gulp 导入 ES6 模块

我正在尝试将我的ES6模块导入到一个文件中,并运行Gulp来连接和缩小该文件。我遇到了ReferenceError:requireisnotdefinedatall.js(transpiled)lineno3。我已经使用gulp-babel转译了代码。我的js文件是:cart.js:classCart{constructor(){this.cart=[];this.items=items=[{id:1,name:'DoveSoap',price:39.99},{id:2,name:'AxeDeo',price:99.99}];}getItems(){returnthis.items;}

javascript - 巴别塔 : The CLI has been moved into the package `babel-cli`

我在工作时正在处理一个JS文件,我安装了babel,运行babelfile.js|节点晚上把文件发回家上类,在家安装了babel,运行上面的命令出现如下错误:TheCLIhasbeenmovedintothepackage'babel-cli'有什么想法吗?提前谢谢你:)如果我安装CLI-以下代码无法编译:functionsumArrayIndex(array,i,separator){returnarray.map(x=>x.split(separator).map(c=>{returnparseInt(c)})).map(x=>{returnx[i];}).reduce((x,y)

javascript - 很好地在 gulp 任务中抛出错误

我正在创建一个在某些情况下可能会失败的gulp任务。gulp.task('favicon',function(){try{require('child_process').execSync('icotool--version');}catch(e){varerr=newError('Unixbashandicotoolrequiredforgeneratingfavicon');throwerr;}returngulp.src('',{read:false}).pipe(shell(['./generate-favicon.sh']));});当通过gulp运行我的任务并遇到错误时,错