hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Test `test` task

Open alcuadrado opened this issue 6 years ago • 7 comments

We have to tests for the test task. This can be a little tricky to test, so if someone is willing to give it a try, feel free to ping me and we can discuss how to do it.

alcuadrado avatar Mar 06 '19 16:03 alcuadrado

Hey @alcuadrado , I'd like to contribute.

claudioantonio avatar Jun 09 '21 03:06 claudioantonio

Maybe we can use the e2e tests to at least smoke test the test task? (Talking about this is so confusing)

fvictorio avatar Jun 09 '21 13:06 fvictorio

@fvictorio I understand that the goal of test task is to:

  1. load hardhat.config.ts
  2. Run a development network
  3. then run external mocha test files

If steps 1 and 2 are been tested individually, we could guarantee the expected when a valid mocha test exists and when it does not. 🤔

What Do You think about it?

claudioantonio avatar Jun 10 '21 14:06 claudioantonio

There are two possible ways to test this (and I think we should do both):

  1. Take one of the existing tests under hardhat-core/test/builtin-tasks and use it as the starting point to test the test task.
  2. Use the e2e package and add some scenarios for the test task.

The problem is what to assert. I think in both cases there should be a fixture project with a single passing test and another project with a single failing test, and then we should assert that they exit with a code of 0 and 1, respectively.

fvictorio avatar Jun 10 '21 16:06 fvictorio

The waffle plugin contains a test that runs the test task internally. I think it can work as inspiration.

alcuadrado avatar Jun 10 '21 19:06 alcuadrado

Hi! Since this one seems to be stale for a while, can I take it?

I think I can do this.

SfyMantissa avatar Aug 04 '22 22:08 SfyMantissa

@alcuadrado is this one still relevant?

fvictorio avatar Aug 08 '22 09:08 fvictorio