In an article Google published earlier this month, Eric Bidelman shows us how to use headless Chrome in automated continuous integration testing.1 Tellingly in the installation guide we read this:
Install Karma, the relevant, plugins, and the test runners using yarn […] or use npm.
Yarn comes first. Whether this is the wholesale approach at Google or just for specific teams is hard to say but the reality is that Yarn has its own registry and is taking a serious foothold at industry leading tech companies.
To quote myself back in November:
Despite what NPM said on its blog, Yarn isn’t merely a “backwards-compatible client for the npm registry.” In reality, Facebook launched a direct competitor to NPM but made it easily compatible so developers could migrate from NPM to Yarn with minimal effort.
Now we’re in mid 2017 and the gloves are off. Yarn is a head-to-head competitor to NPM. The fact that Google is preferring Facebook’s dependency management system should tell you something.
For a while I preferred to stub everything with jsdom rather than use a headless browser, but now that headless Chrome is released, I’ve gone full circle. If you’re writing tests for code that is supposed to run in a browser, having those tests run in a browser is the way to go. Since Google Chrome is the #1 browser out there (and rightfully so!), having your headless browser be Chrome itself is the ideal setup. ↩︎