Handle truffle provider config restrictions & process killing

pull/385/head
cgewecke 5 years ago
parent ccb7bcf358
commit 826d9d59e8
  1. 14
      dist/truffle.plugin.js

@ -27,6 +27,7 @@
const App = require('./../lib/app'); const App = require('./../lib/app');
const req = require('req-cwd'); const req = require('req-cwd');
const death = require('death');
const path = require('path'); const path = require('path');
const dir = require('node-dir'); const dir = require('node-dir');
const Web3 = require('web3'); const Web3 = require('web3');
@ -50,6 +51,7 @@ async function plugin(truffleConfig){
// Start // Start
app = new App(coverageConfig); app = new App(coverageConfig);
death(app.cleanUp);
// Write instrumented sources to temp folder // Write instrumented sources to temp folder
app.instrument(); app.instrument();
@ -72,12 +74,18 @@ async function plugin(truffleConfig){
const provider = await app.provider(ganache); const provider = await app.provider(ganache);
const accounts = await (new Web3(provider)).eth.getAccounts(); const accounts = await (new Web3(provider)).eth.getAccounts();
truffleConfig.provider = provider;
truffleConfig.network = networkName; truffleConfig.network = networkName;
// Truffle alternately complains that fields are and
// are not manually set
try {
truffleConfig.network_id = "*"; truffleConfig.network_id = "*";
truffleConfig.provider = provider;
} catch (err){}
truffleConfig.networks[networkName] = { truffleConfig.networks[networkName] = {
network_id: truffleConfig.network_id, network_id: "*",
provider: truffleConfig.provider, provider: provider,
gas: app.gasLimit, gas: app.gasLimit,
gasPrice: app.gasPrice, gasPrice: app.gasPrice,
from: accounts[0] from: accounts[0]

Loading…
Cancel
Save