|
|
@ -73,13 +73,7 @@ if (config.silent) { |
|
|
|
// environment folder.
|
|
|
|
// environment folder.
|
|
|
|
log('Generating coverage environment'); |
|
|
|
log('Generating coverage environment'); |
|
|
|
try { |
|
|
|
try { |
|
|
|
// Truffle environment:
|
|
|
|
let files = shell.ls(workingDir); |
|
|
|
// contracts/
|
|
|
|
|
|
|
|
// test/
|
|
|
|
|
|
|
|
// migrations/
|
|
|
|
|
|
|
|
// truffle.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let files = shell.ls(`${workingDir}`); |
|
|
|
|
|
|
|
const nmIndex = files.indexOf('node_modules'); |
|
|
|
const nmIndex = files.indexOf('node_modules'); |
|
|
|
|
|
|
|
|
|
|
|
if (!config.copyNodeModules && nmIndex > -1) { |
|
|
|
if (!config.copyNodeModules && nmIndex > -1) { |
|
|
@ -87,15 +81,14 @@ try { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
files = files.map(file => `${workingDir}/` + file); |
|
|
|
files = files.map(file => `${workingDir}/` + file); |
|
|
|
shell.mkdir(`${coverageDir}`); |
|
|
|
shell.mkdir(coverageDir); |
|
|
|
shell.cp('-R', files, `${coverageDir}`); |
|
|
|
shell.cp('-R', files, coverageDir); |
|
|
|
|
|
|
|
|
|
|
|
const truffleConfig = reqCwd.silent(`${workingDir}/truffle.js`); |
|
|
|
const truffleConfig = reqCwd.silent(`${workingDir}/truffle.js`); |
|
|
|
|
|
|
|
|
|
|
|
// Coverage network opts specified: copy truffle.js whole to coverage environment
|
|
|
|
// Coverage network opts specified: use port if declared
|
|
|
|
if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) { |
|
|
|
if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) { |
|
|
|
port = truffleConfig.networks.coverage.port || port; |
|
|
|
port = truffleConfig.networks.coverage.port || port; |
|
|
|
shell.cp(`${workingDir}/truffle.js`, `${coverageDir}/truffle.js`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Coverage network opts NOT specified: default to the development network w/ modified
|
|
|
|
// Coverage network opts NOT specified: default to the development network w/ modified
|
|
|
|
// port, gasLimit, gasPrice. Export the config object only.
|
|
|
|
// port, gasLimit, gasPrice. Export the config object only.
|
|
|
@ -203,9 +196,7 @@ try { |
|
|
|
istanbulReporter.add('html'); |
|
|
|
istanbulReporter.add('html'); |
|
|
|
istanbulReporter.add('lcov'); |
|
|
|
istanbulReporter.add('lcov'); |
|
|
|
istanbulReporter.add('text'); |
|
|
|
istanbulReporter.add('text'); |
|
|
|
istanbulReporter.write(istanbulCollector, true, () => { |
|
|
|
istanbulReporter.write(istanbulCollector, true); |
|
|
|
log('Istanbul coverage reports generated'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|
if (config.testing) { |
|
|
|
if (config.testing) { |
|
|
|
cleanUp(); |
|
|
|
cleanUp(); |
|
|
|