aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-12 01:11:27 +0800
committerGitHub <noreply@github.com>2018-05-12 01:11:27 +0800
commit6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b (patch)
tree8d374bf8f4f70a40d75c8bf4b35fe9a169250909 /packages/sol-cov
parentf42f608f3f97a5244f09f17ae5ee184c0f775de3 (diff)
parentad8e12eeaebd40fdafac7cbef96121d4454909df (diff)
downloaddexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.tar
dexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.tar.gz
dexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.tar.bz2
dexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.tar.lz
dexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.tar.xz
dexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.tar.zst
dexon-sol-tools-6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b.zip
Merge pull request #579 from 0xProject/breakUp0xjs
Split 0x.js into: contract-wrappers & order-watcher
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/package.json5
-rw-r--r--packages/sol-cov/src/coverage_manager.ts5
2 files changed, 9 insertions, 1 deletions
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index f57a317de..6268df4c7 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -12,7 +12,7 @@
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha lib/test/**/*_test.js --exit",
- "clean": "shx rm -rf lib scripts",
+ "clean": "shx rm -rf lib scripts test/fixtures/artifacts src/artifacts",
"build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"compile_test": "node ../sol-compiler/lib/src/cli.js compile",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
@@ -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(