Skip to content
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

Node test runner plugin supporting js tests #5584

Merged
merged 8 commits into from
Aug 26, 2024
Merged

Node test runner plugin supporting js tests #5584

merged 8 commits into from
Aug 26, 2024

Conversation

zoeyTM
Copy link
Contributor

@zoeyTM zoeyTM commented Aug 8, 2024

closes #5534

Copy link

changeset-bot bot commented Aug 8, 2024

⚠️ No Changeset found

Latest commit: c2d5655

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@zoeyTM zoeyTM marked this pull request as draft August 8, 2024 08:38
@zoeyTM zoeyTM unassigned kanej Aug 8, 2024
@zoeyTM zoeyTM added v-next A Hardhat v3 development task and removed status:triaging labels Aug 8, 2024
@zoeyTM zoeyTM requested a review from galargh August 8, 2024 08:39
Copy link

vercel bot commented Aug 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 6:03am

@alcuadrado
Copy link
Member

I think the CI is failing due to the pnpm problem that @galargh mentioned

@galargh
Copy link
Member

galargh commented Aug 12, 2024

I see you already found the fix in a2290a3 (#5584) 🥳 I just wanted to confirm that without this I had the same issue as CI reported and that defining the references fixes it for me.

Copy link
Member

@galargh galargh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 😸 I left a couple of questions to ensure I understand all the changes being made. I hope you don't mind I'm trying to use the review process as a learning opportunity, too.

The main items I couldn't find definite answers for myself were:

  1. Do we want to cover all the test cases outlined in the Design Doc in this iteration?
  2. Should hre injection into the context be supported after all or not? I thought imports were supposed to be the only path, but I wanted to double-check.

Testing

  • Ran pnpm hardhat test in the example-project

Review Checklist (copied from the issue)

  • Add a new @ignored/hardhat-node-test-runner package under ./v-next
    • It is called @ignored/hardhat-vnext-node-test-runner which follows the guidelines for v-next packages.
  • Implement as a plugin task shim code similar to v2 mocha, that runs the designated test folder js/ts files as tests in Node test runner. Before the tests are run the HRE should be initialized and injected into the context.
    • HRE can be imported in the tests, it does not need to be injected.
  • Include the Hardhat custom test reporter in the default execution
  • Add @ignored/hardhat-node-test-runner to the example project and add some basic integration tests confirming that testing works and that the hre is being initialized
  • Add support for --only to the npx hardhat test command
  • Add cli support for testFiles an optional list of test files

Out of Scope (copied from the issue)

  • Coverage
  • Gas reporting
  • Parallel test execution
  • Support for console.log in tests

v-next/hardhat-errors/src/descriptors.ts Outdated Show resolved Hide resolved
v-next/hardhat-node-test-runner/src/task-action.ts Outdated Show resolved Hide resolved
v-next/hardhat-node-test-runner/src/task-action.ts Outdated Show resolved Hide resolved
v-next/hardhat-node-test-runner/src/task-action.ts Outdated Show resolved Hide resolved
v-next/hardhat-node-test-runner/src/task-action.ts Outdated Show resolved Hide resolved
v-next/hardhat-node-test-runner/test/index.ts Outdated Show resolved Hide resolved
v-next/example-project/package.json Show resolved Hide resolved
Copy link
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the PR, and it looks like Piotr caught everything I would have (and probably more)! 😅 LGTM once these are addressed.

@alcuadrado
Copy link
Member

I'll review this PR tomorrow morning

Copy link
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment to remove a console.log, apart from that this looks ready to be merged

@zoeyTM zoeyTM added this pull request to the merge queue Aug 26, 2024
Merged via the queue into v-next with commit 1bdf98d Aug 26, 2024
119 checks passed
@zoeyTM zoeyTM deleted the node-test-runner branch August 26, 2024 06:09
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
v-next A Hardhat v3 development task
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants