From bc8e0b89312bf3d278c8b32011e367bee69a17aa Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 29 Jul 2017 11:45:55 -0700 Subject: [PATCH] Fix lcov html report bug --- lib/app.js | 5 +++-- test/app.js | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/app.js b/lib/app.js index 4e9e793..02bb1e7 100644 --- a/lib/app.js +++ b/lib/app.js @@ -104,7 +104,8 @@ class App { currentFile = file; const contractPath = path.resolve(file); - const canonicalPath = contractPath.split(this.coverageDir).join(''); + const working = this.workingDir.substring(1); + const canonicalPath = contractPath.split('/coverageEnv').join(working); const contract = fs.readFileSync(contractPath).toString(); const instrumentedContractInfo = getInstrumentedVersion(contract, canonicalPath); fs.writeFileSync(contractPath, instrumentedContractInfo.contract); @@ -197,7 +198,7 @@ class App { return new Promise((resolve, reject) => { try { - this.coverage.generate(this.events, './contracts'); + this.coverage.generate(this.events, `${this.workingDir}/contracts`); const json = JSON.stringify(this.coverage.coverage); fs.writeFileSync('./coverage.json', json); diff --git a/test/app.js b/test/app.js index e3a5706..6ec5c50 100644 --- a/test/app.js +++ b/test/app.js @@ -60,6 +60,7 @@ describe('app', () => { const testConfig = Object.assign({}, config); testConfig.testrpcOptions = `--account="${privateKey},${balance}" --port 8777`; + testConfig.dir = './mock', testConfig.norpc = false; testConfig.port = 8777; @@ -78,6 +79,7 @@ describe('app', () => { const testConfig = Object.assign({}, config); testConfig.testCommand = 'mocha --timeout 5000 > /dev/null 2>&1'; + testConfig.dir = './mock', testConfig.norpc = false; testConfig.port = 8888; @@ -96,6 +98,7 @@ describe('app', () => { const testConfig = Object.assign({}, config); testConfig.testCommand = 'node ../test/util/mockTestCommand.js'; + testConfig.dir = './mock', testConfig.norpc = false; testConfig.port = 8888; @@ -115,6 +118,7 @@ describe('app', () => { const testConfig = Object.assign({}, config); + testConfig.dir = './mock', testConfig.norpc = false; testConfig.port = 8889; @@ -155,6 +159,7 @@ describe('app', () => { };`; const testConfig = Object.assign({}, config); + testConfig.dir = './mock', testConfig.norpc = false; testConfig.port = 8555; // Manually inspect that port is actually set to 8999