Skip to content
Gas usage per unit test. Average gas usage per method. (eth-gas-reporter for Buidler)
JavaScript TypeScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts
src
test
.env
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
package-lock.json
package.json
tsconfig.json
tslint.json

README.md

npm version Build Status

buidler-gas-reporter

eth-gas-reporter plugin for buidler. ⛽️

What

A Mocha reporter for Ethereum test suites:

  • Gas usage per unit test.
  • Metrics for method calls and deployments.
  • National currency costs of deploying and using your contract system.
  • CI integration with codechecksbeta

Example report

Screen Shot 2019-06-23 at 2 10 19 PM

Installation

npm install buidler-gas-reporter --save-dev

And add the following to your buidler.config.js:

usePlugin("buidler-gas-reporter");

Configuration

Configuration is optional.

module.exports = {
  gasReporter: {
    currency: 'CHF',
    gasPrice: 21
  }
}

💡 Pro Tip

The options include an enabled key that lets you toggle gas reporting on and off using shell environment variables. When enabled is false, mocha's (faster) default spec reporter is used. Example:

module.exports = {
  gasReporter: {
    enabled: (process.env.REPORT_GAS) ? true : false
  }
}

Usage

This plugin overrides the built-in test task. Gas reports are generated by default with:

npx buidler test

Options / Documentation

A list of options and other useful documentation can be found at eth-gas-reporter

You can’t perform that action at this time.