diff --git a/v-next/hardhat-mocha-test-runner/src/task-action.ts b/v-next/hardhat-mocha-test-runner/src/task-action.ts index adaae4e4eb..b4597c2bcf 100644 --- a/v-next/hardhat-mocha-test-runner/src/task-action.ts +++ b/v-next/hardhat-mocha-test-runner/src/task-action.ts @@ -52,6 +52,10 @@ const testWithHardhat: NewTaskActionFunction = async ( const files = await getTestFiles(testFiles, hre.config); + if (files.length === 0) { + return; + } + const tsx = fileURLToPath(import.meta.resolve("tsx/esm")); process.env.NODE_OPTIONS = `--import ${tsx}`; @@ -81,6 +85,8 @@ const testWithHardhat: NewTaskActionFunction = async ( } testsAlreadyRun = true; + console.log("Running Mocha tests"); + // This instructs Mocha to use the more verbose file loading infrastructure // which supports both ESM and CJS await mocha.loadFilesAsync(); diff --git a/v-next/hardhat-node-test-runner/src/task-action.ts b/v-next/hardhat-node-test-runner/src/task-action.ts index 4f9d4a8806..65a88a7161 100644 --- a/v-next/hardhat-node-test-runner/src/task-action.ts +++ b/v-next/hardhat-node-test-runner/src/task-action.ts @@ -61,6 +61,10 @@ const testWithHardhat: NewTaskActionFunction = async ( const files = await getTestFiles(testFiles, hre.config); + if (files.length === 0) { + return 0; + } + const tsx = fileURLToPath(import.meta.resolve("tsx/esm")); process.env.NODE_OPTIONS = `--import ${tsx}`; @@ -79,6 +83,8 @@ const testWithHardhat: NewTaskActionFunction = async ( testOnlyMessage, }); + console.log("Running node:test tests"); + const reporterStream = run(nodeTestOptions) .on("test:fail", (event) => { if (event.details.type === "suite") { diff --git a/v-next/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts b/v-next/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts index 0ef4afaaa6..7e05fc1247 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts @@ -34,6 +34,12 @@ const runSolidityTests: NewTaskActionFunction = async ( ) ).filter((artifact) => artifact !== undefined); + if (testSuiteIds.length === 0) { + return; + } + + console.log("Running Solidity tests"); + const config = { projectRoot: hre.config.paths.root, }; diff --git a/v-next/hardhat/src/internal/builtin-plugins/test/task-action.ts b/v-next/hardhat/src/internal/builtin-plugins/test/task-action.ts index 76f89ab37b..2821bc80e3 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/test/task-action.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/test/task-action.ts @@ -19,9 +19,6 @@ const runAllTests: NewTaskActionFunction = async ( } for (const subtask of thisTask.subtasks.values()) { - console.log( - chalk.bold(`Running the subtask "${formatTaskId(subtask.id)}"`), - ); await subtask.run({ noCompile: true }); console.log(); }