Merge pull request #125 from sc-forks/fix-bad-merge-116

Add relative mapping logic, remove path corrections in tests
pull/126/head
c-g-e-w-e-k-e- 7 years ago committed by GitHub
commit ed1490f609
  1. 4
      lib/app.js
  2. 2
      test/assert.js
  3. 2
      test/comments.js
  4. 2
      test/conditional.js
  5. 2
      test/expressions.js
  6. 2
      test/function.js
  7. 2
      test/if.js
  8. 2
      test/loops.js
  9. 2
      test/statements.js

@ -222,8 +222,8 @@ class App {
// Generate Istanbul report // Generate Istanbul report
try { try {
this.coverage.generate(this.events, `${this.workingDir}/contracts`); this.coverage.generate(this.events, `${this.workingDir}/contracts`);
const relativeMapping = App.makeKeysRelative(this.coverage.coverage, this.workingDir);
const json = JSON.stringify(this.coverage.coverage); const json = JSON.stringify(relativeMapping);
fs.writeFileSync('./coverage.json', json); fs.writeFileSync('./coverage.json', json);
collector.add(this.coverage.coverage); collector.add(this.coverage.coverage);

@ -8,7 +8,7 @@ const vm = require('./util/vm');
const assert = require('assert'); const assert = require('assert');
describe('asserts and requires', () => { describe('asserts and requires', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should cover assert statements as if they are if statements when they pass', done => { it('should cover assert statements as if they are if statements when they pass', done => {

@ -6,7 +6,7 @@ const util = require('./util/util.js');
const solc = require('solc'); const solc = require('solc');
describe('comments', () => { describe('comments', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should cover functions even if comments are present immediately after the opening {', () => { it('should cover functions even if comments are present immediately after the opening {', () => {

@ -8,7 +8,7 @@ const vm = require('./util/vm');
const assert = require('assert'); const assert = require('assert');
describe('conditional statements', () => { describe('conditional statements', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should cover a conditional that reaches the consequent (same-line)', done => { it('should cover a conditional that reaches the consequent (same-line)', done => {

@ -11,7 +11,7 @@ const path = require('path');
* and passing the error to mocha. * and passing the error to mocha.
*/ */
describe('generic expressions', () => { 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', () => { it('should compile after instrumenting a single binary expression', () => {
const contract = util.getCode('expressions/single-binary-expression.sol'); const contract = util.getCode('expressions/single-binary-expression.sol');

@ -14,7 +14,7 @@ const assert = require('assert');
* and passing the error to mocha. * and passing the error to mocha.
*/ */
describe('function declarations', () => { describe('function declarations', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should compile after instrumenting an ordinary function declaration', () => { it('should compile after instrumenting an ordinary function declaration', () => {

@ -8,7 +8,7 @@ const vm = require('./util/vm');
const assert = require('assert'); const assert = require('assert');
describe('if, else, and else if statements', () => { describe('if, else, and else if statements', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should cover an if statement with a bracketed consequent', done => { it('should cover an if statement with a bracketed consequent', done => {

@ -8,7 +8,7 @@ const vm = require('./util/vm');
const assert = require('assert'); const assert = require('assert');
describe('for and while statements', () => { describe('for and while statements', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should cover a for statement with a bracketed body (multiline)', done => { it('should cover a for statement with a bracketed body (multiline)', done => {

@ -14,7 +14,7 @@ const assert = require('assert');
* and passing the error to mocha. * and passing the error to mocha.
*/ */
describe('generic statements', () => { describe('generic statements', () => {
const filePath = path.resolve('./test.sol').split('\\').join('/'); const filePath = path.resolve('./test.sol');
const pathPrefix = './'; const pathPrefix = './';
it('should compile after instrumenting a single statement (first line of function)', () => { it('should compile after instrumenting a single statement (first line of function)', () => {

Loading…
Cancel
Save