Closed WillBrock closed 2 years ago
For the forEach
parts I think it might be easiest to do the following with jscodeshift but I'm not sure how to do it.
From:
[1,2,3].forEach(num => {
browser.pause(5000);
})
To:
await Promise.all([1,2,3].map(async num => {
await browser.pause(5000);
});
Any suggestions would be helpful.
@WillBrock thanks for the work! Have you tried https://astexplorer.net/? It is really great to understand how one piece of code needs to be replaced with the other. Also would you mind extending the test cases so we are sure to not introduce any bugs down the line?
Fixed a few things and added converting forEach
to regular for
loops. Still a work in progress.
Will add some tests as well.
I think I've got the majority of things covered. I added tests for it but the tsx parser ones are failing because it doesn't add async to method definitions. I'm not sure why those are failing so something I'll need to read up more on.
Still some more edge cases I need to do that are coming up.
@WillBrock great work! Let me know when this is ready to review and I am happy to take a look.
@WillBrock Great work! is it ready to use or you need some help on that?
@kailin0512 It's just about ready. I've just got a few things to clean up and I'll try to push the changes tomorrow.
I think this is basically ready. I'm still going through some of our codebase at work (about 3k files) but most things are working.
If anyone wants to try it out feel free and let me know what issues you run into.
@christian-bromann This is ready.
Awesome work @WillBrock , let me review it asap.
@christian-bromann any update on approving this?
and @WillBrock how can I try this out before it's published? I'm happy to help test it.
Thank you @WillBrock for your work on this!
Expanding off of this pull request
This looks to do the sync to async conversion on most things.
This should convert:
describe
,before
,it
to asyncAdd to constants arrays for custom items unique to a codebase
In
async/constants.js
AWAIT_CUSTOM_GETTERS
- Add getters here that will need to be awaited. e.g. things like$$
EXCLUDE_METHODS
- Add class methods here that don't need to be async / await