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 🙏

© 2024 – Pkg Stats / Ryan Hefner

grandma

v0.10.0

Published

Load testing CLI tool

Downloads

99

Readme

Linux Build Windows Build Test Coverage Code Climate Downloads Version Dependency Status

This is a load testing library and CLI tool. It is inspired by the good parts of Vegeta and JMeter, but hopefully leaves out the bad parts of both.

Install

You can install grandma as a global CLI tool:

npm install grandma

Test files

Here is a quick example of a test file:

module.exports = {
    beforeAll: function(done) {
        process.nextTick(done);
    },
    beforeEach: function(done) {
        process.nextTick(done);
    },
    test: function(done) {
        process.nextTick(done);
    },
    afterEach: function(done) {
        process.nextTick(done);
    },
    afterAll: function(done) {
        process.nextTick(done);
    }
};

All functions other than test are optional, and you can exclude them if you do not need them. All functions are asynchronous, and you must call the done callback to continue. For more information about writing tests, see the test files help topic.

CLI

To see the most up-to-date CLI, type:

grandma help

The following commands are available.

grandma run <testname> --duration=<duration> --rate=<rate> [options]
grandma report [glob=stdin] [options]
grandma list [options]

To see help on these commands, you can type one of:

grandma run --help
grandma report --help

The following options are available as flags (some are only relevant for the run command):

grandma list

Lists all the tests in your test suite. You can use these names in grandma run to run the test. See more information bout it in the granda list CLI page.

grandma run

Run a test named "pineapples" for 10 minutes at a rate of 500 tests per second:

grandma run pineapples --duration 10m --rate 500 --out pineapples.log

Run a test named "peaches" for one and a half hours, running 100 concurrent tests:

grandma run peaches --duration 1h30m --concurrent 100 --out peaches.log

To find out more about the CLI, please see the grandma run CLI page.

Note: I will assume that you have configured the test directory in the .grandmarc file, so it was not included it in these examples.

grandma report

Print a plain text report of the previously-described test run:

grandma report pineapples.log

You can also create an HTML page containing an interactive graph of the results:

grandma report pineapples.log --type html --out pineapples.html

By default, all reports will print to standard output, unless you specify a file in the --out flag.

You can find more information about the available reports and the data they provide in the grandma report CLI page.

grandma diff

Compares two or more test runs, calculating the difference in timing among them.

grandma diff --logs one.log two.log three.log

.grandmarc file

You can set up an RC file to help with managing some of the setting, such as the directory of test files. Here is the content a sample file.

To find out more, see the .grandmarc doc page.

API

Grandma exposes the run and report commands as an API.

var grandma = require('grandma');

grandma.run

See more information about using run in the grandma.run API page.

grandma.report

See more information about using report in the grandma.report API page.