-
Notifications
You must be signed in to change notification settings - Fork 82
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
Split up and
expressions
#217
base: main
Are you sure you want to change the base?
Conversation
@skovhus I'm having a little trouble with The callExpressions are now all nested. 😅 - Expected - 3
+ Received + 1
↵
- expect(true).toBe(true);
- expect(true).not.toBe(false);
- expect(true).not.toBe(1);
+ expect(expect(expect(true).to.be.true).not.toBe(false)).not.toBe(1);``` |
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.
This is a tricky one! Thanks for trying to fix it. What helps a lot is using astexplorer to play around with the tree interactively.
In your case, I suggest you to to make splitAndExpressions
turn expect(true).to.be.true.and.to.not.be.false.and.to.not.equal(1);
into:
expect(true).to.be.true;
expect(true).to.not.be.false;
expect(true).to.not.equal(1);
Then the other transformers should be able to handle the rest.
Thanks for pointing me towards astexplorer! Yes, it was my goal to only do the splitting, and let the other transform methods take care of the rest. |
So I have just the topmost call expression by going down the tree. But I have a hard time inserting a new line before or after. I have the feeling that I should approach this based on the expression statements, and then check if an Do you think that would be a better approach? |
Work in progress
Fixes #171