Remove redundant Date.now()

This commit is contained in:
Leonid Logvinov
2018-03-12 03:35:11 +01:00
parent d6c2e47bbd
commit 870995933a
3 changed files with 20 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
import * as _ from 'lodash';
import * as process from 'process';
export const env = {
parseBoolean(key: string): boolean {
let isTrue: boolean;
const envVarvalue = process.env[key];
if (process.env.SOLIDITY_COVERAGE === 'true') {
isTrue = true;
} else if (process.env.SOLIDITY_COVERAGE === 'false' || _.isUndefined(process.env.SOLIDITY_COVERAGE)) {
isTrue = false;
} else {
throw new Error(
`Failed to parse ENV variable ${key} as boolean. Please make sure it's either true or false. Defaults to false`,
);
}
return isTrue;
},
};

View File

@@ -11,7 +11,6 @@ import { getLocationByOffset } from './source_maps';
const coverageEntriesBySourceHash: { [sourceHash: string]: CoverageEntriesDescription } = {};
export const collectCoverageEntries = (contractSource: string, fileName: string) => {
const time = Date.now();
const sourceHash = ethUtil.sha3(contractSource).toString('hex');
if (_.isUndefined(coverageEntriesBySourceHash[sourceHash])) {
const ast = SolidityParser.parse(contractSource);

View File

@@ -4,8 +4,8 @@ import * as _ from 'lodash';
import * as path from 'path';
import { collectContractsData } from './collect_contract_data';
import { collectCoverageEntries } from './collect_coverage_entries';
import { constants } from './constants';
import { collectCoverageEntries } from './instrument_solidity';
import { parseSourceMap } from './source_maps';
import {
BranchCoverage,