5 ms·
I've been dabbling with JS more and more lately at work or at home. I miss the structured approach provided by Maven+Java+JUnit+Mockito+Selenium/Sauce-lab/any-
by edwinnathaniel 13y ago
I've been dabbling with JS more and more lately at work or at home.
I miss the structured approach provided by Maven+Java+JUnit+Mockito+Selenium/Sauce-lab/any-functional-test combo and am looking for good resources to replicate this on the JS side (preferably the front-end side as I don't care much of NodeJS at the moment).
I'd like to learn:
1. Better build process for all of the front-end (HTML/CSS/JS) components
2. Better UNIT-testing approach (not half-unit-testing-but-with-browser-dom-faked-out-approach) maybe a'la MVP pattern like the one in GWT.
Basically I'm not going to entertain anything that requires a browser to be launched (because it requires a lab/dedicated machine) because I'm looking for Unit-Testing not "Integration/Functional-testing"
3. Better automation (in general) of the UI/front-end component
For example:
- replace build version => main.css?{some_build_num} (or main_{build_num}.css)
- LINT-ing
- Compilation/obfuscation (could be merged with LINT-ing to some degree)
- Auto-generate JS documentation (provided the code has proper comments) and auto-publish JS documentation [Maven supports this for Java]
4. MUST have xUnit output (crucial for my next point)
5. EASY to run/configure on CI servers (Jenkins, Bamboo, etc)
- continuation from #4, code coverage + unit-tests result should be available on the CI build report
6. Packaging? Dependency management?
So far front-end development has been.... less desirable because of the tools are far less superior than doing back-end development (regardless how beautiful/ugly JavaScript is, I'm 100% or even 1000% way more productive on doing back-end development).
I'm very much interested in learning the best practice and to increase my productivity developing front-end and this book seems to cover some of the points I mentioned above but not sure how meticulous/detailed the coverage is.
There's TDD.js book but I'm not sure if it has done a good job covering pure unit-testing and strategies to refactor/perform unit-testing correctly.
- jdlshore 13y agoYou might like my screencast, Let's Code: Test-Driven JavaScript. It covers everything you're talking about. http://www.letscodejavascript.com http://www.letscodejavascript.com
- edwinnathaniel 13y agoBookmarked and will definitely start watching today. As you can see, I'm in serious P.A.I.N on front-end (especially when I'm comparing with my process on the back-end).
- jdlshore 13y agoGreat, let me know if you have any questions. There's a lot of content and it can be a bit overwhelming. These episodes in particular are probably the best place to start off, given what you're looking for: * Large-Scale JavaScript Fundamentals. Summary of front-end workflow fundamentals. Check out the build script included in the example source code, too. http://www.letscodejavascript.com/v3/episodes/lessons_learned/15 http://www.letscodejavascript.com/v3/episodes/lessons_learne... * Front-End Unit Testing in a Nutshell. A summary of several strategies for testing browser DOM code. http://www.letscodejavascript.com/v3/episodes/lessons_learned/11 http://www.letscodejavascript.com/v3/episodes/lessons_learne...
- bevacqua 13y agoHi there, Regarding your bullet list, the book covers all of your concerns. Grunt just depends on node/npm, and I describe how to get CI working properly with Grunt. The first part of the book is entirely dedicated to automation and the build process, and it definitely covers things such as asset revving, linting, bundling, and minification. When it comes to modularity (commonjs, amd, etc), dependency resolution (circular or otherwise), and package management, that's detailed in Chapter 5, at the beginning of Part II. Unit Testing is covered in Chapter 8. I won't talk about TDD other than briefly mentioning it, but what I _will_ be talking about is automating unit tests, abstracting browser interaction, using PhantomJS to avoid firing up a browser, and using karma to run tests using Chrome automatically. The testing chapter will go over real-life case scenarios, as well. To be honest, I'll cram as much high quality content as I can in the book/samples, but if you're looking for testing-heavy (or TDD) content, I'd suggest you look elsewhere Most of the content covered in the book is further expanded in the code samples, which are open source: https://github.com/bevacqua/buildfirst https://github.com/bevacqua/buildfirst
- edwinnathaniel 13y agoThanks for replying my concerns! I here you and I understand the approach you take for this book and I agree with your approach because I don't think a single book can have everything on my bullet points. I really really hope that there's a de-facto stack for front-end development and let that stack stabilize for a while so that people can build on top of it (as opposed to keep on solving individual problem with a single specific brand-new-hip-tool-which-will-get-outdated-soon). I hope Yeoman (Grunt and Bower) can be a part of the solution for the long-run and hopefully your book can be a foundation where people based-off future books (i.e.: JavaScript test automation should be based-off something).
- diggan 13y agoYou should take a quick look at Bower together with GruntJS and maybe Yeoman if you start many projects over and over again. Otherwise Bower + Grunt covers most of your pain points.