Remove redundant Date.now()
This commit is contained in:
19
packages/dev-utils/src/env.ts
Normal file
19
packages/dev-utils/src/env.ts
Normal 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;
|
||||
},
|
||||
};
|
||||
@@ -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);
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user