Linting TypeScript with Webpack

Linters are an excellent way to enforce some structure and to help avoid errors. If you have never used a linter, you’re missing on a set of great tools that will assist your team to write better code. …

Leveraging the power of generics with TypeScript

If you’re new to TypeScript and have never worked with a language such as C#, generics might be something strange to you. But fear not, generics are not that complicated, and we’re going to see in a few examples, how does it work. …

How to run tests in parallel using NUnit 3

Since version 3 of NUnit, it is possible to run tests in parallel. And if you can turn this feature on, you should. The implementation is simple, and you will probably notice a considerable improvement in the time spent running the tests. …

How to stub promises using Sinon.JS

Promises are a great way of doing async programming. But testing with promises can be a bit cumbersome, even with the use of the arrow functions syntax. Recently I’ve found a small and nice package to help to stub tests using Sinon, and the library is sinon-stub-promise. npm i sinon-stub-promise -D So, imagine you have a code like the following: function fetchMovieData() { return fetch('/movies') .then(res => { return res.json(); }) .then(movies => { return movies; }) } function printMovies() { fetchMovieData().then(movies => { movies.forEach(movie => { console.log(movie); }); }) } A test for this code would be something like:...…