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

ministro-tool

v0.2.2

Published

JavaScript tool created for helping in process of testing solidity smart contracts.

Readme

Ministro Tool for Ministro Contract

JavaScript tool created for helping in process of testing solidity smart contracts.

What MinistroTool is?

Short answer: it is a tool that helps you create ministro contract.
Now let's explain what Ministro contract is.

When you testing solidity contracts, you have a lot of repeated code like:

it('should do something', () => {
  await instance.foo()
  assert(foo)
}

it('should do something again', () => {
  await instance.foo()
  assert(foo)
}

Once you tested your foo() in one scenario, in most cases you not checking it next time, you using foo() (in some other scenarios...) - and this is not good.

MinistroContract allows you to write test conditions once and use them in each case scenario with just one line of code.
Thanks to this, your tests are very strong, easy to understand and you have clean, short code.

How can I use ministro tool/contract?

The best way to understand how to use it, is to review the simple example in test directory.

Basically you need to create ministroContract that reflect all methods that real smart contract has.
Each ministroContract must have all methods from smart contract (including public readers). Each method must have all possible test you can perform base ONLY (!) on input (arguments) and output (events, return values) data.
You also must cover scenario, when method throw (if this is a case).

When you do all that, you just execute a method on ministroContract and ech time you do it in your tests scenarios, all this tests that you wrote (in ministro method) will be executed and checked.

There are also some additional helpers mechanisms here like:

  • checking is transaction was successful or throw
  • read all events for transaction

Ministro Methods

Each ministro method must have:

  • parameters that are equal to smart contract instance (required)
  • object with transaction parameters (optional)
  • parameter that inform us, if this execution is expected to throw (optional)

How to use it in tests?

Please review the code of example test/ministro-contracts/ministroOwnable.js - its pretty simple, so you should be able to understand how to use it.

Note: this test might not be enough for each cases, if some external data are present and ministro contract do not have access to them, you need to check them directly in test file (outside ministro).

DO NOT modify ministro by adding additional params to the method, because this is not how it should work.
MinistroContract test should be the same for ALL cases and they should work the same each time, so anybody can use it in any scenario and not worry abut your special case.

Installation

git clone <this-repo>
git hf init
npm install

Run test

npm run lint
npm run test

NPM package update

After each release npm package should be updated.
To make it easy please remember to always update version is package.json :) then you need just:

npm publish

In case of any issues, please refer to documentation.