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 | |
parent | 7df9393d2952a55c301560aa5dfda1131bfe1381 (diff) | |
download | dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.tar dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.tar.gz dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.tar.bz2 dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.tar.lz dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.tar.xz dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.tar.zst dexon-0x-contracts-fb9c7745582166143ff421253144120ed84d57ad.zip |
Create coverage dir if doesn't exist
Diffstat (limited to 'packages')
-rw-r--r-- | packages/sol-cov/package.json | 3 | ||||
-rw-r--r-- | packages/sol-cov/src/coverage_manager.ts | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 0cef9ff87..6268df4c7 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -46,10 +46,12 @@ "@0xproject/subproviders": "^0.10.1", "@0xproject/types": "^0.6.3", "@0xproject/typescript-typings": "^0.3.1", + "@0xproject/utils": "^0.6.1", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", "istanbul": "^0.4.5", "lodash": "^4.17.4", + "mkdirp": "^0.5.1", "semaphore-async-await": "^1.5.1", "solidity-parser-antlr": "^0.2.8" }, @@ -57,6 +59,7 @@ "@0xproject/monorepo-scripts": "^0.1.19", "@0xproject/tslint-config": "^0.4.17", "@types/istanbul": "^0.4.30", + "@types/mkdirp": "^0.5.1", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", "chai": "^4.0.1", 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( |