diff --git a/lib/app.js b/lib/app.js index 8563bf2..88a18cd 100644 --- a/lib/app.js +++ b/lib/app.js @@ -222,8 +222,8 @@ class App { // Generate Istanbul report try { this.coverage.generate(this.events, `${this.workingDir}/contracts`); - - const json = JSON.stringify(this.coverage.coverage); + const relativeMapping = App.makeKeysRelative(this.coverage.coverage, this.workingDir); + const json = JSON.stringify(relativeMapping); fs.writeFileSync('./coverage.json', json); collector.add(this.coverage.coverage); diff --git a/test/assert.js b/test/assert.js index a5a97eb..2f074c1 100644 --- a/test/assert.js +++ b/test/assert.js @@ -8,7 +8,7 @@ const vm = require('./util/vm'); const assert = require('assert'); describe('asserts and requires', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should cover assert statements as if they are if statements when they pass', done => { diff --git a/test/comments.js b/test/comments.js index 53ace54..036d251 100644 --- a/test/comments.js +++ b/test/comments.js @@ -6,7 +6,7 @@ const util = require('./util/util.js'); const solc = require('solc'); describe('comments', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should cover functions even if comments are present immediately after the opening {', () => { diff --git a/test/conditional.js b/test/conditional.js index d66d66a..21ad227 100644 --- a/test/conditional.js +++ b/test/conditional.js @@ -8,7 +8,7 @@ const vm = require('./util/vm'); const assert = require('assert'); describe('conditional statements', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should cover a conditional that reaches the consequent (same-line)', done => { diff --git a/test/expressions.js b/test/expressions.js index 96ef2bf..fd3558b 100644 --- a/test/expressions.js +++ b/test/expressions.js @@ -11,7 +11,7 @@ const path = require('path'); * and passing the error to mocha. */ describe('generic expressions', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); it('should compile after instrumenting a single binary expression', () => { const contract = util.getCode('expressions/single-binary-expression.sol'); diff --git a/test/function.js b/test/function.js index e7156ec..dff9745 100644 --- a/test/function.js +++ b/test/function.js @@ -14,7 +14,7 @@ const assert = require('assert'); * and passing the error to mocha. */ describe('function declarations', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should compile after instrumenting an ordinary function declaration', () => { diff --git a/test/if.js b/test/if.js index a779f08..4c8fd82 100644 --- a/test/if.js +++ b/test/if.js @@ -8,7 +8,7 @@ const vm = require('./util/vm'); const assert = require('assert'); describe('if, else, and else if statements', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should cover an if statement with a bracketed consequent', done => { diff --git a/test/loops.js b/test/loops.js index b6b8437..6cba5e5 100644 --- a/test/loops.js +++ b/test/loops.js @@ -8,7 +8,7 @@ const vm = require('./util/vm'); const assert = require('assert'); describe('for and while statements', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should cover a for statement with a bracketed body (multiline)', done => { diff --git a/test/statements.js b/test/statements.js index 2a38f66..1c3c6e9 100644 --- a/test/statements.js +++ b/test/statements.js @@ -14,7 +14,7 @@ const assert = require('assert'); * and passing the error to mocha. */ describe('generic statements', () => { - const filePath = path.resolve('./test.sol').split('\\').join('/'); + const filePath = path.resolve('./test.sol'); const pathPrefix = './'; it('should compile after instrumenting a single statement (first line of function)', () => {