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

@mailpeek-dev/client

v0.2.0

Published

TypeScript client for Mailpeek: wait for, inspect and assert on emails in tests.

Readme

@mailpeek-dev/client

TypeScript client for Mailpeek: wait for, inspect and assert on emails in Vitest, Jest, Playwright or plain scripts.

npm install -D @mailpeek-dev/client
import { Mailpeek } from "@mailpeek-dev/client";

const mailpeek = new Mailpeek(); // MAILPEEK_URL or http://localhost:8026

const inbox = mailpeek.createInbox(); // [email protected]
await signUp({ email: inbox.address });

const email = await inbox.waitForEmail({ subject: "Welcome" });
expect(email.text).toContain("Hello John");
const link = email.findLink("Activate account"); // { text, href }

API

| Method | Returns | | --- | --- | | messages(filter?) | MessageSummary[], newest first | | get(id) | Email | | latest(filter?) | Email \| undefined | | waitFor({ ...filter, timeout?, signal? }) | Email; throws MailpeekTimeoutError (default timeout 10 s) that lists what arrived and why it didn't match | | waitForEmails(count, { ...filter, timeout?, signal? }) | Email[], the first count matches in arrival order | | delete(id) | void | | clear(filter?) | number deleted (all messages when no filter) | | raw(id) | raw MIME string | | attachment(messageId, attachmentId) | Uint8Array | | health() | boolean | | info() | version, ports, limits and store usage (messages, bytes, evicted) | | failNext({ code?, stage?, message?, address?, count? }) | SmtpFailure: the next matching deliveries get an SMTP error (default one 451 at the end of DATA) | | smtpFailures() | pending SmtpFailure[] | | clearFailures(address?) | number of rules removed | | createInbox({ prefix?, domain? }) | Inbox with a unique address, matched exactly | | inbox(address) | Inbox for an existing address (exact match) |

Every method also takes { signal } (the last argument; inside the options for waitFor) to cancel it.

Filters (combined with AND): address (exact recipient address: To, Cc or envelope), and the case-insensitive substrings to, from, subject, body (text or HTML body), q (subject, from, to or body); plus since (Date, ISO string or Unix ms).

Email has plain fields (id, from, to, cc, replyTo, subject, text, html, headers, attachments, links, envelope, date, createdAt) and the helpers findLink(), hasLink(), findCode(), getHeader(), getHeaders() and hasAttachment(). findLink() and findCode() throw a descriptive error when nothing matches.

const [welcome, verify] = await inbox.waitForEmails(2);
const code = verify.findCode(); // "482913": the code after "code", "OTP", "PIN"…, else the first 6-digit number

inbox.failNext({ code: 451 }) makes the next delivery to that inbox fail with an SMTP error (stage: "rcpt" refuses the recipient instead of the message), to test that the application retries or reports it. Other inboxes are not affected, and inbox.clear() removes the inbox's pending rules.

Options: new Mailpeek({ baseUrl, auth, timeout, requestTimeout, inboxDomain, fetch }). timeout (10 s) is how long waitFor waits for an email; requestTimeout (10 s) bounds each HTTP request, so a stuck connection can't hang a test.

When Mailpeek runs with --ui-auth, pass the credentials in the URL (MAILPEEK_URL=http://admin:secret@localhost:8026) or as auth: { username, password }. A 401 produces an error that says how to fix it.

Requires Node 20+. Ships ESM and CommonJS builds.