Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→eslint-plugin-test-numnext

eslint-plugin-test-num

Downloads per monthMIT Licenselibera manifesto
  • the top
  • PURPOSE
  • FEATURES
  • INSTALL
  • CONFIGURATIO…
  • ALSO

Purpose

This eslint plugin automatically updates numeric id’s in unit test descriptions:

Fig 1. Automatically-updated test numbers
Fig 1. Automatically-updated test numbers

so that you don’t need to rely on row numbers, or worse, search by unit test’s description label.

For example, here’s a real-life terminal output, codsen-parser unit tests, tapopens in a new tab unit test runner:

Fig 2. Unit tests with numbers
Fig 2. Unit tests with numbers

Notice, there were 104 tests above and tapopens in a new tab didn’t report any row numbers for “todo” tests.

Or, here’s the uvuopens in a new tab reporting that assert 07.01 is failing:

Fig 3. uvu test 07.01 failing
Fig 3. uvu test 07.01 failing

This program updates both test names and assert messages:

Fig 4. Bunch of numbers to maintain
Fig 4. Bunch of numbers to maintain

As a result, it becomes easier to locate the failing tests. In the long run, everything adds up, every small thing like this — we write hundreds (if not thousands) of unit tests per month, so every second counts.

Features

Supports:

  • ava
  • uvu
  • tap

Codsen monorepo has been using all these unit test runners above; currently we’re on uvu, and it’s been using this plugin on every one of them.

Install

npm i -D eslint-plugin-test-num

Configuration

Use our preset:

"extends": [
  "eslint:recommended",
  "plugin:test-num/recommended"
]

If you do not use a preset you will need to specify individual rules and add extra configuration.

Add "test-num" to the plugins section:

{
  "plugins": ["test-num"]
}

Enable the rule:

"rules": {
  "test-num/correct-test-num": "error",
}

Also

Check out: eslint-plugin-row-num — it updates console.log row numbers so you know where exactly did that console.log came from. It’s especially relevant when you Rollup your programs and tests are ran against a file different from source from which console.log originate.

↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab