Migrating to Jest test runner

I have already shared my comparison of two JavaScript testing solutions where I admitted that I favor Jest over Mocha. Back then, I listed all major differences between those tools summarized with advantages and disadvantages of migrating to Jest:

Pros:

  • Simpler API, less boilerplate code.
  • Flexible and easy configuration.
  • Test files executed in isolation.
  • Advanced watch mode.
  • Snapshots support = easier start with testing.
  • Code coverage.

Cons:

  • Another migration.
  • Mocha has still a bit better performance (according to my quick tests).

My analysis got very positive feedback, with only a few little concerns, so I got encouraged to take action and verify the assumptions stated. I picked two different projects to play with to ensure both of them will uniformly benefit from using Jest.

Continue reading Migrating to Jest test runner

Picking Jest over Mocha – testing tools comparison

At Automattic we use Mocha to run all tests written for Calypso project which powers WordPress.com. It also includes end-to-end tests, which live in their own repository. We have been using this setup for over 3 years now. I think it is a good moment to revisit this choice. I found this unit testing tools comparison very helpful when evaluating alternatives. I strongly agree with the conclusions shared by Martin Olsson in his article:

Staying with Javascript, I think it’s hard to ignore the momentum behind Jest. I would be awesome if someone fixed #2059 though. Then again, Mocha seems to work well enough for a lot of people.

Continue reading Picking Jest over Mocha – testing tools comparison

Overview of Javascript tools and frameworks

I prepared overview of possible JavaScript tools and framework that can be used to build modern web application. Most of them are used to build Czas na Rower frontend. Mentioned project uses GruntJS for tasks management, JSHint for code linting Mocha and SinonJS for unit testing, RequireJS for module loading, jQuery, Bootstrap, Flight and Backone.js for JavaScript code development. You can see more on project site on GitHub.

JavaScript tools

Code linting

JSLint is a JavaScript program that looks for problems in JavaScript programs. It is a code quality tool created by Douglas Crockford. JSLint takes a JavaScript source and scans it. If it finds a problem, it returns a message describing the problem and an approximate location within the source. The problem is not necessarily a syntax error, although it often is. JSLint looks at some style conventions as well as structural problems. It does not prove that your program is correct. It just provides another set of eyes to help spot problems.

Continue reading Overview of Javascript tools and frameworks