Open marcelomorgado opened 5 years ago
Another idea: Try to force snapshot / nonce management thru mochaSetup.js
using global hooks at all packages.
@marcelomorgado This is a good idea.
Haha I was just typing what I think is the same idea you just posted!
"Are there any commands to restore ganache
to its default starting state at the start of any test suite? That might be faster than starting a new ganache
instance"
A fix to be made: Ensure that blockchain will be reverted to the correct snapshot
beforeEach
test case. Now, when an exception occurs inside a hook and beforerevertFromSnapshot
it's breaking the test suite and demandsganache-cli
restarting.
Refs: https://github.com/tasitlabs/TasitSDK/issues/149#issuecomment-457336552
@marcelomorgado What's that quote from?
Oh, sorry I've just edited the comment above with the reference.
Our main test script runs
npm test
scripts of all packages against the same instance ofganache-cli
(with contracts deployed after start). If some test suite doesn't manage snapshot correctly, another test suite can fail since the blockchain state isn't the expected one. Another problem that can occur is related to the accounts that are shared between test suites: Nonce issues can occur if some test case doesn't handle that correctly. An idea that could help to solve this issue is to start aganache
instance for each test suite, but it'll slow the test script a lot. @pcowgill any idea?