Skip to content

Commit

Permalink
remove @skip-on-coverage flag
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenSwen committed Mar 28, 2023
1 parent 43ac5b6 commit cdb7292
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ module.exports = {
skipFiles: [
'mocks', 'tests', 'interfaces',
],
mocha: {
grep: "@skip-on-coverage",
invert: true
},
}
6 changes: 6 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import networks from './hardhat.networks';

dotenv.config();

declare module 'hardhat/types/runtime' {
interface HardhatRuntimeEnvironment {
__SOLIDITY_COVERAGE_RUNNING?: boolean;
}
}

const config: HardhatUserConfig = {
solidity: {
version: '0.8.15',
Expand Down
7 changes: 6 additions & 1 deletion test/contracts/StringUtil.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '../../src/prelude';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { ethers } from 'hardhat';
import hre from 'hardhat';

describe('StringUtil', function () {
const uint256TestValue = '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('StringUtil', function () {
}
});

describe('Gas usage @skip-on-coverage', function () {
describe('Gas usage', function () {
it('Uint 256', () => testGasUint256(uint256TestValue, 834));

it('Uint 256 naive', () => testGasNaiveUint256(uint256TestValue, 16277));
Expand Down Expand Up @@ -92,21 +93,25 @@ describe('StringUtil', function () {
it('Single byte naive', () => testGasNaiveBytes(singleByte, 988));

async function testGasUint256(value: string, expectedGas: number) {
if (!hre.__SOLIDITY_COVERAGE_RUNNING) return;
const { stringUtilTest } = await loadFixture(deployStringUtilTest);
await stringUtilTest.toHex(value, expectedGas);
}

async function testGasBytes(value: string, expectedGas: number) {
if (!hre.__SOLIDITY_COVERAGE_RUNNING) return;
const { stringUtilTest } = await loadFixture(deployStringUtilTest);
await stringUtilTest.toHexBytes(value, expectedGas);
}

async function testGasNaiveUint256(value: string, expectedGas: number) {
if (!hre.__SOLIDITY_COVERAGE_RUNNING) return;
const { stringUtilTest } = await loadFixture(deployStringUtilTest);
await stringUtilTest.toHexNaive(value, expectedGas);
}

async function testGasNaiveBytes(value: string, expectedGas: number) {
if (!hre.__SOLIDITY_COVERAGE_RUNNING) return;
const { stringUtilTest } = await loadFixture(deployStringUtilTest);
await stringUtilTest.toHexNaiveBytes(value, expectedGas);
}
Expand Down

0 comments on commit cdb7292

Please sign in to comment.