Skip to content

Commit cc35ab0

Browse files
authored
Merge pull request #6746 from NomicFoundation/6444_missing_foundry_flags
Warn on usage of verbose foundry flag for solidity tests
2 parents 0af9661 + 2107cbe commit cc35ab0

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.changeset/wild-flowers-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Message on usage of verbose foundry flag for solidity tests (#6444)

v-next/hardhat/src/internal/cli/main.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import { isCi } from "@nomicfoundation/hardhat-utils/ci";
1313
import { readClosestPackageJson } from "@nomicfoundation/hardhat-utils/package";
1414
import { kebabToCamelCase } from "@nomicfoundation/hardhat-utils/string";
15+
import chalk from "chalk";
1516
import debug from "debug";
1617
import { register } from "tsx/esm/api";
1718

@@ -194,7 +195,26 @@ export async function main(
194195

195196
await Promise.all([task.run(taskArguments), sendTaskAnalytics(task.id)]);
196197
} catch (error) {
197-
printErrorMessages(error, builtinGlobalOptions?.showStackTraces);
198+
// TODO: Remove after -v, -vv etc are implemented
199+
if (
200+
(HardhatError.isHardhatError(
201+
error,
202+
HardhatError.ERRORS.CORE.SOLIDITY.RESOLVING_NONEXISTENT_PROJECT_FILE,
203+
) ||
204+
HardhatError.isHardhatError(
205+
error,
206+
HardhatError.ERRORS.CORE.TEST_PLUGIN.CANNOT_DETERMINE_TEST_RUNNER,
207+
)) &&
208+
/-v+/.test(error.message)
209+
) {
210+
console.error(
211+
chalk.red(
212+
`\nSupport for verbose test output will be added soon. Please re-run this command without the flag.\n`,
213+
),
214+
);
215+
} else {
216+
printErrorMessages(error, builtinGlobalOptions?.showStackTraces);
217+
}
198218

199219
if (error instanceof Error) {
200220
try {

0 commit comments

Comments
 (0)