Skip to content

Commit

Permalink
fix: make coverage more forgiving
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros authored and iurimatias committed Apr 22, 2019
1 parent 6b16f66 commit 0f4e554
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/embark/src/lib/modules/coverage/contractEnhanced.ts
Expand Up @@ -32,13 +32,17 @@ export class ContractEnhanced {

constructor(public filepath: string, public solcVersion: string) {
this.id = nextId();

// silence compiler warnings.
this.source = this.originalSource = "";

try {
this.source = fs.readFileSync(filepath, "utf-8");
this.originalSource = this.source;
this.ast = parser.parse(this.source, {loc: true, range: true});
} catch (error) {
this.source = "";
this.originalSource = "";
const {line, column, message} = error.errors[0];
console.warn(`Error on ${this.filepath}:${line}:${column}: "${message}". Could not setup for coverage.`);
}

this.coverageFilepath = path.join(coverageContractsPath(), this.filepath);
Expand Down

0 comments on commit 0f4e554

Please sign in to comment.