-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hardhat-test-utils
package
#5492
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -38,9 +38,9 @@ | |||
"README.md" | |||
], | |||
"dependencies": { | |||
"@nomicfoundation/ethereumjs-util": "9.0.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jus an automatic reordering that pnpm
did
@@ -61,6 +61,7 @@ | |||
"devDependencies": { | |||
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0", | |||
"@ignored/hardhat-vnext-node-test-reporter": "workspace:^3.0.0-next.0", | |||
"@nomicfoundation/hardhat-test-utils": "workspace:^", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contrary to the rest of our packages, we do workspace:^
here because this is a private package, which we don't intend to publish, so versioning is not an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! One minor suggestion regarding naming: I liked how Node assert distinguishes between throwing and rejecting.
assert.fail("Function did not throw any error"); | ||
} | ||
|
||
export async function assertThrowsHardhatErrorAsync< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about assertRejectsWithHardhatError
?
This PR introduces a new private package,
@nomicfoundation/hardhat-test-utils
, and installs it in all thev-next
packages that are compatible with it (i.e. not dendencies of it).This PR only introduces helpers for
HardhatError
related assertions, but it doesn't change any existing test.A follow-up PR will change the existing tests to use the new utilities.