diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-11 23:41:25 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-11 23:41:25 +0800 |
commit | fb9c7745582166143ff421253144120ed84d57ad (patch) | |
tree | a5db665ca3daf21a9282809abf10616fe51f51c9 /packages/sol-cov/src/coverage_manager.ts | |
parent | 7df9393d2952a55c301560aa5dfda1131bfe1381 (diff) | |
download | dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.tar dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.tar.gz dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.tar.bz2 dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.tar.lz dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.tar.xz dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.tar.zst dexon-sol-tools-fb9c7745582166143ff421253144120ed84d57ad.zip |
Create coverage dir if doesn't exist
Diffstat (limited to 'packages/sol-cov/src/coverage_manager.ts')
-rw-r--r-- | packages/sol-cov/src/coverage_manager.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index f50f010b9..800ca96dd 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -1,7 +1,9 @@ +import { promisify } from '@0xproject/utils'; import { addHexPrefix } from 'ethereumjs-util'; import * as fs from 'fs'; import { Collector } from 'istanbul'; import * as _ from 'lodash'; +import * as mkdirp from 'mkdirp'; import * as path from 'path'; import { collectContractsData } from './collect_contract_data'; @@ -29,6 +31,8 @@ import { } from './types'; import { utils } from './utils'; +const mkdirpAsync = promisify<undefined>(mkdirp); + export class CoverageManager { private _sourcesPath: string; private _traceInfos: TraceInfo[] = []; @@ -49,6 +53,7 @@ export class CoverageManager { public async writeCoverageAsync(): Promise<void> { const finalCoverage = await this._computeCoverageAsync(); const stringifiedCoverage = JSON.stringify(finalCoverage, null, '\t'); + await mkdirpAsync('coverage'); fs.writeFileSync('coverage/coverage.json', stringifiedCoverage); } private _getSingleFileCoverageForTrace( |