hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
91 stars 31 forks source link

I need a way to compile contracts before running the tests. #245

Open migoldfinger opened 1 year ago

migoldfinger commented 1 year ago

Hi,

I have a hardhat project with various tests. Some of the tests are sensitive to the way the are compiled. I have 2 kind of test runs defined in my package.json one runs the tests only, the other on adds code coverage to the tests. The code coverage tests adds some data to the contracts therefore all tests depending gas costs are failing. When I run from command line this is no problem because 1) hardhat test (default) and hardhat test:coverage do compile the contracts before running the tests 2) hardhat test:coverage is configured to skip gas tests

It seems when I run the tests in mocha test explorer the contracts do not get compiled. So the result of the tests in the mocha test explorer depends on the test run I did from the command line the last time. If it was "hardhat test" all tests go green If it was "hardhat test:coverage" gas tests will fail That should not be the case, I need a way to ensure that "hardhat test" did run before running the tests in mocha test explorer.