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

@critters/next

v2.0.0

Published

Secure bug reporting library for Next.js applications

Downloads

143

Readme

Critters Next.js Test Suite

This directory contains automated tests for the @critters/next package. The test suite is built using Jest and provides coverage for the main functionality of the library.

Test Coverage Overview

The following components of the library are covered by tests:

  1. Utility Functions (utils.test.ts)

    • String sanitization and formatting
    • Error handling
    • Environment detection
    • Cryptographic signatures
  2. Configuration (config.test.ts)

    • Configuration initialization
    • Singleton pattern validation
    • Configuration getters and setters
    • Feature flag management
  3. Error Reporter (reporter.test.ts)

    • Error report creation and submission
    • Error handling for API communication
    • Hook integration (before/after reporting)
    • Disabled state handling
  4. React Components (components.test.ts)

    • Error boundary functionality
    • Component wrapper behavior
    • Error reporting integration
    • Fallback UI rendering

Running the Tests

To run the tests, use the following command:

npm test

For watch mode during development:

npm run test:watch

To view coverage report:

npm run test:coverage

Test Structure

Each test file focuses on testing a specific module:

  • __tests__/utils.test.ts: Tests for utility functions
  • __tests__/config.test.ts: Tests for the configuration system
  • __tests__/reporter.test.ts: Tests for the error reporting functionality
  • __tests__/components.test.tsx: Tests for React components

Known Issues and Future Improvements

  1. Some tests are currently failing due to mocking issues that need to be addressed:

    • Server-side crypto detection
    • React component state handling
    • API response mocking
  2. Coverage improvements needed for:

    • Middleware functionality
    • Collector modules
    • Index exports
  3. The coverage thresholds are temporarily set low (10%) to allow for progressive implementation. The target coverage should be:

    • Statements: 80%
    • Branches: 70%
    • Functions: 80%
    • Lines: 80%

Contributing to Tests

When adding new tests, follow these guidelines:

  1. Create test cases that isolate functionality as much as possible
  2. Use proper mocking to avoid dependencies on external services
  3. Follow the existing test structure and naming conventions
  4. Ensure test descriptions clearly explain what is being tested
  5. Address edge cases and error scenarios

Mock Structure

The test suite uses Jest's mocking capabilities:

  • Module mocks in individual test files
  • Global mocks in the setup.js file
  • Environment simulation for browser/server contexts

To enhance mock coverage, update the mock implementations in the respective test files or add new globals to the setup.js file.