Skip to content
Skills Library
Programming · Testing

node-native-tests

/node-native-tests

I use node:test + borp + c8, not Jest or Vitest. The runtime ships a test runner — I use it. Use when adding tests, when an agent reaches for Jest/Vitest, when configuring coverage, or when user says "add a test", "test runner", or "borp".

Repository
skills ↗
Licence
MIT
Last repository change
12.10.2026

Assessment and security

95/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability20 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

I use node:test + borp + c8, not Jest or Vitest. The runtime ships a test runner — I use it. Use when adding tests, when an agent reaches for Jest/Vitest, when configuring coverage, or when user says "add a test", "test runner", or "borp".

Triggers from the description

add a testtest runnerborp
Original author description

I use node:test + borp + c8, not Jest or Vitest. The runtime ships a test runner — I use it. Use when adding tests, when an agent reaches for Jest/Vitest, when configuring coverage, or when user says "add a test", "test runner", or "borp".

How it works

  1. When this skill is active
  2. The setup
  3. Mocking
  4. Anti-patterns
  5. When the codebase already has Jest or Vitest
Original SKILL.md headings · 95 lines, 469 words
SKILL.md preview
---
name: node-native-tests
description: I use node:test + borp + c8, not Jest or Vitest. The runtime ships a test runner — I use it. Use when adding tests, when an agent reaches for Jest/Vitest, when configuring coverage, or when user says "add a test", "test runner", or "borp".
---

# Node-native tests

The Node.js runtime ships a test runner. I use it. No `jest`, no `vitest`, no `@types/jest`. The runner is `borp` (TAP reporter, parallel by default), coverage is `c8`.

This is a [`single-tool-per-job`](../single-tool-per-job/SKILL.md) choice: the standard library covers it, so no third-party test framework earns its place in `package.json`. The full `ait` testing setup — Docker test services, c8 invocation, package-mirroring `test/` directory — is documented at [`personal/ait/references/best-practices-testing.md`](../../personal/ait/references/best-practices-testing.md).

## When this skill is active

You are about to:

- Add a test file
- Configure a test runner or coverage tool
- Migrate from another test framework (only if I asked for it)
- Reach for `jest.mock`, `vi.mock`, or `@types/jest`

## The setup

```jsonc
// package.json
{
  "scripts": {
    "test": "borp",
    "test:coverage": "c8 borp -T --reporter spec"
  },
  "devDependencies": {
    "borp": "^0.x",
    "c8": "^10.x"
  }
}
```

In monorepos with Docker-backed test infra (PostgreSQL, Qdrant, Redis), pre/post hooks bring services up and down:

```jsonc
{
  "scripts": {
    "test":     "pnpm run:recursive test",
    "pretest":  "pnpm start:services:test",
    "posttest": "pnpm stop:services:test"
  }
}
```

```typescript
// src/foo.spec.ts
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { foo } from './foo.ts';

describe('foo', () => {
  it('returns ok for valid input', () => {
    const r = foo('valid');
    assert.equal(r.ok, true);
  });

  it('returns err with __type for invalid input', () => {
    const r = foo('');
    assert.equal(r.ok, false);
    if (!r.ok) assert.equal(r.error.__type, 'empty-input');
  });
});
```

File suffix is `.spec.ts` (or `.spec.js`). `borp` picks them up by default.

## Mocking

`node:test` ships `mock` from `node:test`:

```typescript
import { describe, it, mock } from 'node:test';

const fn = mock.fn(() => 42);
fn();
assert.equal(fn.mock.callCount(), 1);
```

For module-level mocks, prefer dependency injection over runtime patching. If you really need module mocking, `mock.module` is in Node 22+.

## Anti-patterns

- **Reaching for Jest or Vitest.** Don't. The runtime has a runner. If something is missing, name what — usually it isn't.
- **`@types/jest` in `devDependencies`.** That's the migration tell. Remove it.
- **`vi.mock`, `jest.mock`, `jest.fn()`** in new code. Use `mock.fn` from `node:test`.
- **`*.test.ts` instead of `*.spec.ts`.** Pick one. I use `.spec.ts`. Keep the codebase consistent.
- **Adding `tsx` or `ts-node` as a test dependency** when `node --experimental-strip-types` (Node 22.6+) or native TS support (Node 23.6+) handles it.
- **Test files importing from `./dist/`.** Test the source, not the build.

## When the codebase already has Jest or Vitest

Stop. Don't migrate unprompted. If there are 50 Jest tests, a silent rewrite is hostile. Note the existing setup, propose a migration as a separate task, and write new tests in the existing style for now. If I confirm the migration, do it in one commit with no other changes.

The exception: brand-new packages added to an existing monorepo can use `node:test` even if other packages use Jest. Each package owns its own test setup.

Versions

The database has no other skills named node-native-tests.

Database snapshot: 13.11.2026 · package version 29dd90867643 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100vitest
    Vitest is a test runner for JavaScript and TypeScript built on Vite, with a Jest-compatible API, built-in mocking, snapshots and code coverage. Use when a user asks to set up or run unit tests in a Vite or Node project, write tests with describe/it/expect, mock modules with…
  • 100vitest
    Vitest testing framework. Covers unit tests, mocking, and coverage. Use for testing Vite-based and Node.js projects. USE WHEN: user mentions "vitest", "vite test", "unit test", asks about "vi.fn", "vi.mock", "test coverage", "mock functions", "test vite project" DO NOT USE FOR:…
  • 100vitest
    Set up Vitest testing in any project — detects type (Cloudflare Workers, React, Node, library), generates vitest.config.ts, test setup, utilities, and a sample test. Covers mocking patterns, coverage config, workspace setup, Jest migration. Use whenever the user mentions adding…
  • 100vitest-testing
    Vitest test runner — Vite-native, ESM, watch/UI mode, coverage, mocking, snapshots. Use when setting up tests for Vite projects, migrating from Jest, or needing fast execution.
  • 86jest-vitest
    前端测试开发专家助手。当用户需要编写前端/Node单元测试、组件测试、函数与模块mock、定时器mock、覆盖率配置或Jest与Vitest选型时调用。
  • 85vitest
    Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.