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

@mermaid-lint/jest

v0.53.1

Published

Jest adapter for mermaid-lint

Readme

@mermaid-lint/jest

Jest adapter for mermaid-lint. Turns every Mermaid diagram in your docs into a test — your suite fails if a diagram has a syntax error (or, with strict, a semantic warning like a self-loop or duplicate id). Uses the official mermaid.parse() API.

Full docs and examples →

Install

npm install --save-dev @mermaid-lint/jest jest

Usage

// mermaid.test.mjs
import { defineMermaidTests } from '@mermaid-lint/jest';

defineMermaidTests(); // auto-discovers git-tracked *.md / *.mdx / *.markdown / *.mmd

defineMermaidTests() registers one test per discovered diagram (plus a guard that at least one diagram exists), so each diagram shows up individually in the Jest report.

Jest needs native ESM enabled, since this package is ESM-only:

NODE_OPTIONS=--experimental-vm-modules npx jest

Options

It accepts the same discovery options as the CLI:

defineMermaidTests({ root: '/my/docs' }); // explicit root
defineMermaidTests({ all: true }); // scan the filesystem, not just git-tracked files
defineMermaidTests({ paths: ['docs/intro.md', 'README.md'] }); // explicit file paths
defineMermaidTests({ extensions: ['crv'] }); // discover extra extensions

| Option | Type | Description | | --- | --- | --- | | root | string | Directory to discover files from. | | all | boolean | Scan the filesystem instead of only git-tracked files. | | paths | string[] | Explicit file paths to validate (literal paths, not globs). | | ignore | string[] | Globs to exclude. | | noGitignore | boolean | Include gitignored files when scanning. | | extensions | string[] | Extra file extensions to discover (beyond .md/.mdx/.markdown/.mmd). | | strict | boolean | Also fail on warning-severity semantic findings (default: errors only). | | rules | object | Per-rule severity overrides, e.g. { 'no-orphan-nodes': 'error' }. |

Semantic checks

By default a diagram fails on syntax errors and error-severity semantic rules (e.g. duplicate node ids). Pass strict: true to also fail on warning-severity findings (self-loops, missing direction, …), or tune individual rules with rules:

defineMermaidTests({ strict: true });
defineMermaidTests({ rules: { 'no-orphan-nodes': 'error' } });

Programmatic use

Need the results without registering tests? lintMermaidFiles returns the diagnostics per block so you can write your own assertions:

import { lintMermaidFiles } from '@mermaid-lint/jest';

const results = await lintMermaidFiles({ all: true }); // or { paths: ['README.md'] }
for (const { block, diagnostics } of results) {
  // diagnostics: syntax + semantic findings for this block
}

Requires jest >= 27. Discovery and validation are delegated to @mermaid-lint/core.