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

hardhat test doesn't run any tests and ends with passing 0 #4464

Closed
0x0OZ opened this issue Oct 11, 2023 · 2 comments
Closed

hardhat test doesn't run any tests and ends with passing 0 #4464

0x0OZ opened this issue Oct 11, 2023 · 2 comments
Assignees

Comments

@0x0OZ
Copy link

0x0OZ commented Oct 11, 2023

Version of Hardhat

2.18.0

What happened?

The long version: I have a hardhat project with foundry, I followed instructions in both foundrybook and hardhat docs and things were going well after I removed the contract and the test Lock.sol, Lock.ts the tests stopped working and started giving 0 passing.

image

After I found the cause (I didn't know removing lock.ts is the cause at first ), I made a simple hardhat project with my contract and test and I was able to reproduce the bug when I remove the test lock.ts .

Minimal reproduction steps

Create a simple TS hardhat project, add any contract with test then remove the test for Lock.ts .

You can also just clone the repo that has this issue and try to run the test with and without the Lock.ts test
https://github.com/0x0OZ/freeflow-taxableToken/tree/0c74903012bb0ecefc68568fd693787917817c5f

Search terms

hardhat test passing zero / fix hardhat test / hardhat test doesn't run

@0x0OZ
Copy link
Author

0x0OZ commented Oct 12, 2023

Hey @fvictorio,

You don't need to debug this I found the main cause
In my Token.ts I was using async with the first describe which caused no test to be really executed before the program exits...
and when having the Lock.ts test this gives the execution enough time to run the Async tests to give the results.

Solution:

To solve this I just need to remove the async from the main describe statement and fix any following-up errors by removing it.

This is a native JS behavior and not a hardhat bug, So I will close it as it doesn't require any further actions from your side.

@0x0OZ 0x0OZ closed this as completed Oct 12, 2023
@github-project-automation github-project-automation bot moved this from Ready to Done in Hardhat Oct 12, 2023
@fvictorio
Copy link
Member

Thanks for letting us know!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

2 participants