hardhat 3.0.8 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts +30 -0
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +47 -39
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -2
- package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.js +2 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts +59 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +230 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +11 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +31 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +22 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts +5 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +18 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.js +2 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts +21 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.js +2 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.js.map +1 -0
- package/dist/src/internal/builtin-plugins/index.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/index.js +2 -0
- package/dist/src/internal/builtin-plugins/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +4 -3
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +7 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +40 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +14 -0
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.d.ts +8 -0
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +11 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +4 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js +14 -3
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +50 -13
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/types.d.ts +7 -4
- package/dist/src/internal/builtin-plugins/solidity-test/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +3 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts +2 -0
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js +6 -2
- package/dist/src/internal/core/hre.js.map +1 -1
- package/package.json +4 -3
- package/src/internal/builtin-plugins/coverage/coverage-manager.ts +56 -47
- package/src/internal/builtin-plugins/flatten/task-action.ts +5 -2
- package/src/internal/builtin-plugins/gas-analytics/exports.ts +5 -0
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +339 -0
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +44 -0
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +33 -0
- package/src/internal/builtin-plugins/gas-analytics/index.ts +23 -0
- package/src/internal/builtin-plugins/gas-analytics/type-extensions.ts +6 -0
- package/src/internal/builtin-plugins/gas-analytics/types.ts +24 -0
- package/src/internal/builtin-plugins/index.ts +3 -0
- package/src/internal/builtin-plugins/network-manager/chain-descriptors.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +6 -0
- package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +51 -0
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +25 -1
- package/src/internal/builtin-plugins/network-manager/type-extensions/hooks.ts +12 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +20 -8
- package/src/internal/builtin-plugins/solidity-test/index.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +4 -1
- package/src/internal/builtin-plugins/solidity-test/runner.ts +16 -3
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +74 -29
- package/src/internal/builtin-plugins/solidity-test/types.ts +10 -6
- package/src/internal/builtin-plugins/test/task-action.ts +3 -1
- package/src/internal/core/hre.ts +7 -2
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +3 -3
- package/templates/hardhat-3/02-mocha-ethers/package.json +3 -3
|
@@ -2,15 +2,24 @@ import { finished } from "node:stream/promises";
|
|
|
2
2
|
import { assertHardhatInvariant, HardhatError, } from "@nomicfoundation/hardhat-errors";
|
|
3
3
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
4
4
|
import { createNonClosingWriter } from "@nomicfoundation/hardhat-utils/stream";
|
|
5
|
+
import { getFullyQualifiedName } from "../../../utils/contract-names.js";
|
|
5
6
|
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
|
|
6
7
|
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
7
8
|
import { ArtifactManagerImplementation } from "../artifacts/artifact-manager.js";
|
|
8
|
-
import {
|
|
9
|
+
import { markTestRunStart as initCoverage, markTestWorkerDone as saveCoverageData, markTestRunDone as reportCoverage, } from "../coverage/helpers.js";
|
|
10
|
+
import { markTestRunStart as initGasStats, markTestWorkerDone as saveGasStatsData, markTestRunDone as reportGasStats, } from "../gas-analytics/helpers.js";
|
|
11
|
+
import { edrGasReportToHardhatGasMeasurements } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
9
12
|
import { getEdrArtifacts, getBuildInfos } from "./edr-artifacts.js";
|
|
10
13
|
import { isTestSuiteArtifact, warnDeprecatedTestFail, solidityTestConfigToRunOptions, solidityTestConfigToSolidityTestRunnerConfigArgs, } from "./helpers.js";
|
|
11
14
|
import { testReporter } from "./reporter.js";
|
|
12
15
|
import { run } from "./runner.js";
|
|
13
16
|
const runSolidityTests = async ({ testFiles, chainType, grep, noCompile, verbosity }, hre) => {
|
|
17
|
+
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
|
|
18
|
+
// Set an environment variable that plugins can use to detect when a process is running tests
|
|
19
|
+
process.env.HH_TEST = "true";
|
|
20
|
+
// Sets the NODE_ENV environment variable to "test" so the code can detect that tests are running
|
|
21
|
+
// This is done by other JS/TS test frameworks like vitest
|
|
22
|
+
process.env.NODE_ENV ??= "test";
|
|
14
23
|
if (!isSupportedChainType(chainType)) {
|
|
15
24
|
throw new HardhatError(HardhatError.ERRORS.CORE.ARGUMENTS.INVALID_VALUE_FOR_TYPE, {
|
|
16
25
|
value: chainType,
|
|
@@ -27,10 +36,15 @@ const runSolidityTests = async ({ testFiles, chainType, grep, noCompile, verbosi
|
|
|
27
36
|
files: testFiles,
|
|
28
37
|
noContracts: noCompile,
|
|
29
38
|
});
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const buildInfos =
|
|
33
|
-
const
|
|
39
|
+
// EDR needs all artifacts (contracts + tests)
|
|
40
|
+
const edrArtifacts = [];
|
|
41
|
+
const buildInfos = [];
|
|
42
|
+
for (const scope of ["contracts", "tests"]) {
|
|
43
|
+
const artifactsDir = await hre.solidity.getArtifactsDirectory(scope);
|
|
44
|
+
const artifactManager = new ArtifactManagerImplementation(artifactsDir);
|
|
45
|
+
edrArtifacts.push(...(await getEdrArtifacts(artifactManager)));
|
|
46
|
+
buildInfos.push(...(await getBuildInfos(artifactManager)));
|
|
47
|
+
}
|
|
34
48
|
const sourceNameToUserSourceName = new Map(edrArtifacts.map(({ userSourceName, edrAtifact }) => [
|
|
35
49
|
edrAtifact.id.source,
|
|
36
50
|
userSourceName,
|
|
@@ -52,7 +66,6 @@ const runSolidityTests = async ({ testFiles, chainType, grep, noCompile, verbosi
|
|
|
52
66
|
const solidityTestConfig = hre.config.test.solidity;
|
|
53
67
|
let observabilityConfig;
|
|
54
68
|
if (hre.globalOptions.coverage) {
|
|
55
|
-
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
|
|
56
69
|
observabilityConfig = {
|
|
57
70
|
codeCoverage: {
|
|
58
71
|
onCollectedCoverageCallback: async (coverageData) => {
|
|
@@ -62,21 +75,44 @@ const runSolidityTests = async ({ testFiles, chainType, grep, noCompile, verbosi
|
|
|
62
75
|
},
|
|
63
76
|
};
|
|
64
77
|
}
|
|
65
|
-
const config = await solidityTestConfigToSolidityTestRunnerConfigArgs(
|
|
78
|
+
const config = await solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
79
|
+
chainType,
|
|
80
|
+
projectRoot: hre.config.paths.root,
|
|
81
|
+
config: solidityTestConfig,
|
|
82
|
+
verbosity,
|
|
83
|
+
observability: observabilityConfig,
|
|
84
|
+
testPattern: grep,
|
|
85
|
+
generateGasReport: hre.globalOptions.gasStats,
|
|
86
|
+
});
|
|
66
87
|
const tracingConfig = {
|
|
67
88
|
buildInfos,
|
|
68
89
|
ignoreContracts: false,
|
|
69
90
|
};
|
|
70
91
|
const options = solidityTestConfigToRunOptions(solidityTestConfig);
|
|
71
|
-
await
|
|
92
|
+
await initCoverage("solidity");
|
|
93
|
+
await initGasStats("solidity");
|
|
72
94
|
const runStream = run(chainType, edrArtifacts.map(({ edrAtifact }) => edrAtifact), testSuiteIds, config, tracingConfig, sourceNameToUserSourceName, options);
|
|
73
95
|
const testReporterStream = runStream
|
|
74
96
|
.on("data", (event) => {
|
|
75
|
-
if (event.type === "suite:
|
|
97
|
+
if (event.type === "suite:done") {
|
|
76
98
|
if (event.data.testResults.some(({ status }) => status === "Failure")) {
|
|
77
99
|
includesFailures = true;
|
|
78
100
|
}
|
|
79
101
|
}
|
|
102
|
+
else if (event.type === "run:done") {
|
|
103
|
+
const { gasReport } = event.data;
|
|
104
|
+
// Gas report may be undefined if gas analytics is disabled
|
|
105
|
+
if (gasReport === undefined) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const testContractFqns = testSuiteIds.map(({ name, source }) => getFullyQualifiedName(source, name));
|
|
109
|
+
// we can't use the onGasMeasurement hook here as it's async and stream
|
|
110
|
+
// handlers are sync
|
|
111
|
+
const gasMeasurements = edrGasReportToHardhatGasMeasurements(gasReport, testContractFqns);
|
|
112
|
+
for (const measurement of gasMeasurements) {
|
|
113
|
+
hre._gasAnalytics.addGasMeasurement(measurement);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
80
116
|
})
|
|
81
117
|
.compose((source) => testReporter(source, sourceNameToUserSourceName, verbosity));
|
|
82
118
|
const outputStream = testReporterStream.pipe(createNonClosingWriter(process.stdout));
|
|
@@ -92,10 +128,11 @@ const runSolidityTests = async ({ testFiles, chainType, grep, noCompile, verbosi
|
|
|
92
128
|
console.error(error);
|
|
93
129
|
includesErrors = true;
|
|
94
130
|
}
|
|
95
|
-
|
|
96
|
-
await
|
|
97
|
-
//
|
|
98
|
-
await
|
|
131
|
+
await saveCoverageData("solidity");
|
|
132
|
+
await saveGasStatsData("solidity");
|
|
133
|
+
// this may print coverage and gas statistics reports
|
|
134
|
+
await reportCoverage("solidity");
|
|
135
|
+
await reportGasStats("solidity");
|
|
99
136
|
if (includesFailures || includesErrors) {
|
|
100
137
|
process.exitCode = 1;
|
|
101
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-action.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/solidity-test/task-action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-action.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/solidity-test/task-action.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,sBAAsB,EACtB,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,qBAAqB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CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type { SuiteResult } from "@nomicfoundation/edr";
|
|
1
|
+
import type { SolidityTestResult, SuiteResult } from "@nomicfoundation/edr";
|
|
2
2
|
import type { Readable } from "node:stream";
|
|
3
3
|
export type TestStatus = "Success" | "Failure" | "Skipped";
|
|
4
4
|
export type TestsStream = Readable;
|
|
5
|
-
export
|
|
6
|
-
type: "suite:
|
|
5
|
+
export type TestEvent = {
|
|
6
|
+
type: "suite:done";
|
|
7
7
|
data: SuiteResult;
|
|
8
|
-
}
|
|
8
|
+
} | {
|
|
9
|
+
type: "run:done";
|
|
10
|
+
data: SolidityTestResult;
|
|
11
|
+
};
|
|
9
12
|
export type TestEventSource = AsyncGenerator<TestEvent, void>;
|
|
10
13
|
export type TestReporterResult = AsyncGenerator<string, void>;
|
|
11
14
|
export type TestReporter = (source: TestEventSource) => TestReporterResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/solidity-test/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/solidity-test/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC,MAAM,MAAM,SAAS,GACjB;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;CACnB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/test/task-action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,yBAAyB,CAAC;AASjC,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,WAAW,EAAE,qBAAqB,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"task-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/test/task-action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,yBAAyB,CAAC;AASjC,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,WAAW,EAAE,qBAAqB,CAAC,mBAAmB,CAqE3D,CAAC;AAyDF,eAAe,WAAW,CAAC"}
|
|
@@ -9,7 +9,9 @@ const runAllTests = async ({ testFiles, chainType, grep, noCompile, verbosity },
|
|
|
9
9
|
: {};
|
|
10
10
|
const thisTask = hre.tasks.getTask("test");
|
|
11
11
|
if (!noCompile) {
|
|
12
|
-
await hre.tasks.getTask("compile").run({
|
|
12
|
+
await hre.tasks.getTask("compile").run({
|
|
13
|
+
noTests: true,
|
|
14
|
+
});
|
|
13
15
|
console.log();
|
|
14
16
|
}
|
|
15
17
|
if (hre.globalOptions.coverage === true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-action.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/test/task-action.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,sBAAsB,EACtB,YAAY,GACb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAU5E,MAAM,WAAW,GAA+C,KAAK,EACnE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EACpD,GAAG,EACH,EAAE;IACF,+EAA+E;IAC/E,iGAAiG;IACjG,0IAA0I;IAC1I,MAAM,eAAe,GACnB,SAAS,CAAC,MAAM,KAAK,CAAC;QACpB,CAAC,CAAC,MAAM,2BAA2B,CAAC,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC;QACzD,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"task-action.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/test/task-action.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,sBAAsB,EACtB,YAAY,GACb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAU5E,MAAM,WAAW,GAA+C,KAAK,EACnE,EAAE,S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AI,CAAC,CAAC;YACpB,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE,CAAC;YAC/C,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;QACpC,CAAC;QAED,eAAe,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,YAAY,CACpB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,4BAA4B,EACjE;YACE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;SAC3B,CACF,CAAC;IACJ,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,SAAS,sBAAsB,CAC7B,OAAa,EACb,SAAmB,EACnB,cAAwC;IAExC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,2DAA2D;IAC3D,iEAAiE;IACjE,MAAM,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -10,6 +10,7 @@ import type { SolidityBuildSystem } from "../../types/solidity/build-system.js";
|
|
|
10
10
|
import type { TaskManager } from "../../types/tasks.js";
|
|
11
11
|
import type { UserInterruptionManager } from "../../types/user-interruptions.js";
|
|
12
12
|
import type { CoverageManager } from "../builtin-plugins/coverage/types.js";
|
|
13
|
+
import type { GasAnalyticsManager } from "../builtin-plugins/gas-analytics/types.js";
|
|
13
14
|
export declare class HardhatRuntimeEnvironmentImplementation implements HardhatRuntimeEnvironment {
|
|
14
15
|
readonly userConfig: HardhatUserConfig;
|
|
15
16
|
readonly config: HardhatConfig;
|
|
@@ -24,6 +25,7 @@ export declare class HardhatRuntimeEnvironmentImplementation implements HardhatR
|
|
|
24
25
|
artifacts: ArtifactManager;
|
|
25
26
|
solidity: SolidityBuildSystem;
|
|
26
27
|
_coverage: CoverageManager;
|
|
28
|
+
_gasAnalytics: GasAnalyticsManager;
|
|
27
29
|
static create(inputUserConfig: HardhatUserConfig, userProvidedGlobalOptions: Partial<GlobalOptions>, projectRoot?: string, unsafeOptions?: UnsafeHardhatRuntimeEnvironmentOptions): Promise<HardhatRuntimeEnvironmentImplementation>;
|
|
28
30
|
readonly tasks: TaskManager;
|
|
29
31
|
private constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.d.ts","sourceRoot":"","sources":["../../../../src/internal/core/hre.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EAKd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,gCAAgC,EAEhC,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"hre.d.ts","sourceRoot":"","s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a,EAAG,mBAAmB,CAAC;WAEvB,MAAM,CACxB,eAAe,EAAE,iBAAiB,EAClC,yBAAyB,EAAE,OAAO,CAAC,aAAa,CAAC,EACjD,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,sCAAsC,GACrD,OAAO,CAAC,uCAAuC,CAAC;IAmFnD,SAAgB,KAAK,EAAE,WAAW,CAAC;IAEnC,OAAO;CAcR;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,yBAAyB,EAAE,MAAM,GAAG,SAAS,GAC5C,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gCAAgC,CACpD,eAAe,EAAE,iBAAiB,EAClC,KAAK,EAAE,WAAW,EAClB,mBAAmB,EAAE,MAAM,EAC3B,sBAAsB,EAAE,MAAM,GAAG,SAAS,EAC1C,eAAe,EAAE,aAAa,EAAE,GAC/B,OAAO,CACN;IACE,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,aAAa,CAAC;IACtB,kBAAkB,EAAE,iBAAiB,CAAC;CACvC,GACD;IACE,OAAO,EAAE,KAAK,CAAC;IACf,0BAA0B,EAAE,gCAAgC,EAAE,CAAC;CAChE,CACJ,CAyCA"}
|
|
@@ -22,9 +22,13 @@ export class HardhatRuntimeEnvironmentImplementation {
|
|
|
22
22
|
network;
|
|
23
23
|
artifacts;
|
|
24
24
|
solidity;
|
|
25
|
-
// NOTE:
|
|
26
|
-
// internal use only.
|
|
25
|
+
// NOTE: These underscore-prefixed properties are architectural violations intended
|
|
26
|
+
// for internal use only. They are declared here rather than through module
|
|
27
|
+
// augmentation to hide them from TypeScript users (keeping them out of the public
|
|
28
|
+
// HardhatRuntimeEnvironment interface). They are initialized by their respective
|
|
29
|
+
// plugins in the `created` hook.
|
|
27
30
|
_coverage;
|
|
31
|
+
_gasAnalytics;
|
|
28
32
|
static async create(inputUserConfig, userProvidedGlobalOptions, projectRoot, unsafeOptions) {
|
|
29
33
|
const resolvedProjectRoot = await resolveProjectRoot(projectRoot);
|
|
30
34
|
const resolvedPlugins = unsafeOptions?.resolvedPlugins ??
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../src/internal/core/hre.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../src/internal/core/hre.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAEhF,MAAM,OAAO,uCAAuC;IA6GhC;IACA;IACA;IACA;IACA;IACA;IA/GlB,8EAA8E;IAC9E,6EAA6E;IAC7E,iDAAiD;IAC1C,OAAO,CAAkB;IACzB,SAAS,CAAmB;IAC5B,QAAQ,CAAuB;IAEtC,mFAAmF;IACnF,2EAA2E;IAC3E,kFAAkF;IAClF,iFAAiF;IACjF,iCAAiC;IAC1B,SAAS,CAAmB;IAC5B,aAAa,CAAuB;IAEpC,MAAM,CAAC,KAAK,CAAC,MAAM,CACxB,eAAkC,EA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G;QAC5B,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;QACzB,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC;KAC1C,CAAC;IAEnB,OAAO,KAAK,CAAC,eAAe,CAC1B,QAAQ,EACR,mBAAmB,EACnB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,4BAA4B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EACrE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE;QACd,OAAO,qBAAqB,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,WAAmB,EACnB,UAA8B,EAC9B,oBAA4C,EAAE;IAE9C,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EACJ,UAAU,KAAK,SAAS;YACtB,CAAC,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,CAAC;YAC1C,CAAC,CAAC,SAAS;QACf,KAAK,EAAE,eAAe,CAAC,WAAW,EAAE,iBAAiB,CAAC,KAAK,IAAI,OAAO,CAAC;QACvE,SAAS,EAAE,eAAe,CACxB,WAAW,EACX,iBAAiB,CAAC,SAAS,IAAI,WAAW,CAC3C;QACD;;;8BAGsB;QACtB,KAAK,EAAE,EAAqB;QAC5B;oCAC4B;QAC5B,OAAO,EAAE,EAAuB;KACjC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardhat",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.",
|
|
5
5
|
"homepage": "https://github.com/nomicfoundation/hardhat/tree/v-next/v-next/hardhat",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"./types/solidity": "./dist/src/types/solidity.js",
|
|
38
38
|
"./console.sol": "./console.sol",
|
|
39
39
|
"./internal/coverage": "./dist/src/internal/builtin-plugins/coverage/exports.js",
|
|
40
|
+
"./internal/gas-analytics": "./dist/src/internal/builtin-plugins/gas-analytics/exports.js",
|
|
40
41
|
"./utils/contract-names": "./dist/src/utils/contract-names.js"
|
|
41
42
|
},
|
|
42
43
|
"keywords": [
|
|
@@ -70,9 +71,9 @@
|
|
|
70
71
|
"@nomicfoundation/hardhat-test-utils": "^2.0.1"
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
|
-
"@nomicfoundation/edr": "0.12.0-next.
|
|
74
|
+
"@nomicfoundation/edr": "0.12.0-next.10",
|
|
74
75
|
"@nomicfoundation/hardhat-errors": "^3.0.3",
|
|
75
|
-
"@nomicfoundation/hardhat-utils": "^3.0.
|
|
76
|
+
"@nomicfoundation/hardhat-utils": "^3.0.4",
|
|
76
77
|
"@nomicfoundation/hardhat-zod-utils": "^3.0.1",
|
|
77
78
|
"@nomicfoundation/solidity-analyzer": "^0.1.1",
|
|
78
79
|
"@sentry/core": "^9.4.0",
|
|
@@ -5,10 +5,12 @@ import type {
|
|
|
5
5
|
Statement,
|
|
6
6
|
Tag,
|
|
7
7
|
} from "./types.js";
|
|
8
|
+
import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
|
|
8
9
|
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
|
|
11
12
|
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
13
|
+
import { divider, formatTable } from "@nomicfoundation/hardhat-utils/format";
|
|
12
14
|
import {
|
|
13
15
|
ensureDir,
|
|
14
16
|
getAllFilesMatching,
|
|
@@ -17,6 +19,7 @@ import {
|
|
|
17
19
|
writeJsonFile,
|
|
18
20
|
writeUtf8File,
|
|
19
21
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
22
|
+
import chalk from "chalk";
|
|
20
23
|
import debug from "debug";
|
|
21
24
|
|
|
22
25
|
const log = debug("hardhat:core:coverage:coverage-manager");
|
|
@@ -26,7 +29,9 @@ const MAX_COLUMN_WIDTH = 80;
|
|
|
26
29
|
type Line = number;
|
|
27
30
|
type Branch = [Line, Tag];
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @private exposed for testing purposes only
|
|
34
|
+
*/
|
|
30
35
|
export interface Report {
|
|
31
36
|
[relativePath: string]: {
|
|
32
37
|
tagExecutionCounts: Map<Tag, number>;
|
|
@@ -43,8 +48,13 @@ export interface Report {
|
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
export class CoverageManagerImplementation implements CoverageManager {
|
|
46
|
-
|
|
51
|
+
/**
|
|
52
|
+
* @private exposed for testing purposes only
|
|
53
|
+
*/
|
|
47
54
|
public metadata: CoverageMetadata = [];
|
|
55
|
+
/**
|
|
56
|
+
* @private exposed for testing purposes only
|
|
57
|
+
*/
|
|
48
58
|
public data: CoverageData = [];
|
|
49
59
|
|
|
50
60
|
readonly #coveragePath: string;
|
|
@@ -110,6 +120,7 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
110
120
|
log(`Saved lcov report to ${lcovReportPath}`);
|
|
111
121
|
|
|
112
122
|
console.log(markdownReport);
|
|
123
|
+
console.log();
|
|
113
124
|
log("Printed markdown report");
|
|
114
125
|
}
|
|
115
126
|
|
|
@@ -121,7 +132,9 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
121
132
|
this.#reportEnabled = false;
|
|
122
133
|
}
|
|
123
134
|
|
|
124
|
-
|
|
135
|
+
/**
|
|
136
|
+
* @private exposed for testing purposes only
|
|
137
|
+
*/
|
|
125
138
|
public async loadData(...ids: string[]): Promise<void> {
|
|
126
139
|
this.data = [];
|
|
127
140
|
for (const id of ids) {
|
|
@@ -137,7 +150,9 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
152
|
|
|
140
|
-
|
|
153
|
+
/**
|
|
154
|
+
* @private exposed for testing purposes only
|
|
155
|
+
*/
|
|
141
156
|
public getReport(): Report {
|
|
142
157
|
const report: Report = {};
|
|
143
158
|
|
|
@@ -277,7 +292,9 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
277
292
|
return report;
|
|
278
293
|
}
|
|
279
294
|
|
|
280
|
-
|
|
295
|
+
/**
|
|
296
|
+
* @private exposed for testing purposes only
|
|
297
|
+
*/
|
|
281
298
|
public formatLcovReport(report: Report): string {
|
|
282
299
|
// NOTE: Format follows the guidelines set out in:
|
|
283
300
|
// https://github.com/linux-test-project/lcov/blob/df03ba434eee724bfc2b27716f794d0122951404/man/geninfo.1#L1409
|
|
@@ -348,7 +365,9 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
348
365
|
return lcov;
|
|
349
366
|
}
|
|
350
367
|
|
|
351
|
-
|
|
368
|
+
/**
|
|
369
|
+
* @private exposed for testing purposes only
|
|
370
|
+
*/
|
|
352
371
|
public formatRelativePath(relativePath: string): string {
|
|
353
372
|
if (relativePath.length <= MAX_COLUMN_WIDTH) {
|
|
354
373
|
return relativePath;
|
|
@@ -382,12 +401,16 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
382
401
|
return parts.reverse().join(path.sep);
|
|
383
402
|
}
|
|
384
403
|
|
|
385
|
-
|
|
404
|
+
/**
|
|
405
|
+
* @private exposed for testing purposes only
|
|
406
|
+
*/
|
|
386
407
|
public formatCoverage(coverage: number): string {
|
|
387
408
|
return coverage.toFixed(2).toString();
|
|
388
409
|
}
|
|
389
410
|
|
|
390
|
-
|
|
411
|
+
/**
|
|
412
|
+
* @private exposed for testing purposes only
|
|
413
|
+
*/
|
|
391
414
|
public formatLines(lines: Set<number>): string {
|
|
392
415
|
if (lines.size === 0) {
|
|
393
416
|
return "-";
|
|
@@ -448,7 +471,9 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
448
471
|
return [intervals.join(sep), suffix].join(suffixSep);
|
|
449
472
|
}
|
|
450
473
|
|
|
451
|
-
|
|
474
|
+
/**
|
|
475
|
+
* @private exposed for testing purposes only
|
|
476
|
+
*/
|
|
452
477
|
public formatMarkdownReport(report: Report): string {
|
|
453
478
|
let totalExecutedLines = 0;
|
|
454
479
|
let totalExecutableLines = 0;
|
|
@@ -456,15 +481,22 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
456
481
|
let totalExecutedStatements = 0;
|
|
457
482
|
let totalExecutableStatements = 0;
|
|
458
483
|
|
|
459
|
-
const
|
|
460
|
-
"File Path 📦",
|
|
461
|
-
"Line % 📈",
|
|
462
|
-
"Statement % 📈",
|
|
463
|
-
"Uncovered Lines 🔍",
|
|
464
|
-
"Partially Covered Lines 🔍",
|
|
465
|
-
];
|
|
484
|
+
const rows: TableItem[] = [];
|
|
466
485
|
|
|
467
|
-
|
|
486
|
+
rows.push([chalk.bold("Coverage Report")]);
|
|
487
|
+
rows.push(divider);
|
|
488
|
+
|
|
489
|
+
rows.push(
|
|
490
|
+
[
|
|
491
|
+
"File Path",
|
|
492
|
+
"Line %",
|
|
493
|
+
"Statement %",
|
|
494
|
+
"Uncovered Lines",
|
|
495
|
+
"Partially Covered Lines",
|
|
496
|
+
].map((s) => chalk.yellow(s)),
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const bodyRows = Object.entries(report).map(
|
|
468
500
|
([
|
|
469
501
|
relativePath,
|
|
470
502
|
{
|
|
@@ -503,6 +535,8 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
503
535
|
},
|
|
504
536
|
);
|
|
505
537
|
|
|
538
|
+
rows.push(...bodyRows);
|
|
539
|
+
|
|
506
540
|
const totalLineCoverage =
|
|
507
541
|
totalExecutableLines === 0
|
|
508
542
|
? 0
|
|
@@ -512,40 +546,15 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
512
546
|
? 0
|
|
513
547
|
: (totalExecutedStatements * 100.0) / totalExecutableStatements;
|
|
514
548
|
|
|
515
|
-
|
|
516
|
-
|
|
549
|
+
rows.push(divider);
|
|
550
|
+
rows.push([
|
|
551
|
+
chalk.yellow("Total"),
|
|
517
552
|
this.formatCoverage(totalLineCoverage),
|
|
518
553
|
this.formatCoverage(totalStatementCoverage),
|
|
519
554
|
"",
|
|
520
555
|
"",
|
|
521
|
-
];
|
|
522
|
-
|
|
523
|
-
const widths = headerRow.map((header) => header.length);
|
|
524
|
-
|
|
525
|
-
for (const row of rows) {
|
|
526
|
-
for (let i = 0; i < row.length; i++) {
|
|
527
|
-
widths[i] = Math.max(widths[i], row[i].length);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
for (let i = 0; i < footerRow.length; i++) {
|
|
532
|
-
widths[i] = Math.max(widths[i], footerRow[i].length);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
const dividerRow = widths.map((width) => "-".repeat(width));
|
|
536
|
-
|
|
537
|
-
rows.unshift(dividerRow);
|
|
538
|
-
rows.unshift(headerRow);
|
|
539
|
-
|
|
540
|
-
rows.push(dividerRow);
|
|
541
|
-
rows.push(footerRow);
|
|
542
|
-
|
|
543
|
-
rows.forEach((row) => {
|
|
544
|
-
for (let i = 0; i < row.length; i++) {
|
|
545
|
-
row[i] = row[i].padEnd(widths[i]);
|
|
546
|
-
}
|
|
547
|
-
});
|
|
556
|
+
]);
|
|
548
557
|
|
|
549
|
-
return rows
|
|
558
|
+
return formatTable(rows);
|
|
550
559
|
}
|
|
551
560
|
}
|
|
@@ -259,6 +259,7 @@ function getPragmaAbicoderDirectiveInfo(
|
|
|
259
259
|
// Returns files sorted in topological order
|
|
260
260
|
function getSortedFiles(dependencyGraph: DependencyGraph): ResolvedFile[] {
|
|
261
261
|
const sortedFiles: ResolvedFile[] = [];
|
|
262
|
+
const visitedFiles = new Set<ResolvedFile>();
|
|
262
263
|
|
|
263
264
|
// Helper function for sorting files by sourceName, for deterministic results
|
|
264
265
|
const sortBySourceName = (files: Iterable<ResolvedFile>) => {
|
|
@@ -270,15 +271,17 @@ function getSortedFiles(dependencyGraph: DependencyGraph): ResolvedFile[] {
|
|
|
270
271
|
// Depth-first walking
|
|
271
272
|
const walk = (files: ResolvedFile[]) => {
|
|
272
273
|
for (const file of files) {
|
|
273
|
-
if (
|
|
274
|
+
if (visitedFiles.has(file)) continue;
|
|
274
275
|
|
|
275
|
-
|
|
276
|
+
visitedFiles.add(file);
|
|
276
277
|
|
|
277
278
|
const dependencies = sortBySourceName(
|
|
278
279
|
Array.from(dependencyGraph.getDependencies(file)).map((d) => d.file),
|
|
279
280
|
);
|
|
280
281
|
|
|
281
282
|
walk(dependencies);
|
|
283
|
+
|
|
284
|
+
sortedFiles.push(file);
|
|
282
285
|
}
|
|
283
286
|
};
|
|
284
287
|
|