radicle-contracts icon indicating copy to clipboard operation
radicle-contracts copied to clipboard

Tests don’t compile the first time after contract API changes

Open geigerzaehler opened this issue 4 years ago • 2 comments

Changes in the contract APIs should be reflected in the TypeScript contract bindinings for ethers. However, these changes are not picked up by yarn test when run for the first time.

When we make a change to a contract yarn test will recompile the contract and generate bindings with typechain. Then the tests, which import the bindings, are typechecked and run. However the tests are typechecked against the bindings from the unchanged contracts.

A second invocation of yarn test picks up the changed bindings that were build in the previous invocation.

geigerzaehler avatar Oct 01 '20 09:10 geigerzaehler

I'm unable to reproduce this issue. I'm adding a function to the contract, adding its usage in a test, running yarn run test and it's passing just fine. After yarn run test my IDE start correctly autocompleting in tests with the new function. There were some updates in the meantime, could you check if you're still able to reproduce it?

CodeSandwich avatar Oct 05 '20 10:10 CodeSandwich

I’m still seeing this issue. One way to easily reproduce this is to rm contract-bindings && yarn run test.

The IDE is fine, though. I believe that yarn test caches the content of the files on start up. When the process changes the files the change is not picked up.

geigerzaehler avatar Oct 05 '20 13:10 geigerzaehler