tag:blogger.com,1999:blog-1409352204799783992.post4817332558395006557..comments2024-02-11T10:49:23.848+01:00Comments on Agile & Coding: Is the ES6 import feature an anti-pattern?David Vujichttp://www.blogger.com/profile/05640815111394960040noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-1409352204799783992.post-78959792086470499352015-11-10T22:07:03.610+01:002015-11-10T22:07:03.610+01:00I have made some new experiments with modules, fak...I have made some new experiments with modules, fakes and dependencies, and would like to have your feedback on this! <br /><br />Here's the post: http://davidvujic.blogspot.se/2015/11/test-friendly-javascript-modules-without-depencency-injection.htmlDavid Vujichttps://www.blogger.com/profile/05640815111394960040noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-23708188684974267052015-11-03T13:53:50.309+01:002015-11-03T13:53:50.309+01:00If you going to cover your code with unit tests th...If you going to cover your code with unit tests then you have to use DI(best way) or in worst case use libraries like proxirify to mock imported modulesAnonymoushttps://www.blogger.com/profile/02382919581553501521noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-53125679526710630872015-11-02T23:22:19.287+01:002015-11-02T23:22:19.287+01:00Maybe it will be easier than we might think? If a ...Maybe it will be easier than we might think? If a module is loaded only once during a session, I guess it could be manipulated in a unit test. When a module is imported by the code under test, the manipulated code would be executed instead of the production version. Maybe Dependency injection is not needed? Recently, I have been learning Python that has a module system very much like ES2015. Python is also dynamic and just like JavaScript, functions and variables can easily be overwritten. That's where I got this idea from.<br /><br />I guess it depends how the browser implements module loading.David Vujichttps://www.blogger.com/profile/05640815111394960040noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-82775799858397462132015-11-01T00:01:15.080+01:002015-11-01T00:01:15.080+01:00Yea. Whatever happened to easy unit testing. One o...Yea. Whatever happened to easy unit testing. One of the things that made Angular 1 so appealing (compared to pre-ES6 and frameworks at the time) was that it's so easy to unit test thanks to its dependency injection.<br /><br />And with ES6, have we lost this? I haven't yet Googled this.urihttps://www.blogger.com/profile/00089185440099034741noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-82932535321259110632015-10-12T17:37:58.215+02:002015-10-12T17:37:58.215+02:00Thank you Robert. I will have a look at it!Thank you Robert. I will have a look at it!David Vujichttps://www.blogger.com/profile/05640815111394960040noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-83422856507905238352015-10-09T18:12:53.101+02:002015-10-09T18:12:53.101+02:00Hi, David. I think that you describe very importan...Hi, David. I think that you describe very important problem of using es6 modules and I have the same 'import' problem in my project and I decided to create own IoC container.<br />I will be happy if my solution will useful for you.https://github.com/SRobertZ/es6iocAnonymoushttps://www.blogger.com/profile/02382919581553501521noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-57690342461828791482015-08-08T11:40:29.110+02:002015-08-08T11:40:29.110+02:00Interesting, I will check it out!Interesting, I will check it out!David Vujichttps://www.blogger.com/profile/05640815111394960040noreply@blogger.comtag:blogger.com,1999:blog-1409352204799783992.post-26513966833919003452015-08-06T12:49:19.409+02:002015-08-06T12:49:19.409+02:00Dependency injection is something I've tried t...Dependency injection is something I've tried to tackle in my Mocktail module for ECMAScript 6 modules: https://github.com/Wildhoney/MocktailWildhoneyhttps://www.blogger.com/profile/07969578554553297500noreply@blogger.com