Running tests for .NET and Node.js on Travis CI

Bart Wijnants
HackerNoon.com
2 min readJun 11, 2017

--

Introduction

Together with a colleague I started working on Partei. Like a lot of projects this consists of a web api that does some stuff and a front-end.

To make things easy we decided to serve our front-end from the same server that serves our api and to keep them in the same git repository. We opted for ASP.NET Core in the back-end and React in the front.

We set up the projects and configured Travis CI to run our tests and publish to Heroku.

Initially we only had .NET tests and Travis ran them without a problem. But then we introduced Jest tests for the front-end. Travis CI has Node.js installed by default on the .NET environment so thing should go smooth.

But things didn’t go smooth. Apparently the default version of Node.js is 4 and our project is written using Node.js 8.

Time to figure out a solution for this.

Solution

I created a repo with a .NET Core test project and an npm project both with a simple test.

On Travis CI, Node Version Manager (nvm) is available. In my .travis.yml file I used nvm to install Node.js 8 and use this version to run our tests.

Now both the .NET tests and the Node.js tests are running together.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.

To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

--

--