diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-13 03:42:14 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-13 03:42:14 +0800 |
commit | 33f066910021bc4969f4d564fc1648f6769ee3ec (patch) | |
tree | 8e02cd187b0d1d3e38c832a6e2861a1985820fcd /packages/sol-cov/src/profiler_subprovider.ts | |
parent | 787015f5370718e31c7990446fb1da298ed13e6b (diff) | |
download | dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.tar dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.tar.gz dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.tar.bz2 dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.tar.lz dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.tar.xz dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.tar.zst dexon-sol-tools-33f066910021bc4969f4d564fc1648f6769ee3ec.zip |
Refactor sol-cov to avoid keeping traceInfo in memory
Diffstat (limited to 'packages/sol-cov/src/profiler_subprovider.ts')
-rw-r--r-- | packages/sol-cov/src/profiler_subprovider.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/sol-cov/src/profiler_subprovider.ts b/packages/sol-cov/src/profiler_subprovider.ts index ac878c070..c66cd1dec 100644 --- a/packages/sol-cov/src/profiler_subprovider.ts +++ b/packages/sol-cov/src/profiler_subprovider.ts @@ -3,6 +3,7 @@ import * as _ from 'lodash'; import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; import { ProfilerManager } from './profiler_manager'; import { TraceCollectionSubprovider } from './trace_collection_subprovider'; +import { TraceInfo } from './types'; /** * This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface. @@ -25,12 +26,13 @@ export class ProfilerSubprovider extends TraceCollectionSubprovider { super(defaultFromAddress, traceCollectionSubproviderConfig); this._profilerManager = new ProfilerManager(artifactAdapter, isVerbose); } + public async handleTraceInfoAsync(traceInfo: TraceInfo): Promise<void> { + return this._profilerManager.computeCoverageAsync(traceInfo); + } /** * Write the test profiler results to a file in Istanbul format. */ public async writeProfilerOutputAsync(): Promise<void> { - const traceInfos = this.getCollectedTraceInfos(); - _.forEach(traceInfos, traceInfo => this._profilerManager.appendTraceInfo(traceInfo)); - await this._profilerManager.writeProfilerOutputAsync(); + return this._profilerManager.writeProfilerOutputAsync(); } } |