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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nolemmings/mockingbird

v0.3.3

Published

REST mock server.

Readme

mockingbird

A stand-alone express server which allows dynamically registering a mock request and consume them when called. This server allows you to build a fake backend without much overhead, complex mocking frameworks for your framework/language/whatever. Just start the server, make a request describing your expectation and run your actual test.

Installation

yarn add -D @nolemmings/mockingbird

or

npm install @nolemmings/mockingbird

Run

Start the server like a normal express server:

var mockingbird = require('@nolemmings/mockingbird');

var server = mockingbird.listen(3000, function() {
  var port = server.address().port;
  console.log('App listening at http://localhost:%s', port);
});

Create an Expectation

To register which requests you want to trigger and what response you'd like to have returned you must create an expectation.

Request:

POST /tests/eae37fb0/expectations

{
  "request": {
    "method": "post",
    "url": "/users/123",
    "body": {
      "some": "object"
    }
  },
  "response": {
    "status": 200,
    "body": {
      "id": "123",
      "name": "Johnny",
      "email": "[email protected]"
    }
  },
  "repeat": 3
}

Set repeat to -1 to repeat indefinitely.

Body is an optional param which when omitted ensures any request body is accepted.

Response:

{
   "id": "7df3567b-3b84-4496-8df5-57506c51eabb",
   "testId": "eae37fb0",
   "request": {
      "method": "post",
      "url": "/users/123",
      "body": {
        "some": "object"
      }
   },
   "response": {
      "status": 200,
      "body": {
         "id": "123",
         "name": "Johnny",
         "email": "[email protected]"
      }
   },
   "repeat": 3,
   "requestCount": 0
}

When a request has been triggered the number of times defined in repeat it will start returning a 404 with an error message.

Retrieve an Expectation

To get the latests details about an expectation you can retrieve it as follows:

Request:

GET /tests/eae37fb0/expectations/7df3567b-3b84-4496-8df5-57506c51eabb

Response:

{
   "id": "7df3567b-3b84-4496-8df5-57506c51eabb",
   "testId": "eae37fb0",
   "request": {
      "method": "get",
      "url": "/users/123"
   },
   "response": {
      "status": 200,
      "body": {
         "id": "123",
         "name": "Johnny",
         "email": "[email protected]"
      },
      "headers": {
        "X-RateLimit-Limit": "5000",
        "X-RateLimit-Remaining": "4999"
      }
   },
   "repeat": 3,
   "requestCount": 0
}

Get all test expectations

Return all expectations.

GET /tests/eae37fb0

Remove a Test

To delete all expectations for a specific test case simply run the following:

DELETE /tests/eae37fb0

Running a mock request

When you've registered an expectation you can trigger it by simply calling the specified url and method.

For example:

curl -v -H "Content-Type: application/json" -X GET localhost:3000/users/123

Response:

{
  "id": "123",
  "name": "Johnny",
  "email": "[email protected]"
}

Returns 429 Too Many Requests when the request count is more than the specified number of repetitions. Returns 404 Not Found when expectation could not be found.