Skip to content

Commit d9af5ac

Browse files
authored
Gracefully overwrite eth-gas-reporter (#448)
1 parent f2cdb63 commit d9af5ac

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

plugins/resources/truffle.utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ function normalizeConfig(config){
194194
config.testDir = config.test_directory;
195195
config.artifactsDir = config.build_directory;
196196

197+
// eth-gas-reporter freezes the in-process client because it uses sync calls
198+
if (typeof config.mocha === "object" && config.mocha.reporter === 'eth-gas-reporter'){
199+
config.mocha.reporter = 'spec';
200+
delete config.mocha.reporterOptions;
201+
}
202+
197203
return config;
198204
}
199205

test/units/truffle/standard.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ describe('Truffle Plugin: standard use cases', function() {
215215
);
216216
});
217217

218+
// This test errors if the reporter is not re-designated as 'spec' correctly
219+
it('gracefully disables eth-gas-reporter', async function(){
220+
truffleConfig.mocha = { reporter: 'eth-gas-reporter' };
221+
222+
mock.install('Simple', 'simple.js', solcoverConfig);
223+
await plugin(truffleConfig);
224+
});
225+
218226
// This test tightly coupled to the ganache version in production deps
219227
// "test-files" project solcoverjs includes `client: require('ganache-cli')`
220228
it('config: client', async function(){

0 commit comments

Comments
 (0)