aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src/collect_contract_data.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-15 02:01:18 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-23 06:20:34 +0800
commit974575b695108dd70f4b165f6789f71c3647c2b1 (patch)
tree3d589c157c51c02066583a08bdec879aa7a18735 /packages/sol-cov/src/collect_contract_data.ts
parent60b1fdd367101047d433d4b9c1c47925925296a2 (diff)
downloaddexon-sol-tools-974575b695108dd70f4b165f6789f71c3647c2b1.tar.gz
dexon-sol-tools-974575b695108dd70f4b165f6789f71c3647c2b1.tar.zst
dexon-sol-tools-974575b695108dd70f4b165f6789f71c3647c2b1.zip
Make sol-cov work with truffle and other artifact adapters
Diffstat (limited to 'packages/sol-cov/src/collect_contract_data.ts')
-rw-r--r--packages/sol-cov/src/collect_contract_data.ts31
1 files changed, 0 insertions, 31 deletions
diff --git a/packages/sol-cov/src/collect_contract_data.ts b/packages/sol-cov/src/collect_contract_data.ts
deleted file mode 100644
index 2c2a12835..000000000
--- a/packages/sol-cov/src/collect_contract_data.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import * as fs from 'fs';
-import * as glob from 'glob';
-import * as _ from 'lodash';
-import * as path from 'path';
-
-import { ContractData } from './types';
-
-export const collectContractsData = (artifactsPath: string, sourcesPath: string) => {
- const artifactsGlob = `${artifactsPath}/**/*.json`;
- const artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
- const contractsData: ContractData[] = [];
- _.forEach(artifactFileNames, artifactFileName => {
- const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
- const sources = _.keys(artifact.sources);
- const contractName = artifact.contractName;
- // We don't compute coverage for dependencies
- const sourceCodes = _.map(sources, (source: string) =>
- fs.readFileSync(path.join(sourcesPath, source)).toString(),
- );
- const contractData = {
- sourceCodes,
- sources,
- bytecode: artifact.compilerOutput.evm.bytecode.object,
- sourceMap: artifact.compilerOutput.evm.bytecode.sourceMap,
- runtimeBytecode: artifact.compilerOutput.evm.deployedBytecode.object,
- sourceMapRuntime: artifact.compilerOutput.evm.deployedBytecode.sourceMap,
- };
- contractsData.push(contractData);
- });
- return contractsData;
-};