Skip to content

Commit

Permalink
Change how we print the titles of the test tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado committed Oct 28, 2024
1 parent 9786e45 commit f160ce0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions v-next/hardhat-mocha-test-runner/src/task-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ const testWithHardhat: NewTaskActionFunction<TestActionArguments> = 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}`;

Expand Down Expand Up @@ -81,6 +85,8 @@ const testWithHardhat: NewTaskActionFunction<TestActionArguments> = 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();
Expand Down
6 changes: 6 additions & 0 deletions v-next/hardhat-node-test-runner/src/task-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const testWithHardhat: NewTaskActionFunction<TestActionArguments> = 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}`;

Expand All @@ -79,6 +83,8 @@ const testWithHardhat: NewTaskActionFunction<TestActionArguments> = async (
testOnlyMessage,
});

console.log("Running node:test tests");

const reporterStream = run(nodeTestOptions)
.on("test:fail", (event) => {
if (event.details.type === "suite") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
)
).filter((artifact) => artifact !== undefined);

if (testSuiteIds.length === 0) {
return;
}

console.log("Running Solidity tests");

const config = {
projectRoot: hre.config.paths.root,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = 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();
}
Expand Down

0 comments on commit f160ce0

Please sign in to comment.