Debugging Karma + PhantomJS

tl;dr: Add the lines highlighted below to karma.conf.js and open http://localhost:9876/debug.html in Chrome (with dev tools open) while your tests are running:


module.exports = function (config) {
    config.set({
        basePath: '',
        frameworks: ['jasmine', 'angular-cli'],
        plugins: [
            require('karma-jasmine'),
            require('karma-phantomjs-launcher'),
            require('angular-cli/plugins/karma')
        ],
        port: 9876,
        browsers: ['PhantomJS'],
        singleRun: false,
        // Allow remote debugging when using PhantomJS
        customLaunchers: {
            'PhantomJS_custom': {
                base: 'PhantomJS',
                debug: true,
            },
        },
    });
};

Keep reading »

permalink

Reasons I Like JS Again: ES6

keep-calm-and-hate-javascriptI hated JavaScript. (See my last post.) Hated it – even as my colleagues at Fretless, Davey and Dave, wrote copious amounts of the stuff using various frameworks, and then began teaching week-long JavaScript bootcamps at ElevenFifty.

Oh, I still wrote it, but I wrote it with the attitude of a king condescending to shake hands with his lowliest of subjects. Instead of donning a royal glove, I clothed myself in sneers and vitriol. When Andrew, David, and Missy at OurHealth asked that I stop adding CoffeeScript files to their project, I managed to merely frown. (And then I went to Vim and converted the piece of code I was writing to plain-ol’ JS. Hey, man. Sometimes you appease those with whom you are working on a project. It’s the right, respectful thing to do. … I do think I left one .coffee file in there for them to remember me by.)

Thankfully, JavaScript, the language, receives updates and improvements, much as any other active software project. This June we’ll see the latest release of ECMAScript, the standardized language of which JavaScript is an implementation. It is called ECMAScript 6, ES6, or ES2015. It features what I see as vast improvements to the language. Though much maligning of JavaScript is due to misunderstanding, its current standard still suffers prominent warts that make every day use of the language frustrating for many. ES6 eliminates many of those frustrations, making JS more enjoyable for every day use.

I’m excited to tell you about some of the new features.

Keep reading »

permalink

React.js and Flux Made Me Like JS (Again?)

Chimera-from-Greek-mythologyI made it known to those who work with me regularly – whether they wanted me to or not – that I hated JavaScript. Like everyone else, I had written jQuery-heavy monsters of knotted, warty code fit together like a failed experiment in creating a chimera. You know what I mean – all the horror of combining a lion, a goat, and a snake, but with obvious seams and too few legs. I had written Backbone, Knockout, and dabbled in others on the front-end – with good intentions and a positive attitude, I swear. I wrote a Node.js app in an early version of Express. All of these things piled atop one another and led me to the conclusion: I hate JavaScript.

I more or less gave up a couple years ago.

I recently began working with Kyle Shipley at Health Pro on an internal project using React.js. The framework was released well after I threw my hands in the air in disgust at the state of JavaScript and its ecosystem. It turns out a lot has happened since then, and it’s been overwhelmingly positive. Though I will always enjoy making jokes about a new JavaScript library appearing every second, I now see the quality and robustness in the community that I was missing before. React is a huge part of that – for me.

There are a few primary reasons React has me so excited to be writing JavaScript again. I am not going to talk about what React is, what it does, etc. You’re way smart, man. You can follow links, and probably search on the World Wide Web when other means fail you. I’m just going to tell you what I like about React.

Keep reading »

permalink

Training: JavaScript Applications

We have another course coming up. JavaScript Applications runs March 7-13 (plus the night of March 6 for introductions and setup). We are once again partnering with our friends at Eleven Fifty.

If you’re building applications for the web, you have little choice but to deal with JavaScript. It’s the only front-end programming language that web browsers understand out-of-the-box. But don’t just think of it as eating your web vegetables. JavaScript is powerful and even fun when used responsibly!

JavaScript cohort, December, 2014

The first JavaScript cohort at Eleven Fifty. December, 2014

Keep reading »

permalink