Skip to content

Commit ba6773d

Browse files
committed
improve testFail* deprecation warning handling
1 parent b321e15 commit ba6773d

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

v-next/hardhat/src/internal/builtin-plugins/solidity-test/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function warnDeprecatedTestFail(
149149
artifact.id,
150150
sourceNameToUserSourceName,
151151
);
152-
const warningMessage = `${colorizer.yellow("Warning")}: ${name} Tests name \`testFail*\` has been removed. Consider changing to \`vm.expectRevert()\` for testing reverts in ${formattedLocation}\n`;
152+
const warningMessage = `${colorizer.yellow("Warning")}: ${name} The support for the prefix \`testFail*\` has been removed. Consider using \`vm.expectRevert()\` for testing reverts in ${formattedLocation}\n`;
153153

154154
console.warn(warningMessage);
155155
}

v-next/hardhat/src/internal/builtin-plugins/solidity-test/task-action.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,25 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
112112
]),
113113
);
114114

115-
const testSuiteArtifacts = edrArtifacts
115+
edrArtifacts.forEach(({ userSourceName, edrAtifact }) => {
116+
if (
117+
rootFilePaths.includes(
118+
resolveFromRoot(hre.config.paths.root, userSourceName),
119+
) &&
120+
isTestSuiteArtifact(edrAtifact)
121+
) {
122+
warnDeprecatedTestFail(edrAtifact, sourceNameToUserSourceName);
123+
}
124+
});
125+
126+
const testSuiteIds = edrArtifacts
116127
.filter(({ userSourceName }) =>
117128
rootFilePaths.includes(
118129
resolveFromRoot(hre.config.paths.root, userSourceName),
119130
),
120131
)
121-
.filter(({ edrAtifact }) => isTestSuiteArtifact(edrAtifact));
122-
123-
testSuiteArtifacts.forEach(({ edrAtifact }) => {
124-
warnDeprecatedTestFail(edrAtifact, sourceNameToUserSourceName);
125-
});
126-
127-
const testSuiteIds = testSuiteArtifacts.map(
128-
({ edrAtifact }) => edrAtifact.id,
129-
);
132+
.filter(({ edrAtifact }) => isTestSuiteArtifact(edrAtifact))
133+
.map(({ edrAtifact }) => edrAtifact.id);
130134

131135
console.log("Running Solidity tests");
132136
console.log();

0 commit comments

Comments
 (0)