aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-07 18:21:44 +0800
committerFabio Berger <me@fabioberger.com>2018-06-07 18:21:44 +0800
commit10478a6b2fd1f2a01597a88afde9cf582640a849 (patch)
tree3ebbb29656cf59b2547ec3c5a3c5b90ee6264483 /packages/sol-cov
parentcf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78 (diff)
parente0bc01eea1c20e0afda296f331c6a475e062b59c (diff)
downloaddexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.tar
dexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.tar.gz
dexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.tar.bz2
dexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.tar.lz
dexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.tar.xz
dexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.tar.zst
dexon-sol-tools-10478a6b2fd1f2a01597a88afde9cf582640a849.zip
Merge branch 'v2-prototype' into refactor/move-spawn-switch-to-utils
* v2-prototype: (66 commits) Run prettier Remove unused variable Fix linting issues Change shouldRenderHeader prop to shouldHideHeader Get build and tests to pass typo Apply prettier Update contracts tests after rebase Apply various fixes based on PR feedback Document debug_increaseTime method and fix typo in devnet README Use an enum for ProviderType in contracts/src/utils/web3_wrapper Update contracts package README Update relevant changelogs Remove global gas estimate buffer Add Async suffix to relevant assertions Fix linter errors Update package.json and yarn.lock Update more things to work with both Geth and Ganache Small fixes and cleanup Add additional gas to calls to fillOrderNoThrow ... # Conflicts: # packages/order-watcher/src/order_watcher/order_watcher.ts # packages/react-docs/src/components/type.tsx # packages/website/ts/components/ui/lifecycle_raised_button.tsx # packages/website/ts/components/wallet/wallet.tsx
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts1
-rw-r--r--packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts4
-rw-r--r--packages/sol-cov/src/collect_coverage_entries.ts2
-rw-r--r--packages/sol-cov/src/coverage_manager.ts10
-rw-r--r--packages/sol-cov/src/coverage_subprovider.ts1
-rw-r--r--packages/sol-cov/src/source_maps.ts2
-rw-r--r--packages/sol-cov/src/trace.ts5
-rw-r--r--packages/sol-cov/test/instructions_test.ts2
-rw-r--r--packages/sol-cov/test/trace_test.ts2
9 files changed, 6 insertions, 23 deletions
diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
index d08828bf6..6e385203b 100644
--- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
@@ -32,7 +32,6 @@ export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter {
const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
let sources = _.keys(artifact.sources);
sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath));
- const contractName = artifact.contractName;
const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString());
const contractData = {
sourceCodes,
diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
index c7f21b6eb..53449e5e1 100644
--- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
@@ -1,8 +1,4 @@
import { Compiler, CompilerOptions } from '@0xproject/sol-compiler';
-import * as fs from 'fs';
-import * as glob from 'glob';
-import * as _ from 'lodash';
-import * as path from 'path';
import * as rimraf from 'rimraf';
import { ContractData } from '../types';
diff --git a/packages/sol-cov/src/collect_coverage_entries.ts b/packages/sol-cov/src/collect_coverage_entries.ts
index 97218616c..b145f044e 100644
--- a/packages/sol-cov/src/collect_coverage_entries.ts
+++ b/packages/sol-cov/src/collect_coverage_entries.ts
@@ -1,7 +1,5 @@
import * as ethUtil from 'ethereumjs-util';
-import * as fs from 'fs';
import * as _ from 'lodash';
-import * as path from 'path';
import * as parser from 'solidity-parser-antlr';
import { ASTVisitor, CoverageEntriesDescription } from './ast_visitor';
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts
index 31b0e6fbc..064338a32 100644
--- a/packages/sol-cov/src/coverage_manager.ts
+++ b/packages/sol-cov/src/coverage_manager.ts
@@ -1,11 +1,10 @@
import { promisify } from '@0xproject/utils';
-import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
+import { stripHexPrefix } from 'ethereumjs-util';
import * as fs from 'fs';
import { Collector } from 'istanbul';
import * as _ from 'lodash';
-import { getLogger, levels, Logger, LogLevel } from 'loglevel';
+import { getLogger, levels, Logger } from 'loglevel';
import * as mkdirp from 'mkdirp';
-import * as path from 'path';
import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter';
import { collectCoverageEntries } from './collect_coverage_entries';
@@ -14,18 +13,14 @@ import { parseSourceMap } from './source_maps';
import {
BranchCoverage,
BranchDescription,
- BranchMap,
ContractData,
Coverage,
- FnMap,
FunctionCoverage,
FunctionDescription,
- LineColumn,
SingleFileSourceRange,
SourceRange,
StatementCoverage,
StatementDescription,
- StatementMap,
TraceInfo,
TraceInfoExistingContract,
TraceInfoNewContract,
@@ -38,6 +33,7 @@ export class CoverageManager {
private _artifactAdapter: AbstractArtifactAdapter;
private _logger: Logger;
private _traceInfos: TraceInfo[] = [];
+ // tslint:disable-next-line:no-unused-variable
private _getContractCodeAsync: (address: string) => Promise<string>;
private static _getSingleFileCoverageForTrace(
contractData: ContractData,
diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts
index ca7f4aed2..13b76f537 100644
--- a/packages/sol-cov/src/coverage_subprovider.ts
+++ b/packages/sol-cov/src/coverage_subprovider.ts
@@ -1,6 +1,5 @@
import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0xproject/subproviders';
import { BlockParam, CallData, JSONRPCRequestPayload, TransactionTrace, TxData } from 'ethereum-types';
-import * as fs from 'fs';
import * as _ from 'lodash';
import { Lock } from 'semaphore-async-await';
diff --git a/packages/sol-cov/src/source_maps.ts b/packages/sol-cov/src/source_maps.ts
index 694171442..f9503e16c 100644
--- a/packages/sol-cov/src/source_maps.ts
+++ b/packages/sol-cov/src/source_maps.ts
@@ -38,10 +38,10 @@ export function parseSourceMap(
const pcToInstructionIndex: { [programCounter: number]: number } = getPcToInstructionIndexMapping(bytecode);
const locationByOffsetByFileIndex = _.map(sourceCodes, getLocationByOffset);
const entries = srcMap.split(';');
- const parsedEntries: SourceLocation[] = [];
let lastParsedEntry: SourceLocation = {} as any;
const instructionIndexToSourceRange: { [instructionIndex: number]: SourceRange } = {};
_.each(entries, (entry: string, i: number) => {
+ // tslint:disable-next-line:no-unused-variable
const [instructionIndexStrIfExists, lengthStrIfExists, fileIndexStrIfExists, jumpTypeStrIfExists] = entry.split(
':',
);
diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts
index 1c21c8e5c..c725de3d0 100644
--- a/packages/sol-cov/src/trace.ts
+++ b/packages/sol-cov/src/trace.ts
@@ -1,7 +1,6 @@
import { addressUtils, BigNumber, logUtils } from '@0xproject/utils';
-import { OpCode, StructLog, TransactionTrace } from 'ethereum-types';
-import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
-import * as fs from 'fs';
+import { OpCode, StructLog } from 'ethereum-types';
+import { addHexPrefix } from 'ethereumjs-util';
import * as _ from 'lodash';
export interface TraceByContractAddress {
diff --git a/packages/sol-cov/test/instructions_test.ts b/packages/sol-cov/test/instructions_test.ts
index 8012674f5..02f30a5ca 100644
--- a/packages/sol-cov/test/instructions_test.ts
+++ b/packages/sol-cov/test/instructions_test.ts
@@ -1,8 +1,6 @@
import * as chai from 'chai';
-import * as fs from 'fs';
import 'make-promises-safe';
import 'mocha';
-import * as path from 'path';
import { constants } from '../src/constants';
import { getPcToInstructionIndexMapping } from '../src/instructions';
diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts
index 07e270b71..7a034362c 100644
--- a/packages/sol-cov/test/trace_test.ts
+++ b/packages/sol-cov/test/trace_test.ts
@@ -1,9 +1,7 @@
import * as chai from 'chai';
import { OpCode, StructLog } from 'ethereum-types';
-import * as fs from 'fs';
import * as _ from 'lodash';
import 'mocha';
-import * as path from 'path';
import { getTracesByContractAddress } from '../src/trace';