I tried using eth-gas-reporter with truffle test and a very simple contract and it appeared to work. (see my contract, tests and output below)
What errors do you get?
A work around could be to test the contracts just as logic contracts, (though this doesnโt take into account the overhead of using a Proxy).
Counter.sol
pragma solidity ^0.5.0;
contract Counter {
uint256 public value;
function increase() public {
value++;
}
}
Counter.test.js
const { TestHelper } = require('@openzeppelin/cli');
const { Contracts, ZWeb3 } = require('@openzeppelin/upgrades');
const {
BN, // Big Number support
constants, // Common constants, like the zero address and largest integers
expectEvent, // Assertions for emitted events
expectRevert, // Assertions for transactions that should fail
} = require('@openzeppelin/test-helpers');
ZWeb3.initialize(web3.currentProvider);
const Counter = Contracts.getFromLocal('Counter');
require('chai').should();
contract('Counter (upgradeable)', function () {
beforeEach(async function () {
this.project = await TestHelper();
this.proxy = await this.project.createProxy(Counter);
})
it('should have a value', async function () {
const result = await this.proxy.methods.value().call();
result.should.be.bignumber.equal('0');
})
it('should increase value', async function () {
await this.proxy.methods.increase().send();
const result = await this.proxy.methods.value().call();
result.should.be.bignumber.equal('1');
})
})
Counter.logic.test.js
const {
BN, // Big Number support
constants, // Common constants, like the zero address and largest integers
expectEvent, // Assertions for emitted events
expectRevert, // Assertions for transactions that should fail
} = require('@openzeppelin/test-helpers');
const Counter = artifacts.require('Counter');
require('chai').should();
contract('Counter (logic)', function () {
beforeEach(async function () {
this.counter = await Counter.new();
})
it('should have a value', async function () {
const result = await this.counter.value();
result.should.be.bignumber.equal('0');
})
it('should increase value', async function () {
await this.counter.increase();
const result = await this.counter.value();
result.should.be.bignumber.equal('1');
})
})
Truffle Test
$ truffle test
Using network 'test'.
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Contract: Counter (logic)
โ should have a value
โ should increase value (41653 gas)
Contract: Counter (upgradeable)
โ should have a value
โ should increase value (43218 gas)
ยท----------------------------------------|----------------------------|-------------|----------------------------ยท
| Solc version: 0.5.12+commit.7709ece9 ยท Optimizer enabled: false ยท Runs: 200 ยท Block limit: 6721975 gas โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Methods ยท 1 gwei/gas ยท 124.42 eur/eth โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Contract ยท Method ยท Min ยท Max ยท Avg ยท # calls ยท eur (avg) โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Counter ยท increase ยท 41653 ยท 43218 ยท 42436 ยท 2 ยท 0.01 โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Deployments ยท ยท % of limit ยท โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Counter ยท - ยท - ยท 99651 ยท 1.5 % ยท 0.01 โ
ยท----------------------------------------|--------------|-------------|-------------|--------------|-------------ยท
4 passing (13s)