Skip to content
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

Add decorators tests #4103

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add decorators tests #4103

wants to merge 3 commits into from

Conversation

pzuraq
Copy link

@pzuraq pzuraq commented May 30, 2024

This PR is still a WIP, I will be trying to wrap it up tomorrow. Took me a while to get best way to combine templates and cases to have as wide coverage as possible without having to write out every permutation manually.

@pzuraq pzuraq requested a review from a team as a code owner May 30, 2024 23:19
@pzuraq pzuraq marked this pull request as draft May 30, 2024 23:44
@pzuraq
Copy link
Author

pzuraq commented Jun 2, 2024

I've completed writing the tests, now I just need to actually get them to run properly and debug any issues (could be typos, etc).

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jun 2, 2024

https://github.com/babel/babel-test262-runner/ could be useful to run the tests and check if they have any problem.

@pzuraq
Copy link
Author

pzuraq commented Jun 2, 2024

Yes, I've been using that repo for testing in general. The previous commit for fields (a3b4282) was passing, at that point I kinda had all the details figured out for the overall structure so I scaffolded out all of the tests themselves and made sure I had written all of the ones we needed.

Next is just running them again to see if they work and fixing issues. I'm sure there are minor issues, definitely, but could also be some larger ones.

@nicolo-ribaudo one quick question, the generators in make throw an error if the folders don't exist for the output of a template/case file, so I've just been making them manually. I couldn't figure out the command to run to not throw, is there a way to do that easily?

@pzuraq pzuraq marked this pull request as ready for review June 6, 2024 13:43
@pzuraq
Copy link
Author

pzuraq commented Jun 6, 2024

This PR is now ready for review. There are some tests that are failing against the Babel test runner that I can't figure out:

  1. Some class expression tests are failing due to a Babel transpilation error, var C is already declared for some reason. The code is valid and should work, and it transpiles fine in the Babel playground, so I'm not sure what the issue is there.
  2. Some tests that rely on Proxy are failing because Proxy is undefined. I did add the feature flag for it, so I'm not sure what else I need to do to make Proxy available.
  3. The tests for a class decorator returning a non-[[Construct]] arrow function are failing, this is something that the Babel transform does not check for (not sure if it realistically can check for this).

I believe that's it though.

The tests should cover the bulk of decorator behavior, there may be some small gaps but we can address those in followups, this is already a massive PR and I don't want to continue adding to it.

@ptomato
Copy link
Contributor

ptomato commented Aug 15, 2024

@pzuraq We discussed this in yesterday's test262 meeting. We plan to start reviewing it after tackling one other large PR that's been waiting longer.

In the meantime, would you mind splitting the commit on this branch into two commits, one with any hand-written changes and one with autogenerated changes? We'll focus on the former.

@pzuraq
Copy link
Author

pzuraq commented Aug 16, 2024

Ok, sounds good! I can get that done likely by the end of the month or early next month.

@ptomato
Copy link
Contributor

ptomato commented Oct 15, 2024

@pzuraq I went ahead and investigated which tests were autogenerated — it looks like they all are! 😄

A few of them don't have corresponding templates in src/, maybe you forgot to add some files?

  • src/decorator/field-context-kind.case
  • src/decorator/field-initializers-interleave.case
  • src/decorator/field-instance-initializer-order.case
  • src/decorator/field-received-value.case
  • src/decorator/field-static-initializer-order.case
  • src/decorator/decorator-test-123.case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants