|
|
|
@ -5,6 +5,7 @@ const childprocess = require('child_process'); |
|
|
|
|
const readline = require('readline'); |
|
|
|
|
const reqCwd = require('req-cwd'); |
|
|
|
|
const istanbul = require('istanbul'); |
|
|
|
|
const treeKill = require('tree-kill'); |
|
|
|
|
const getInstrumentedVersion = require('./instrumentSolidity.js'); |
|
|
|
|
const CoverageMap = require('./coverageMap.js'); |
|
|
|
|
const defaultTruffleConfig = require('./truffleConfig.js'); |
|
|
|
@ -424,25 +425,33 @@ class App { |
|
|
|
|
* @param {String} err error message |
|
|
|
|
*/ |
|
|
|
|
cleanUp(err) { |
|
|
|
|
this.log('Cleaning up...'); |
|
|
|
|
const self = this; |
|
|
|
|
function exit(err){ |
|
|
|
|
if (err) { |
|
|
|
|
self.log(`${err}\nExiting without generating coverage...`); |
|
|
|
|
process.exit(1); |
|
|
|
|
} else if (self.testsErrored) { |
|
|
|
|
self.log('Some truffle tests failed while running coverage'); |
|
|
|
|
process.exit(1); |
|
|
|
|
} else { |
|
|
|
|
self.log('Done.'); |
|
|
|
|
process.exit(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self.log('Cleaning up...'); |
|
|
|
|
shell.config.silent = true; |
|
|
|
|
shell.rm('-Rf', this.coverageDir); |
|
|
|
|
shell.rm('-Rf', self.coverageDir); |
|
|
|
|
shell.rm('./allFiredEvents'); |
|
|
|
|
shell.rm('./scTopics'); |
|
|
|
|
if (this.testrpcProcess) { |
|
|
|
|
this.testrpcProcess.stdout.destroy(); |
|
|
|
|
this.testrpcProcess.stderr.destroy(); |
|
|
|
|
this.testrpcProcess.kill(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
this.log(`${err}\nExiting without generating coverage...`); |
|
|
|
|
process.exit(1); |
|
|
|
|
} else if (this.testsErrored) { |
|
|
|
|
this.log('Some truffle tests failed while running coverage'); |
|
|
|
|
process.exit(1); |
|
|
|
|
if (self.testrpcProcess) { |
|
|
|
|
treeKill(self.testrpcProcess.pid, function(killError){ |
|
|
|
|
self.log(`Shutting down testrpc-sc (pid ${self.testrpcProcess.pid})`) |
|
|
|
|
exit(err) |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
process.exit(0); |
|
|
|
|
exit(err); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|