DEV Community

loading...

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

Bart Wijnants
As Mick Jagger sang it in Sympathy For The Devil: Please allow me to introduce myself. I'm a man of wealth and taste. Well maybe just the first sentence. I'm not quite wealthy and a lot of peop...
Originally published at hackernoon.com on ・1 min read

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.

bartw/dotnetcore_node_travis

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.

Discussion (0)