This video is available to students only

Setting up testing environment

First of all we have to add Jest. Jest is the most popular testing framework in the JavaScript ecosystem. It runs tests, has multiple matchers, reporters, lots of extensions and plugins, and overall is a very well-made piece of software.

So as usual, lets install it and add it to our development dependencies using the npm install -D jest command.

Then npm i -D ts-jest @types/jest to add support for TypeScript.

Okay, so now we have what we need to create a config for it. To do that, run:

npx ts-jest config:init

You should see that jest.config.js has been created in our project root.

The next step will be to change our test npm script in package.json to "test": "jest" and add watch mode script, which looks like:"test:watch": "npm test -- --watch",

Start a new discussion. All notification go to the author.