React + Jest Testing on Windows 2.5

A little while back, my brother put together a guide to get Jest running on Windows that has been incredibly helpful, as there’s really not a whole lot of documentation out there on the Microsoft side of things.

You can check out the whole guide here : http://ryanlanciaux.github.io/blog/2014/08/02/using-jest-for-testing-react-components-on-windows/


The problem

Most of the steps went very smoothly with the exception of step 3, Set Visual Studio Version Flags.

I don’t have a Visual Studio license, so I was obligated to use an Express version. We also happen to be in the final months of 2014, so I went with Visual Studio Express 2013 for Windows figuring that all would be well. I even updated my ‘GYP_MSVS_VERSION’ environment variable to ‘2013e’.

Unfortunately, I was rudely greeted with a few errors when trying to grab Jest’s dependencies, which centered around node-gyp + contextify.

My error looked like :

Building the projects in this solution one at a time. To enable parallel build, please add the “/m” switch. error MSB8020: The builds tools for v120 (Platform Toolset = ‘v120 ’) cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select “Update VC++ Projects…”. Install v120 to build using the v120 build tools.


The fix

I tracked down the issue from the following issue for contextify, which was initially causing the error : https://github.com/brianmcd/contextify/issues/129

More or less, I needed Visual Studio 2012 Express for Windows the project to build correctly. This also went hand-in-hand with updating my ‘GYP_MSVS_VERSION’ environment variable to ‘2012’.

Go ahead and download it here : http://www.microsoft.com/en-us/download/details.aspx?id=34673


tldr;

If you’re having issues with installing all of Jest’s dependencies (especially contextify), install Visual Studio 2012 Express for Windows + update your ‘GYP_MSVS_VERSION’ environment variable to ‘2012’