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

json-api-tester

v0.2.2

Published

test json ajax calls using a simple json file

Readme

JSON API Tester

This program takes a list of JSON api calls and checks you get back what you expected. It can be run on all files in a directory on a single file or simply pass in an object containing one or more tests. Internally it uses https://github.com/5app/json-assert to do the matching.

It can handle posting files, waiting a set time for the back-end to finish processing, and expecting set content-types or status codes.

Installation

npm install --save json-api-tester

Usage

The magic all-in-one program:

var jsonApiTester = require('json-api-tester');
var args = jsonApiTester.processCmdLineArgs(process.argv);
jsonApiTester.test(args);

A more telling example:

var jsonApiTester = require('json-api-tester');
var ja = require('json-assert');

var serverName = "https://api.5app.com";
var verbosity = 1;

var testArray = [

  // check that doing a GET to `/hello` returns some JSON with a message
  // of "hello world" and a 200 status code.
  {
    url: "/hello",
    method: "GET",
    status: 200,
    returns: {
      message: "hello world"
    }
  },

  // wait 5 seconds for no real reason
  {
    wait: 5000
  },

  // do a post with JSON arguments
  // we don't care what we get back
  {
    url: "/users/123",
    method: "POST",
    args: {
        name: "bob",
        size: "15",
        hair: "none",
        height: "162"
    },
    status: ja.matchType('number'),
    returns: ja.dontCare()
  }
];

jsonApiTester.testArray(arr, serverName, verbosity, function(err, result) {

});

Tests and Development tools

npm test       # unittests (mocha) and integration tests (literate DOCS.js)
npm run lint   # styleguide and code smells
npm run fix    # try to autofix styleguide errors
npm run cover  # create a code coverage report
npm run docs   # create HTML documentation

Contributing

Make sure your code:

  • that all new code has unit tests added
  • that all new/changed functionality is documented in DOCS.js (this may involve changing the test/docs.js server which runs the code from DOCS.js as the integration tests.)
  • that you match the styleguide npm run lint
  • that all tests pass npm test

Then submit a pull request.