-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Move Truffle Test over to new decoder #2646
Conversation
Hm, looks like this is failing CI, presumably because I didn't update tests; will have to see what's up wth that... |
Ugh, looks like I missed an |
ab82a69
to
dc698ea
Compare
Hm -- looks like at least one of the test failures was actually due to a bug in the |
And, another looks to have been due to a bug in |
22f0292
to
811ec76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor formatting notes
depth: null, | ||
colors: true, | ||
maxArrayLength: null, | ||
breakLength: Infinity, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make breakLength be 80?
breakLength: Infinity, | |
breakLength: 80, |
(or whatever, to get the lines to be a bit shorter... I guess this might require finagling to get the indent to work right)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I was just matching the old behavior which was printing the whole thing on one line. As you say, though, splitting over multiple lines will require some indent finagling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I did this, but in order for the result to make sense I also had to put each argument on a separate line. And so I also ended up putting a blank line between events like you suggested elsewhere. Also, I decided to reintroduce the type marker, because why not.
I am hoping the result is good? I encourage you to try it out and see what you think.
Quick note: I've changed this so that it will now use |
Minor note, I've stuck a commit in this PR to fix a problem in |
Question: While it's not due to this PR, this is where it's coming up, so I'm wondering: Is the message you get when you try to decode an indexed argument of reference type (e.g. |
OK, after talking to @gnidan, I added some line-wrapping there. While I was at it I changed the existing line-wrapping logic to go based on total length rather than just the length of the first line... |
One last quick change before I merge, I've lowered |
This PR moves Truffle Test over to using Truffle Decoder to decode events, rather than ethers (by means of web3). Now event decoding in Truffle Test is more comprehensive, more robust, and -- most obviously -- more colorful!
This PR has 3 commits. (Edit: Well, OK, it originally did anyway.) The first commit rewrites
testrunner.js
andsoliditytest.js
in async/await style, and adjuststests.js
to invoke them as such. Note that the two rewritten files aren't exported and so this shouldn't break anything.The second resolves the merge conflict resulting from @CruzMolina replacing all uses of
this.web3.utils
withweb3Utils
.(Then there's a third inbetween, oops.)
The last actually moves these two files over to using the new decoder. For
soliditytest.js
, this doesn't do very much other than move things over. Fortestrunner.js
, this also means adding an indicator for anonymous events (which were previously omitted entirely), adding handling for ambiguous events, and usingResultInspector
to nicely print the decoded values (with color!). I kept it all on a single line as it was before, regardless of length.I did remove the type indicators that used to be printed; they seemed less necessary now. Let me know if you think those should be added back in.
Also, I didn't do anything to handle full mode vs ABI mode; I just printed decodings in whatever form they came in.
Anyway yeah that's basically it. Also I didn't change the compilation call over to the new compile interface, but I know that @gnidan is going to write a review telling me to do so. :P