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

Error occured when 'npx hardhat test' a single file #2243

Closed
RutaTang opened this issue Jan 11, 2022 · 1 comment
Closed

Error occured when 'npx hardhat test' a single file #2243

RutaTang opened this issue Jan 11, 2022 · 1 comment
Assignees

Comments

@RutaTang
Copy link

Using hardhat 2.8.2, when try to run a single file test, "Error: Cannot find module" happens.

I start a new project and error still exists, the following are exactly my steps:

  1. npm init --yes
  2. npm install --save-dev hardhat
  3. npx hardhat, choose the "Create an advanced sample project" option
  4. npx hardhat test, works good and no error
  5. npx hardhat test ./test/sample-test.js, afetr test cases are completed, an error happens "Error: Cannot find module './test/sample-test.js'"
@kanej
Copy link
Member

kanej commented Jan 11, 2022

Hey @RutaTang, thanks for the steps, I was able to reproduce locally.

If you run npx hardhat test test/sample-test.js you will avoid the error. Why the npx hardhat test ./test/sample-test.js formulation errors is an open issue, so I am going to close this issue as a duplicate of #2220.

@kanej kanej closed this as completed Jan 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants