Unlock the Power of Node.js Testing with the New Node Test Runner Feature

Kristijan
4 min readApr 22, 2023

Node.js has recently released a new version (v20). In it, Node.js announced that its new feature, the Node Test Runner, has become officially stable. This new feature offers developers a standardized way to test their Node.js applications, ensuring that their code is reliable and bug-free. In this article, we will be taking a look at the basics of the Node Test Runner and how it can be used to make testing Node.js applications easier and more efficient.

NodeJS logo

Initial setup

The great thing about the built-in test runner feature, there is no need for installation. If you ever tried to introduce anything in a software project, especially in the JavaScript world, you probably already know. Things can get messy. Complicated setups, incompatible versions, and missing features are just some of the problems that often make you start regretting your decision to improve your code. This is not the issue here. Do you want to make a test? Just import the node:test module, and you will get commands like describe, test, and it.

import {test, describe} from ‘node:test’;

describe(“test suite”, function() {
test(“test if works correctly”, function() {
// run some test
})
})

I am assuming you already have at least some basic experience with testing, so…

--

--