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

@eserstack/testing

v5.1.0

Published

Readme

🧪 @eserstack/testing

Note: JSR is frozen at 4.5.x. From 5.0.0, @eserstack/testing is published on npm under the same name (pnpm add @eserstack/testing); the JSR versions stay available but get no updates.

eserstack Library — eser/stack on GitHub Install: pnpm add @eserstack/testing

Testing utilities for mocking HTTP servers, filesystems, and managing temporary directories.

Features

  • FakeServer: Mock HTTP server for testing handlers without network I/O
  • FakeFs: In-memory filesystem for testing file operations
  • TempDir: Temporary directories with automatic cleanup (AsyncDisposable)

Quick Start

Mock HTTP Server

import * as testing from "@eserstack/testing";

const server = new testing.fakeServer.FakeServer((req) => {
  if (req.url.endsWith("/api/users")) {
    return Response.json([{ id: 1, name: "Test" }]);
  }
  return new Response("Not Found", { status: 404 });
});

const response = await server.get("/api/users");
const users = await response.json();

Mock Filesystem

import * as testing from "@eserstack/testing";

const fs = testing.fakeFs.createFakeFs({
  "/app/config.json": '{"port": 3000}',
  "/app/src/main.ts": 'console.log("hello")',
});

const config = await fs.readTextFile("/app/config.json");
// '{"port": 3000}'

for await (const entry of fs.walk("/app/src")) {
  console.log(entry.path);
}

Temporary Directory

import * as testing from "@eserstack/testing";
import { runtime } from "@eserstack/standards/cross-runtime";

// Automatic cleanup with await using
await using temp = await testing.tempDir.withTmpDir();
await runtime.fs.writeTextFile(`${temp.dir}/test.txt`, "hello");
// Directory is automatically cleaned up when scope exits

API Reference

FakeServer

| Method | Description | | ---------------------------- | -------------------------------- | | fetch(input, init) | Make a request with full control | | get(path, headers) | Make a GET request | | post(path, body, headers) | Make a POST request | | put(path, body, headers) | Make a PUT request | | patch(path, body, headers) | Make a PATCH request | | delete(path, headers) | Make a DELETE request | | head(path, headers) | Make a HEAD request | | options(path, headers) | Make an OPTIONS request |

FakeFs

| Method | Description | | -------------------- | ---------------------------- | | readTextFile(path) | Read file as text | | readFile(path) | Read file as bytes | | walk(root) | Iterate over files | | isDirectory(path) | Check if path is a directory | | exists(path) | Check if path exists |

TempDir Utilities

| Function | Description | | --------------------- | --------------------------------------- | | withTmpDir(options) | Create temp directory with auto-cleanup | | delay(ms) | Delay execution | | writeFiles(files) | Write multiple files at once |


🔗 For further details, visit the eserstack repository.