@diamondslab/diamonds-hardhat-foundry 2.2.3 → 2.4.0
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/README.md +76 -1
- package/dist/framework/ForgeCoverageFramework.d.ts +70 -0
- package/dist/framework/ForgeCoverageFramework.d.ts.map +1 -0
- package/dist/framework/ForgeCoverageFramework.js +306 -0
- package/dist/framework/ForgeCoverageFramework.js.map +1 -0
- package/dist/framework/ForgeCoverageFramework.old.d.ts +61 -0
- package/dist/framework/ForgeCoverageFramework.old.d.ts.map +1 -0
- package/dist/framework/ForgeCoverageFramework.old.js +238 -0
- package/dist/framework/ForgeCoverageFramework.old.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tasks/coverage.d.ts +2 -0
- package/dist/tasks/coverage.d.ts.map +1 -0
- package/dist/tasks/coverage.js +154 -0
- package/dist/tasks/coverage.js.map +1 -0
- package/dist/tasks/coverage.old.d.ts +2 -0
- package/dist/tasks/coverage.old.d.ts.map +1 -0
- package/dist/tasks/coverage.old.js +173 -0
- package/dist/tasks/coverage.old.js.map +1 -0
- package/dist/types/config.d.ts +91 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/package.json +3 -3
- package/src/framework/ForgeCoverageFramework.ts +390 -0
- package/src/index.ts +7 -6
- package/src/tasks/coverage.ts +258 -0
- package/src/types/config.ts +107 -0
- package/CHANGELOG.md +0 -321
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("hardhat/config");
|
|
4
|
+
const logger_1 = require("../utils/logger");
|
|
5
|
+
/**
|
|
6
|
+
* Task: diamonds-forge:coverage
|
|
7
|
+
*
|
|
8
|
+
* Runs Forge coverage with Diamond deployment.
|
|
9
|
+
* - Ensures Diamond deployment exists
|
|
10
|
+
* - Generates Solidity helpers
|
|
11
|
+
* - Runs forge coverage with specified options
|
|
12
|
+
*
|
|
13
|
+
* Use Hardhat's built-in --network flag to specify the network
|
|
14
|
+
*/
|
|
15
|
+
(0, config_1.task)("diamonds-forge:coverage", "Run forge coverage for Diamond contracts")
|
|
16
|
+
.addParam("diamondName", "Name of the Diamond to analyze", undefined, config_1.types.string)
|
|
17
|
+
// Report options
|
|
18
|
+
.addOptionalParam("report", "Report type (summary, lcov, debug, bytecode) - can be used multiple times by passing comma-separated values", undefined, config_1.types.string)
|
|
19
|
+
.addOptionalParam("reportFile", "Output path for report file", undefined, config_1.types.string)
|
|
20
|
+
.addOptionalParam("lcovVersion", "LCOV format version", undefined, config_1.types.string)
|
|
21
|
+
.addFlag("includeLibs", "Include libraries in coverage report")
|
|
22
|
+
.addFlag("excludeTests", "Exclude tests from coverage report")
|
|
23
|
+
.addFlag("irMinimum", "Enable viaIR with minimum optimization")
|
|
24
|
+
// Test filtering
|
|
25
|
+
.addOptionalParam("matchTest", "Run tests matching pattern (--match-test)", undefined, config_1.types.string)
|
|
26
|
+
.addOptionalParam("noMatchTest", "Exclude tests matching pattern (--no-match-test)", undefined, config_1.types.string)
|
|
27
|
+
.addOptionalParam("matchContract", "Run contracts matching pattern (--match-contract)", undefined, config_1.types.string)
|
|
28
|
+
.addOptionalParam("noMatchContract", "Exclude contracts matching pattern (--no-match-contract)", undefined, config_1.types.string)
|
|
29
|
+
.addOptionalParam("matchPath", "Run files matching glob (--match-path)", undefined, config_1.types.string)
|
|
30
|
+
.addOptionalParam("noMatchPath", "Exclude files matching glob (--no-match-path)", undefined, config_1.types.string)
|
|
31
|
+
.addOptionalParam("noMatchCoverage", "Exclude files from coverage report (--no-match-coverage)", undefined, config_1.types.string)
|
|
32
|
+
// Display options
|
|
33
|
+
.addOptionalParam("verbosity", "Verbosity level (1-5, more v's = more verbose)", undefined, config_1.types.int)
|
|
34
|
+
.addFlag("quiet", "Suppress log output")
|
|
35
|
+
.addFlag("json", "Format output as JSON")
|
|
36
|
+
.addFlag("md", "Format output as Markdown")
|
|
37
|
+
.addOptionalParam("color", "Color mode (auto, always, never)", undefined, config_1.types.string)
|
|
38
|
+
// Test execution options
|
|
39
|
+
.addOptionalParam("threads", "Number of threads to use", undefined, config_1.types.int)
|
|
40
|
+
.addOptionalParam("fuzzRuns", "Number of fuzz runs", undefined, config_1.types.int)
|
|
41
|
+
.addOptionalParam("fuzzSeed", "Seed for fuzz randomness", undefined, config_1.types.string)
|
|
42
|
+
.addFlag("failFast", "Stop on first failure")
|
|
43
|
+
.addFlag("allowFailure", "Exit 0 even if tests fail")
|
|
44
|
+
// EVM options
|
|
45
|
+
.addOptionalParam("forkBlockNumber", "Fork from specific block number", undefined, config_1.types.int)
|
|
46
|
+
.addOptionalParam("initialBalance", "Initial balance for test contracts", undefined, config_1.types.string)
|
|
47
|
+
.addOptionalParam("sender", "Test sender address", undefined, config_1.types.string)
|
|
48
|
+
.addFlag("ffi", "Enable FFI cheatcode")
|
|
49
|
+
// Build options
|
|
50
|
+
.addFlag("force", "Force recompile and redeploy")
|
|
51
|
+
.addFlag("noCache", "Disable cache")
|
|
52
|
+
.addFlag("optimize", "Enable Solidity optimizer")
|
|
53
|
+
.addOptionalParam("optimizerRuns", "Optimizer runs", undefined, config_1.types.int)
|
|
54
|
+
.addFlag("viaIr", "Use Yul IR compilation")
|
|
55
|
+
.setAction(async (taskArgs, hre) => {
|
|
56
|
+
logger_1.Logger.section("Running Forge Coverage with Diamond");
|
|
57
|
+
const diamondName = taskArgs.diamondName;
|
|
58
|
+
const networkName = hre.network.name;
|
|
59
|
+
// Validate required parameters
|
|
60
|
+
if (!diamondName) {
|
|
61
|
+
logger_1.Logger.error("--diamond-name is required");
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
logger_1.Logger.info(`Diamond: ${diamondName}`);
|
|
66
|
+
logger_1.Logger.info(`Network: ${networkName}`);
|
|
67
|
+
try {
|
|
68
|
+
// Lazy-load framework classes to avoid circular dependency
|
|
69
|
+
const { DeploymentManager } = await import("../framework/DeploymentManager.js");
|
|
70
|
+
const { HelperGenerator } = await import("../framework/HelperGenerator.js");
|
|
71
|
+
// Step 1: Ensure Diamond deployment
|
|
72
|
+
logger_1.Logger.section("Step 1/3: Ensuring Diamond Deployment");
|
|
73
|
+
const deploymentManager = new DeploymentManager(hre);
|
|
74
|
+
await deploymentManager.ensureDeployment(diamondName, networkName, taskArgs.force || false, false // Don't write deployment data for coverage (ephemeral by default)
|
|
75
|
+
);
|
|
76
|
+
// Step 2: Generate helpers
|
|
77
|
+
logger_1.Logger.section("Step 2/3: Generating Solidity Helpers");
|
|
78
|
+
const deployment = await deploymentManager.getDeployment(diamondName, networkName);
|
|
79
|
+
if (!deployment) {
|
|
80
|
+
logger_1.Logger.error("No deployment found. Cannot generate helpers.");
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const provider = hre.ethers.provider;
|
|
85
|
+
const network = await provider.getNetwork();
|
|
86
|
+
const chainId = Number(network.chainId);
|
|
87
|
+
const deploymentData = deployment.getDeployedDiamondData();
|
|
88
|
+
const helperGenerator = new HelperGenerator(hre);
|
|
89
|
+
await helperGenerator.generateDeploymentHelpers(diamondName, networkName, chainId, deploymentData, deployment);
|
|
90
|
+
// Step 3: Run coverage
|
|
91
|
+
logger_1.Logger.section("Step 3/3: Running Forge Coverage");
|
|
92
|
+
// Construct fork URL for network
|
|
93
|
+
// Coverage requires forking from a running network to access deployed contracts
|
|
94
|
+
let forkUrl;
|
|
95
|
+
if (networkName !== "hardhat") {
|
|
96
|
+
// Use the configured network's URL
|
|
97
|
+
forkUrl = provider._hardhatProvider?._wrapped?.url || "http://127.0.0.1:8545";
|
|
98
|
+
logger_1.Logger.info(`Forking from ${networkName}: ${forkUrl}`);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// Default to localhost for hardhat network
|
|
102
|
+
// This assumes user has `npx hardhat node` running
|
|
103
|
+
forkUrl = "http://127.0.0.1:8545";
|
|
104
|
+
logger_1.Logger.warn(`⚠️ Network is "${networkName}" - defaulting to localhost fork: ${forkUrl}`);
|
|
105
|
+
logger_1.Logger.warn(`💡 Make sure Hardhat node is running: npx hardhat node`);
|
|
106
|
+
logger_1.Logger.warn(`💡 Or specify network explicitly: --network localhost`);
|
|
107
|
+
}
|
|
108
|
+
// Lazy-load framework to avoid circular dependency
|
|
109
|
+
const { ForgeCoverageFramework } = await import("../framework/ForgeCoverageFramework.js");
|
|
110
|
+
// Build coverage options from task args
|
|
111
|
+
const options = {
|
|
112
|
+
// Fork URL
|
|
113
|
+
forkUrl,
|
|
114
|
+
// Report options
|
|
115
|
+
report: taskArgs.report ? taskArgs.report.split(",") : undefined,
|
|
116
|
+
reportFile: taskArgs.reportFile,
|
|
117
|
+
lcovVersion: taskArgs.lcovVersion,
|
|
118
|
+
includeLibs: taskArgs.includeLibs,
|
|
119
|
+
excludeTests: taskArgs.excludeTests,
|
|
120
|
+
irMinimum: taskArgs.irMinimum,
|
|
121
|
+
// Test filtering
|
|
122
|
+
matchTest: taskArgs.matchTest,
|
|
123
|
+
noMatchTest: taskArgs.noMatchTest,
|
|
124
|
+
matchContract: taskArgs.matchContract,
|
|
125
|
+
noMatchContract: taskArgs.noMatchContract,
|
|
126
|
+
matchPath: taskArgs.matchPath,
|
|
127
|
+
noMatchPath: taskArgs.noMatchPath,
|
|
128
|
+
noMatchCoverage: taskArgs.noMatchCoverage,
|
|
129
|
+
// Display options
|
|
130
|
+
verbosity: taskArgs.verbosity,
|
|
131
|
+
quiet: taskArgs.quiet,
|
|
132
|
+
json: taskArgs.json,
|
|
133
|
+
md: taskArgs.md,
|
|
134
|
+
color: taskArgs.color,
|
|
135
|
+
// Test execution options
|
|
136
|
+
threads: taskArgs.threads,
|
|
137
|
+
fuzzRuns: taskArgs.fuzzRuns,
|
|
138
|
+
fuzzSeed: taskArgs.fuzzSeed,
|
|
139
|
+
failFast: taskArgs.failFast,
|
|
140
|
+
allowFailure: taskArgs.allowFailure,
|
|
141
|
+
// EVM options
|
|
142
|
+
forkBlockNumber: taskArgs.forkBlockNumber,
|
|
143
|
+
initialBalance: taskArgs.initialBalance,
|
|
144
|
+
sender: taskArgs.sender,
|
|
145
|
+
ffi: taskArgs.ffi,
|
|
146
|
+
// Build options
|
|
147
|
+
force: taskArgs.force,
|
|
148
|
+
noCache: taskArgs.noCache,
|
|
149
|
+
optimize: taskArgs.optimize,
|
|
150
|
+
optimizerRuns: taskArgs.optimizerRuns,
|
|
151
|
+
viaIr: taskArgs.viaIr,
|
|
152
|
+
};
|
|
153
|
+
// Run coverage
|
|
154
|
+
const framework = new ForgeCoverageFramework(hre);
|
|
155
|
+
const success = await framework.runCoverage(options);
|
|
156
|
+
if (success) {
|
|
157
|
+
logger_1.Logger.section("Coverage Analysis Complete");
|
|
158
|
+
logger_1.Logger.success("Coverage analysis completed successfully!");
|
|
159
|
+
process.exitCode = 0;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
logger_1.Logger.section("Coverage Analysis Complete");
|
|
163
|
+
logger_1.Logger.error("Coverage analysis failed");
|
|
164
|
+
process.exitCode = 1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
logger_1.Logger.error(`Coverage execution failed: ${error.message}`);
|
|
169
|
+
process.exitCode = 1;
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
//# sourceMappingURL=coverage.old.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.old.js","sourceRoot":"","sources":["../../src/tasks/coverage.old.ts"],"names":[],"mappings":";;AAAA,2CAA6C;AAE7C,4CAAyC;AAEzC;;;;;;;;;GASG;AACH,IAAA,aAAI,EAAC,yBAAyB,EAAE,0CAA0C,CAAC;KACxE,QAAQ,CACP,aAAa,EACb,gCA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AE;YACX,eAAM,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;YAC7C,eAAM,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAC;YAC5D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;SACtB;aAAM;YACL,eAAM,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;YAC7C,eAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YACzC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;SACtB;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,eAAM,CAAC,KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,MAAM,KAAK,CAAC;KACb;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { task, types } from \"hardhat/config\";\nimport { HardhatRuntimeEnvironment } from \"hardhat/types\";\nimport { Logger } from \"../utils/logger\";\n\n/**\n * Task: diamonds-forge:coverage\n *\n * Runs Forge coverage with Diamond deployment.\n * - Ensures Diamond deployment exists\n * - Generates Solidity helpers\n * - Runs forge coverage with specified options\n *\n * Use Hardhat's built-in --network flag to specify the network\n */\ntask(\"diamonds-forge:coverage\", \"Run forge coverage for Diamond contracts\")\n .addParam(\n \"diamondName\",\n \"Name of the Diamond to analyze\",\n undefined,\n types.string\n )\n // Report options\n .addOptionalParam(\n \"report\",\n \"Report type (summary, lcov, debug, bytecode) - can be used multiple times by passing comma-separated values\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"reportFile\",\n \"Output path for report file\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"lcovVersion\",\n \"LCOV format version\",\n undefined,\n types.string\n )\n .addFlag(\"includeLibs\", \"Include libraries in coverage report\")\n .addFlag(\"excludeTests\", \"Exclude tests from coverage report\")\n .addFlag(\"irMinimum\", \"Enable viaIR with minimum optimization\")\n // Test filtering\n .addOptionalParam(\n \"matchTest\",\n \"Run tests matching pattern (--match-test)\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"noMatchTest\",\n \"Exclude tests matching pattern (--no-match-test)\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"matchContract\",\n \"Run contracts matching pattern (--match-contract)\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"noMatchContract\",\n \"Exclude contracts matching pattern (--no-match-contract)\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"matchPath\",\n \"Run files matching glob (--match-path)\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"noMatchPath\",\n \"Exclude files matching glob (--no-match-path)\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"noMatchCoverage\",\n \"Exclude files from coverage report (--no-match-coverage)\",\n undefined,\n types.string\n )\n // Display options\n .addOptionalParam(\n \"verbosity\",\n \"Verbosity level (1-5, more v's = more verbose)\",\n undefined,\n types.int\n )\n .addFlag(\"quiet\", \"Suppress log output\")\n .addFlag(\"json\", \"Format output as JSON\")\n .addFlag(\"md\", \"Format output as Markdown\")\n .addOptionalParam(\n \"color\",\n \"Color mode (auto, always, never)\",\n undefined,\n types.string\n )\n // Test execution options\n .addOptionalParam(\n \"threads\",\n \"Number of threads to use\",\n undefined,\n types.int\n )\n .addOptionalParam(\n \"fuzzRuns\",\n \"Number of fuzz runs\",\n undefined,\n types.int\n )\n .addOptionalParam(\n \"fuzzSeed\",\n \"Seed for fuzz randomness\",\n undefined,\n types.string\n )\n .addFlag(\"failFast\", \"Stop on first failure\")\n .addFlag(\"allowFailure\", \"Exit 0 even if tests fail\")\n // EVM options\n .addOptionalParam(\n \"forkBlockNumber\",\n \"Fork from specific block number\",\n undefined,\n types.int\n )\n .addOptionalParam(\n \"initialBalance\",\n \"Initial balance for test contracts\",\n undefined,\n types.string\n )\n .addOptionalParam(\n \"sender\",\n \"Test sender address\",\n undefined,\n types.string\n )\n .addFlag(\"ffi\", \"Enable FFI cheatcode\")\n // Build options\n .addFlag(\"force\", \"Force recompile and redeploy\")\n .addFlag(\"noCache\", \"Disable cache\")\n .addFlag(\"optimize\", \"Enable Solidity optimizer\")\n .addOptionalParam(\n \"optimizerRuns\",\n \"Optimizer runs\",\n undefined,\n types.int\n )\n .addFlag(\"viaIr\", \"Use Yul IR compilation\")\n .setAction(async (taskArgs, hre: HardhatRuntimeEnvironment) => {\n Logger.section(\"Running Forge Coverage with Diamond\");\n\n const diamondName = taskArgs.diamondName;\n const networkName = hre.network.name;\n\n // Validate required parameters\n if (!diamondName) {\n Logger.error(\"--diamond-name is required\");\n process.exitCode = 1;\n return;\n }\n\n Logger.info(`Diamond: ${diamondName}`);\n Logger.info(`Network: ${networkName}`);\n\n try {\n // Lazy-load framework classes to avoid circular dependency\n const { DeploymentManager } = await import(\"../framework/DeploymentManager.js\");\n const { HelperGenerator } = await import(\"../framework/HelperGenerator.js\");\n\n // Step 1: Ensure Diamond deployment\n Logger.section(\"Step 1/3: Ensuring Diamond Deployment\");\n \n const deploymentManager = new DeploymentManager(hre);\n \n await deploymentManager.ensureDeployment(\n diamondName,\n networkName,\n taskArgs.force || false,\n false // Don't write deployment data for coverage (ephemeral by default)\n );\n\n // Step 2: Generate helpers\n Logger.section(\"Step 2/3: Generating Solidity Helpers\");\n \n const deployment = await deploymentManager.getDeployment(\n diamondName,\n networkName\n );\n\n if (!deployment) {\n Logger.error(\"No deployment found. Cannot generate helpers.\");\n process.exitCode = 1;\n return;\n }\n\n const provider = hre.ethers.provider;\n const network = await provider.getNetwork();\n const chainId = Number(network.chainId);\n const deploymentData = deployment.getDeployedDiamondData();\n\n const helperGenerator = new HelperGenerator(hre);\n await helperGenerator.generateDeploymentHelpers(\n diamondName,\n networkName,\n chainId,\n deploymentData,\n deployment\n );\n\n // Step 3: Run coverage\n Logger.section(\"Step 3/3: Running Forge Coverage\");\n\n // Construct fork URL for network\n // Coverage requires forking from a running network to access deployed contracts\n let forkUrl: string;\n if (networkName !== \"hardhat\") {\n // Use the configured network's URL\n forkUrl = (provider as any)._hardhatProvider?._wrapped?.url || \"http://127.0.0.1:8545\";\n Logger.info(`Forking from ${networkName}: ${forkUrl}`);\n } else {\n // Default to localhost for hardhat network\n // This assumes user has `npx hardhat node` running\n forkUrl = \"http://127.0.0.1:8545\";\n Logger.warn(`⚠️ Network is \"${networkName}\" - defaulting to localhost fork: ${forkUrl}`);\n Logger.warn(`💡 Make sure Hardhat node is running: npx hardhat node`);\n Logger.warn(`💡 Or specify network explicitly: --network localhost`);\n }\n\n // Lazy-load framework to avoid circular dependency\n const { ForgeCoverageFramework } = await import(\"../framework/ForgeCoverageFramework.js\");\n type CoverageOptions = Parameters<InstanceType<typeof ForgeCoverageFramework>[\"runCoverage\"]>[0];\n\n // Build coverage options from task args\n const options: CoverageOptions = {\n // Fork URL\n forkUrl,\n\n // Report options\n report: taskArgs.report ? taskArgs.report.split(\",\") : undefined,\n reportFile: taskArgs.reportFile,\n lcovVersion: taskArgs.lcovVersion,\n includeLibs: taskArgs.includeLibs,\n excludeTests: taskArgs.excludeTests,\n irMinimum: taskArgs.irMinimum,\n\n // Test filtering\n matchTest: taskArgs.matchTest,\n noMatchTest: taskArgs.noMatchTest,\n matchContract: taskArgs.matchContract,\n noMatchContract: taskArgs.noMatchContract,\n matchPath: taskArgs.matchPath,\n noMatchPath: taskArgs.noMatchPath,\n noMatchCoverage: taskArgs.noMatchCoverage,\n\n // Display options\n verbosity: taskArgs.verbosity,\n quiet: taskArgs.quiet,\n json: taskArgs.json,\n md: taskArgs.md,\n color: taskArgs.color as \"auto\" | \"always\" | \"never\" | undefined,\n\n // Test execution options\n threads: taskArgs.threads,\n fuzzRuns: taskArgs.fuzzRuns,\n fuzzSeed: taskArgs.fuzzSeed,\n failFast: taskArgs.failFast,\n allowFailure: taskArgs.allowFailure,\n\n // EVM options\n forkBlockNumber: taskArgs.forkBlockNumber,\n initialBalance: taskArgs.initialBalance,\n sender: taskArgs.sender,\n ffi: taskArgs.ffi,\n\n // Build options\n force: taskArgs.force,\n noCache: taskArgs.noCache,\n optimize: taskArgs.optimize,\n optimizerRuns: taskArgs.optimizerRuns,\n viaIr: taskArgs.viaIr,\n };\n\n // Run coverage\n const framework = new ForgeCoverageFramework(hre);\n const success = await framework.runCoverage(options);\n\n if (success) {\n Logger.section(\"Coverage Analysis Complete\");\n Logger.success(\"Coverage analysis completed successfully!\");\n process.exitCode = 0;\n } else {\n Logger.section(\"Coverage Analysis Complete\");\n Logger.error(\"Coverage analysis failed\");\n process.exitCode = 1;\n }\n } catch (error: any) {\n Logger.error(`Coverage execution failed: ${error.message}`);\n process.exitCode = 1;\n throw error;\n }\n });\n"]}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -38,4 +38,95 @@ export interface DiamondsFoundryConfig {
|
|
|
38
38
|
* Default configuration values
|
|
39
39
|
*/
|
|
40
40
|
export declare const DEFAULT_CONFIG: Required<DiamondsFoundryConfig>;
|
|
41
|
+
/**
|
|
42
|
+
* Type for forge coverage report formats
|
|
43
|
+
*/
|
|
44
|
+
export type CoverageReportType = "summary" | "lcov" | "debug" | "bytecode";
|
|
45
|
+
/**
|
|
46
|
+
* Type for color output modes
|
|
47
|
+
*/
|
|
48
|
+
export type ColorMode = "auto" | "always" | "never";
|
|
49
|
+
/**
|
|
50
|
+
* Coverage options for forge coverage command
|
|
51
|
+
* Maps to all available forge coverage command-line options
|
|
52
|
+
* Plus orchestration options for Diamond deployment and helpers
|
|
53
|
+
*/
|
|
54
|
+
export interface CoverageOptions {
|
|
55
|
+
/** Name of the Diamond to analyze */
|
|
56
|
+
diamondName?: string;
|
|
57
|
+
/** Network name for deployment (hardhat, localhost, etc.) */
|
|
58
|
+
networkName?: string;
|
|
59
|
+
/** Skip Diamond deployment step */
|
|
60
|
+
skipDeployment?: boolean;
|
|
61
|
+
/** Skip helper generation step */
|
|
62
|
+
skipHelpers?: boolean;
|
|
63
|
+
/** Write deployment data to file for reuse */
|
|
64
|
+
writeDeployedDiamondData?: boolean;
|
|
65
|
+
/** Report type(s) - can specify multiple */
|
|
66
|
+
report?: CoverageReportType[];
|
|
67
|
+
/** Output path for report file */
|
|
68
|
+
reportFile?: string;
|
|
69
|
+
/** LCOV format version (default: 1) */
|
|
70
|
+
lcovVersion?: string;
|
|
71
|
+
/** Include libraries in coverage report */
|
|
72
|
+
includeLibs?: boolean;
|
|
73
|
+
/** Exclude tests from coverage report */
|
|
74
|
+
excludeTests?: boolean;
|
|
75
|
+
/** Enable viaIR with minimum optimization */
|
|
76
|
+
irMinimum?: boolean;
|
|
77
|
+
/** Run tests matching regex pattern */
|
|
78
|
+
matchTest?: string;
|
|
79
|
+
/** Exclude tests matching regex pattern */
|
|
80
|
+
noMatchTest?: string;
|
|
81
|
+
/** Run contracts matching regex pattern */
|
|
82
|
+
matchContract?: string;
|
|
83
|
+
/** Exclude contracts matching regex pattern */
|
|
84
|
+
noMatchContract?: string;
|
|
85
|
+
/** Run files matching glob pattern */
|
|
86
|
+
matchPath?: string;
|
|
87
|
+
/** Exclude files matching glob pattern */
|
|
88
|
+
noMatchPath?: string;
|
|
89
|
+
/** Exclude files from coverage report matching regex */
|
|
90
|
+
noMatchCoverage?: string;
|
|
91
|
+
/** Verbosity level (1-5) - more v's = more verbose */
|
|
92
|
+
verbosity?: number;
|
|
93
|
+
/** Suppress log output */
|
|
94
|
+
quiet?: boolean;
|
|
95
|
+
/** Format output as JSON */
|
|
96
|
+
json?: boolean;
|
|
97
|
+
/** Format output as Markdown */
|
|
98
|
+
md?: boolean;
|
|
99
|
+
/** Color output mode */
|
|
100
|
+
color?: ColorMode;
|
|
101
|
+
/** Number of threads to use for parallel execution */
|
|
102
|
+
threads?: number;
|
|
103
|
+
/** Number of fuzz test runs */
|
|
104
|
+
fuzzRuns?: number;
|
|
105
|
+
/** Seed for fuzz test randomness (for reproducibility) */
|
|
106
|
+
fuzzSeed?: string;
|
|
107
|
+
/** Stop running tests after first failure */
|
|
108
|
+
failFast?: boolean;
|
|
109
|
+
/** Exit with code 0 even if tests fail */
|
|
110
|
+
allowFailure?: boolean;
|
|
111
|
+
/** Fork URL for network state */
|
|
112
|
+
forkUrl?: string;
|
|
113
|
+
/** Fork from specific block number */
|
|
114
|
+
forkBlockNumber?: number;
|
|
115
|
+
/** Initial balance for deployed test contracts */
|
|
116
|
+
initialBalance?: string;
|
|
117
|
+
/** Address to use as test sender */
|
|
118
|
+
sender?: string;
|
|
119
|
+
/** Enable FFI (Foreign Function Interface) cheatcode */
|
|
120
|
+
ffi?: boolean;
|
|
121
|
+
/** Force recompilation and cache clearing */
|
|
122
|
+
force?: boolean;
|
|
123
|
+
/** Disable compiler cache */
|
|
124
|
+
noCache?: boolean;
|
|
125
|
+
/** Enable Solidity optimizer */
|
|
126
|
+
optimize?: boolean;
|
|
127
|
+
/** Number of optimizer runs */
|
|
128
|
+
optimizerRuns?: number;
|
|
129
|
+
/** Use Yul intermediate representation compilation */
|
|
130
|
+
viaIr?: boolean;
|
|
131
|
+
}
|
|
41
132
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,aAAa,GAAG,MAAM,CAAC,CAAC;IAEtD;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,qBAAqB,CAO1D,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings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AC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
package/dist/types/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;GAEG;AACU,QAAA,cAAc,GAAoC;IAC7D,UAAU,EAAE,sBAAsB;IAClC,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC;IAC7C,cAAc,EAAE,SAAS;IACzB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,EAAE;CAClB,CAAC","sourcesContent":["/**\n * Configuration types for diamonds-hardhat-foundry plugin\n * Will be fully implemented in Task 2.1\n */\n\nexport interface DiamondsFoundryConfig {\n /**\n * Output directory for generated helpers (relative to project root)\n * @default \"test/foundry/helpers\"\n */\n helpersDir?: string;\n\n /**\n * Whether to generate example tests on init\n * @default true\n */\n generateExamples?: boolean;\n\n /**\n * Example test templates to generate\n * @default [\"unit\", \"integration\", \"fuzz\"]\n */\n exampleTests?: Array<\"unit\" | \"integration\" | \"fuzz\">;\n\n /**\n * Default network for deployments\n * @default \"hardhat\"\n */\n defaultNetwork?: string;\n\n /**\n * Whether to reuse existing deployment or deploy fresh\n * @default true\n */\n reuseDeployment?: boolean;\n\n /**\n * Additional forge test arguments\n * @default []\n */\n forgeTestArgs?: string[];\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: Required<DiamondsFoundryConfig> = {\n helpersDir: \"test/foundry/helpers\",\n generateExamples: true,\n exampleTests: [\"unit\", \"integration\", \"fuzz\"],\n defaultNetwork: \"hardhat\",\n reuseDeployment: true,\n forgeTestArgs: [],\n};\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;GAEG;AACU,QAAA,cAAc,GAAoC;IAC7D,UAAU,EAAE,sBAAsB;IAClC,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC;IAC7C,cAAc,EAAE,SAAS;IACzB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,EAAE;CAClB,CAAC","sourcesContent":["/**\n * Configuration types for diamonds-hardhat-foundry plugin\n * Will be fully implemented in Task 2.1\n */\n\nexport interface DiamondsFoundryConfig {\n /**\n * Output directory for generated helpers (relative to project root)\n * @default \"test/foundry/helpers\"\n */\n helpersDir?: string;\n\n /**\n * Whether to generate example tests on init\n * @default true\n */\n generateExamples?: boolean;\n\n /**\n * Example test templates to generate\n * @default [\"unit\", \"integration\", \"fuzz\"]\n */\n exampleTests?: Array<\"unit\" | \"integration\" | \"fuzz\">;\n\n /**\n * Default network for deployments\n * @default \"hardhat\"\n */\n defaultNetwork?: string;\n\n /**\n * Whether to reuse existing deployment or deploy fresh\n * @default true\n */\n reuseDeployment?: boolean;\n\n /**\n * Additional forge test arguments\n * @default []\n */\n forgeTestArgs?: string[];\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: Required<DiamondsFoundryConfig> = {\n helpersDir: \"test/foundry/helpers\",\n generateExamples: true,\n exampleTests: [\"unit\", \"integration\", \"fuzz\"],\n defaultNetwork: \"hardhat\",\n reuseDeployment: true,\n forgeTestArgs: [],\n};\n\n/**\n * Type for forge coverage report formats\n */\nexport type CoverageReportType = \"summary\" | \"lcov\" | \"debug\" | \"bytecode\";\n\n/**\n * Type for color output modes\n */\nexport type ColorMode = \"auto\" | \"always\" | \"never\";\n\n/**\n * Coverage options for forge coverage command\n * Maps to all available forge coverage command-line options\n * Plus orchestration options for Diamond deployment and helpers\n */\nexport interface CoverageOptions {\n // Orchestration options (matching ForgeFuzzingFramework pattern)\n /** Name of the Diamond to analyze */\n diamondName?: string;\n /** Network name for deployment (hardhat, localhost, etc.) */\n networkName?: string;\n /** Skip Diamond deployment step */\n skipDeployment?: boolean;\n /** Skip helper generation step */\n skipHelpers?: boolean;\n /** Write deployment data to file for reuse */\n writeDeployedDiamondData?: boolean;\n\n // Report options\n /** Report type(s) - can specify multiple */\n report?: CoverageReportType[];\n /** Output path for report file */\n reportFile?: string;\n /** LCOV format version (default: 1) */\n lcovVersion?: string;\n /** Include libraries in coverage report */\n includeLibs?: boolean;\n /** Exclude tests from coverage report */\n excludeTests?: boolean;\n /** Enable viaIR with minimum optimization */\n irMinimum?: boolean;\n\n // Test filtering\n /** Run tests matching regex pattern */\n matchTest?: string;\n /** Exclude tests matching regex pattern */\n noMatchTest?: string;\n /** Run contracts matching regex pattern */\n matchContract?: string;\n /** Exclude contracts matching regex pattern */\n noMatchContract?: string;\n /** Run files matching glob pattern */\n matchPath?: string;\n /** Exclude files matching glob pattern */\n noMatchPath?: string;\n /** Exclude files from coverage report matching regex */\n noMatchCoverage?: string;\n\n // Display options\n /** Verbosity level (1-5) - more v's = more verbose */\n verbosity?: number;\n /** Suppress log output */\n quiet?: boolean;\n /** Format output as JSON */\n json?: boolean;\n /** Format output as Markdown */\n md?: boolean;\n /** Color output mode */\n color?: ColorMode;\n\n // Test execution options\n /** Number of threads to use for parallel execution */\n threads?: number;\n /** Number of fuzz test runs */\n fuzzRuns?: number;\n /** Seed for fuzz test randomness (for reproducibility) */\n fuzzSeed?: string;\n /** Stop running tests after first failure */\n failFast?: boolean;\n /** Exit with code 0 even if tests fail */\n allowFailure?: boolean;\n\n // EVM options\n /** Fork URL for network state */\n forkUrl?: string;\n /** Fork from specific block number */\n forkBlockNumber?: number;\n /** Initial balance for deployed test contracts */\n initialBalance?: string;\n /** Address to use as test sender */\n sender?: string;\n /** Enable FFI (Foreign Function Interface) cheatcode */\n ffi?: boolean;\n\n // Build options\n /** Force recompilation and cache clearing */\n force?: boolean;\n /** Disable compiler cache */\n noCache?: boolean;\n /** Enable Solidity optimizer */\n optimize?: boolean;\n /** Number of optimizer runs */\n optimizerRuns?: number;\n /** Use Yul intermediate representation compilation */\n viaIr?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diamondslab/diamonds-hardhat-foundry",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Hardhat plugin that integrates Foundry testing with Diamond proxy contracts, providing deployment helpers and fuzzing support",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"typescript": "~5.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@diamondslab/diamonds": "
|
|
72
|
-
"@diamondslab/hardhat-diamonds": "
|
|
71
|
+
"@diamondslab/diamonds": "workspace:^",
|
|
72
|
+
"@diamondslab/hardhat-diamonds": "workspace:^",
|
|
73
73
|
"@nomicfoundation/hardhat-ethers": "^3.0.8",
|
|
74
74
|
"ethers": "^6.0.0",
|
|
75
75
|
"hardhat": "^2.26.0"
|