npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nan0web/test

v1.1.3

Published

A test package with simple utilities for testing in node.js runtime

Downloads

46

Readme

@nan0web/test

|Package name|Status|Documentation|Test coverage|Features|Npm version| |---|---|---|---|---|---| |@nan0web/test |🟢 97.2% |🧪 English 🏴󠁧󠁢󠁥󠁮󠁧󠁿Українською 🇺🇦 |🟡 83.5% |✅ d.ts 📜 system.md 🕹️ playground |1.1.2 |

A test package with simple utilities for testing in node.js runtime. Designed for nan0web philosophy, where zero dependencies mean maximum freedom and minimal assumptions.

This package helps build ProvenDocs and structured datasets from test examples, especially useful for LLM fine-tuning.

Installation

How to install with npm?

npm install @nan0web/test

How to install with pnpm?

pnpm add @nan0web/test

How to install with yarn?

yarn add @nan0web/test

Core Concepts

This package is designed with zero external dependencies and maximum clarity:

  • ✅ Fully typed with JSDoc and .d.ts files
  • 🔁 Includes mocked utilities for real testing scenarios
  • 🧠 Built for cognitive clarity: each function has a clear purpose
  • 🌱 Enables lightweight testing without side effects

MemoryDB(options)

Utility to simulate a file system for tests.

@deprecated Use the @nan0web/db.DB as it has the same functionality.

  • Parameters
    • options – Object of params including:
      • predefined – Map of pre-defined file contents (e.g., { 'users.json': '[{ id: 1 }]' })

How to mock file system using MemoryDB?

import { MemoryDB } from "@nan0web/test"
const db = new MemoryDB({
	predefined: new Map([
		['file1.txt', 'content1'],
		['file2.txt', 'content2'],
	]),
})
await db.connect()
const content = await db.loadDocument('file1.txt')
console.info(content) // 'content1'

runSpawn(cmd, args, options)

Utility to mock and execute child processes (for CLI tools).

  • Parameters

    • cmd – command to run (e.g., "git")
    • args – array of arguments
    • opts – optional spawn options with onData handler
  • Returns

    • { code: number, text: string }

How to use runSpawn as a CLI test tool?

import { runSpawn } from "@nan0web/test"
const { code, text } = await runSpawn('echo', ['hello world'])
console.info(code) // 0
console.info(text.includes('hello world')) // true

TestPackage(options)

Class to automate package verification based on nan0web standards.

  • Parameters
    • options – package metadata and file system db instance

How to validate a package using TestPackage.run(rrs)?

import { TestPackage, RRS } from "@nan0web/test"
const db = new MemoryDB()
db.set("system.md", "# system.md")
db.set("tsconfig.json", "{}")
db.set("README.md", "# README.md")
db.set("LICENSE", "ISC")
const pkg = new TestPackage({
	db,
	cwd: ".",
	name: "@nan0web/test",
	baseURL: "https://github.com/nan0web/test"
})
const rrs = new RRS()
const statuses = []
for await (const s of pkg.run(rrs)) {
	statuses.push(s.name + ':' + s.value)
}
console.info(statuses.join('\n'))

DocsParser

Parser to extract documentation from tests and generate markdown (ProvenDoc).

It reads js tests with comments like:

it("How to do something?", () => {
  ...
})

and converts them into structured .md documents.

DatasetParser

Parser that converts markdown docs (such as README.md) into structured .jsonl datasets.

Each How-to block becomes one test case:

{"instruction": "How to do X?", "output": "```js\n doX()\n```", ...}

How to generate dataset from markdown documentation?

import { DatasetParser } from "@nan0web/test"
const md = '# Title\n\nHow to do X?\n```js\ndoX()\n```'
const dataset = DatasetParser.parse(md, '@nan0web/test')
console.info(dataset[0].instruction) // ← "How to do X?"

Playground

This package doesn't use heavy mocking or virtual environments — it simulates them with lightweight wrappers. You can play in its sandbox as follows:

How to run CLI sandbox?

git clone https://github.com/nan0web/test.git
cd test
npm install
npm run play

API Components

has multiple test components that can be imported separately

import { MemoryDB, DocsParser, DatasetParser, runSpawn } from "@nan0web/test"

Java•Script types & Autocomplete

Package is fully typed with jsdoc and d.ts.

How many d.ts files should cover the source?

Contributing

How to contribute? - check here

License

How to license? - LICENSE