-
Notifications
You must be signed in to change notification settings - Fork 27
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
Decaffeinate Tests #8
Conversation
At this point, this is a rough first pass at the change, presenting the raw output from the automated tool https://github.com/decaffeinate/decaffeinate . Looking through the resulting code, the added verbosity may benefit from a Prettier pass (e.g. some lines are way too long now). |
I ran |
The remaing tasks here are:
I'm willing to do this last leg of work as well, but I'd like to hear from you @josephg on the general approach of this PR. What do you think? Would this be a welcome change? Thanks! |
Yep this looks great! I do appreciate this change, and like you I'm curious why the tests are failing. I'd also like it if decaffinate didn't add semicolons at the end of all my lines (my poor hipster JS style conventions...). Once you sort that out I'll merge the change. A better way to verify immutability would be to recursively call |
Awesome! Thanks for reviewing. I will work on the points you mentioned. I can tell Prettier not to include semicolons, so that change at least will be automatic. Changing the way that the immutability tests work at first glance feels out of scope for this PR, but maybe it's necessary now if the decaffeination changed something subtle/fundamental with those particular tests. |
Yes I agree it’s out of scope. And I’d like to know what is causing the problem anyway, on the off chance it’s independently something worth fixing. |
For the record, this is the prettier command I used:
Also, the tests pass locally. They only fail in CI, which suggests the failure is possibly related to some behavior that changed across Node.js versions. I'm on Node 11, and CI is on Node 10. Although, when I use Node 10 locally, the tests pass. The error was to do with module resolution. Perhaps if I update the lock files... |
Ok I found the cause of the error. The test uses a
This should work if we bring back the It would not be a total decaffeination, but it's pretty close. |
Woohoo CI passes! Onto the manual cleanup. |
@josephg Ready for final review. I did a manual pass through the code and removed unnecessary stuff added by I would like to bring your attention to this line in the original test, which doesn't seem to make sense Line 2003 in d8c998d
I've added a
Thanks for accepting my contribution! |
} | ||
|
||
const set = (container, key, value) => | ||
value === undefined |
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.
By the way, I manually changed a coupld of these if
else
sections to use these ternary operators instead. Happy to switch them back if you'd prefer.
Yeah I have no idea what thats doing there. Its a remnant of some test case, no doubt. Its safe to delete. In a sense the real check for correctness is the fuzzer. The unit tests exist to give an overview of the behaviour in all cases; and because if code changes break the existing tests, its much easier to figure out the mistake by looking at some cleaned up failing test cases rather than poring over new logs out of the fuzzer. I'm not entirely happy that coffeescript is still a dependancy after this change - though I assume we'll be able to remove it with a bit more refactoring. But yeah, great stuff! Thanks for your work on this - I really appreciate it. Merging. |
Hooray! |
Closes #7