diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 09:07:22 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 09:07:22 +0800 |
commit | 2af6d3f6bc03932f53d199971694c3c0d9441ba8 (patch) | |
tree | b17f3343a635aa72a917b89f278f63924e25da3e /packages/sol-cov | |
parent | cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4 (diff) | |
parent | 67c4ad128c405692e471274148c9a2ef7cd8b6ca (diff) | |
download | dexon-sol-tools-2af6d3f6bc03932f53d199971694c3c0d9441ba8.tar.gz dexon-sol-tools-2af6d3f6bc03932f53d199971694c3c0d9441ba8.tar.zst dexon-sol-tools-2af6d3f6bc03932f53d199971694c3c0d9441ba8.zip |
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/onboarding-flow-allowances
Diffstat (limited to 'packages/sol-cov')
-rw-r--r-- | packages/sol-cov/package.json | 8 | ||||
-rw-r--r-- | packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts | 1 | ||||
-rw-r--r-- | packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts | 4 | ||||
-rw-r--r-- | packages/sol-cov/src/collect_coverage_entries.ts | 2 | ||||
-rw-r--r-- | packages/sol-cov/src/coverage_manager.ts | 10 | ||||
-rw-r--r-- | packages/sol-cov/src/coverage_subprovider.ts | 1 | ||||
-rw-r--r-- | packages/sol-cov/src/source_maps.ts | 2 | ||||
-rw-r--r-- | packages/sol-cov/src/trace.ts | 5 | ||||
-rw-r--r-- | packages/sol-cov/test/instructions_test.ts | 2 | ||||
-rw-r--r-- | packages/sol-cov/test/trace_test.ts | 2 |
10 files changed, 11 insertions, 26 deletions
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index d10d277b9..616b30912 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -8,16 +8,18 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "pre_build": "run-s copy_test_fixtures", "lint": "tslint --project .", "test": "run-s compile_test run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "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 test/fixtures/artifacts src/artifacts", - "build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "copy_test_fixtures": "copyfiles 'test/fixtures/**/*' ./lib", "compile_test": "sol-compiler compile", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", 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'; |