草庐IT

build_stubbed

全部标签

javascript - React Native Expo build 非常缓慢

我最近注意到我的构建时间显着增加,有时需要整整一分钟才能加载。在控制台上,我仍然相当快地看到“BuildingJavaScriptbundle:finished”,但屏幕刷新时间要长得多。有没有理由会发生这样的事情? 最佳答案 尝试在您的开发机器上的模拟器中使用Expo,并确定它花费的时间是否与您的设备一样长:如果它比您的测试设备更快,那么您应该检查测试设备上的网络连接如果它和测试设备一样慢,那么您可以尝试删除node_modules并使用“npminstall”或“yarn”重新安装它们。Expo将与所有其他包一起重新下载。

javascript - sinon stub 不替换功能

我正在尝试使用sinonstub来替换可能需要时间的函数。但是当我运行测试时,测试代码似乎没有使用sinonstub。这是我要测试的代码。functiontakeTooLong(){returnreturnSomething();}functionreturnSomething(){returnnewPromise((resolve)=>{setTimeout(()=>{resolve('ok')},1500)})}module.exports={takeTooLong,returnSomething}这是测试代码。constchai=require('chai')chai.use(r

javascript - Yeoman Angular Generator Grunt Build scripts/vendor.js 为空

我已经通过yoangular[project-name]生成了一个Angular项目,尝试通过gruntbuild构建它。我检查了dist/scripts/vendor.d41d8cd9.js文件,发现它是空的。我找到了this问题,它根本没有帮助我。如果有人能指出我正确的方向,将不胜感激。 最佳答案 我以某种方式找到了答案,我更改了build:js标签:到:它解决了我的问题:) 关于javascript-YeomanAngularGeneratorGruntBuildscripts/v

javascript - 我怎样才能用 sinonjs stub 内部引用的函数?

我有一个myModuleNode.js模块,其中包含:functionb(){console.log('originalb');}functiona(){b();}exports.a=aexports.b=b;以及以下使用mocha+sinon.js的测试套件:constmyModule=require('./myModule.js');constsinon=require('sinon');constsinonChai=require('sinon-chai');chai.use(sinonChai);describe('notworkingstub',()=>{it('should

javascript - meteor JS : How to stub validated method in unit test

我正在使用经过验证的方法(mdg:validated-method)和LoggedInMixin(tunifight:loggedin-mixin)。现在我的单元测试出现了问题,因为它们因notLogged错误而失败,因为在单元测试中当然没有登录用户。我怎么必须stub呢?方法constresetEdit=newValidatedMethod({name:'reset',mixins:[LoggedInMixin],checkLoggedInError:{error:'notLogged'},//单元测试describe('resetEdit',()=>{it('shouldreset

javascript - 如何多次断言 stub 提取

使用proxyquire、sinon和mocha。我能够在第一次调用fetch时stubfetch。但是在递归的第二个获取调用中,我无法断言它。从输出来看,断言可能会在测试完成之前运行。您将在断言后通过secondfetch控制台看到这一点。索引.jsvarfetch=require('node-fetch');functiona(){console.log('functionaruns');fetch('https://www.google.com').then((e)=>{console.log('firstfetch');b();}).catch((e)=>{console.lo

javascript - sinon.stub() vs sinon.sandbox.stub()?

在我们的前端单元测试中使用sinon和sinon-qunit,我很难理解这些方法的区别。我们正在使用sinon.sandbox.stub()(字面意思是函数,我们不创建沙箱)并且这些stub显然会在每次测试后自动恢复。我只是在文档中的任何地方都看不到这一点。我不认为存在这种方法,我认为您需要使用sinon.sandbox.create()显式创建沙箱。在该沙箱对象上,您将调用stub函数,即mySandbox.stub(),而不是"sinon.sandbox.stub()"。谁能帮我理解一下? 最佳答案 stub-Sinon.JSs

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 - Webpack babel-loader runtime : Module build failed: TypeError: this. setDynamic 不是函数

我正在尝试将babel-loader与babel-plugin-transform-runtime一起使用。我已按照以下说明进行操作:https://github.com/babel/babel-loader#babel-is-injecting-helpers-into-each-file-and-bloating-my-code相关代码:rules:[//the'transform-runtime'plugintellsbabeltorequiretheruntime//insteadofinliningit.{test:/\.js$/,exclude:/(node_modules

javascript - 我应该对我的/src 文件还是/build 文件进行单元测试?

在设置单元测试时(在我的例子中,使用JasmineforJavaScript)是否应该测试未缩小/未丑化的src文件?还是应该测试最终用户build文件(缩小和丑化)?在我的grunt配置中:jasmine:{src:['src/file.js']}对比jasmine:{src:['build/file.min.js']}一方面,测试src文件很好,因为它不会删除调试器,并且在需要时更容易检查。另一方面,我可以尽可能多地测试src文件,但最终用户将运行的内容并不真实,因为build文件被丑化和缩小。 最佳答案 您绝对应该对编写的裸源