Sitemap
Kirti K

Kirti K

Kind is cool & share your knowledge 👋 👋 A seasoned front-end developer with over 15 years of experience crafting immersive digital experiences.

Member-only story

Day 3 — Matrix Testing: Prove Your Code Works on Node 18, 20, and 22

3 min readJun 6, 2026

My project runs on Node 22 locally.

But what if someone uses it on Node 18? Or the server runs Node 20?

Matrix testing runs your tests across multiple Node versions simultaneously — three parallel jobs, one for each version.

If there is a compatibility issue, you find out before it reaches production.

Press enter or click to view image in full size
Day 3 — Matrix Testing: Prove Your Code Works on Node 18, 20, and 22 — Kirti Kaushal

The workflow

```yaml
name: Matrix CI

on:
push:
branches: [ master, feature/github-actions-practice ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18, 20, 22] # Test on 3 Node versions!

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test -- --passWithNoTests --watchAll=false

- name: Build project
run: npm run build

- name: Display Node version
run: |
echo "Testing on Node.js ${{ matrix.node-version }}"
node…

--

--

Kirti K
Kirti K

Written by Kirti K

Kind is cool & share your knowledge 👋 👋 A seasoned front-end developer with over 15 years of experience crafting immersive digital experiences.