-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Test suite unhandled promise rejection #167
Comments
That error is thrown from ethers.js when contract isn't found, I've looked into when building cli, it's actually ethers.js error which cannot be easily caught in our code other than hack like this:
|
But why is it being thrown in the middle of the test suite? |
I'm not 100% on this, but I think mocha executes |
Do you know the specific test that's causing it? Perhaps we can make it |
Comment out ethers.test.ts and error will be gone. It happens there because contract address is TBD: |
I can easily fix tests by using sinon to stub Eth1Notifier constructor, but the error is quite annoying since it cannot be catched (it's thrown inside ethers.js contract constructor, so I think we should add checker is contract exists before initiating ether.js contract constructor |
We can hardcode the contract Address if we wanted to. Assume its always deployed by the same mnemonic at nonce 0 (or 1? not sure what default is) then the address will always be the same |
No need, since those are unit tests and they don't actually listens on smart contract events (deposit contract is not even deployed). We just need to skip constructor execution in Eth1Notifier. As for integration tests, I've already setup contract deployment and it uses deployed address. But if someone is going to use cli and input wrong contract address or connects to wrong network, they will receive this misleading error unless we check for contract before ethers.js. |
hmmm i see what you're saying - makes sense. I'm thinking for the tests though, if we need to do tests we can standardize that contract address |
We already solved it like this: |
mmm yeah that always works too |
Describe the bug
There is an unhandled promise rejection within the test sutie for
intToBytes
that does not cause the CI to fail.Expected behavior
The CI should fail, and the test should probably also fail.
Steps to Reproduce
yarn install
yarn test
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: