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

Improve isolation between test suites #221

Open
marcelomorgado opened this issue Feb 26, 2019 · 5 comments
Open

Improve isolation between test suites #221

marcelomorgado opened this issue Feb 26, 2019 · 5 comments
Labels
question Further information is requested tech debt Technical debt not involving bugs or features
Milestone

Comments

@marcelomorgado
Copy link
Contributor

Our main test script runs npm test scripts of all packages against the same instance of ganache-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 a ganache instance for each test suite, but it'll slow the test script a lot.
@pcowgill any idea?

@marcelomorgado marcelomorgado added question Further information is requested tech debt Technical debt not involving bugs or features labels Feb 26, 2019
@marcelomorgado marcelomorgado added this to the 0.2.0 release milestone Feb 26, 2019
@marcelomorgado
Copy link
Contributor Author

Another idea: Try to force snapshot / nonce management thru mochaSetup.js using global hooks at all packages.

@pcowgill
Copy link
Member

@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"

@marcelomorgado
Copy link
Contributor Author

marcelomorgado commented Feb 26, 2019

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 before revertFromSnapshot it's breaking the test suite and demands ganache-cli restarting.

Refs: #149 (comment)

@pcowgill
Copy link
Member

@marcelomorgado What's that quote from?

@marcelomorgado
Copy link
Contributor Author

Oh, sorry I've just edited the comment above with the reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested tech debt Technical debt not involving bugs or features
Projects
None yet
Development

No branches or pull requests

2 participants