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 ability to run block tests against specific Gutenberg versions #20239

Closed
wants to merge 25 commits into from

Conversation

glendaviesnz
Copy link
Contributor

@glendaviesnz glendaviesnz commented Jul 1, 2021

Changes proposed in this Pull Request:

  • Adds a script to allow running of block unit and fixture tests against specific versions of gutenberg

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Checkout PR
  • Run pnpm fixtures:test:gbv trunk 3774b1489f17de1da53a96a2066ce9a8f996293c
  • This will check out the commit that caused the recent 10.9.0 regressions with the subscriptions block, so once this task has completed you should see 2 block fixture failures
  • Run pnpm fixtures:test:gbv test-validation to just run the tests again
  • Run pnpm fixtures:test:gbv reset and check that ./packages and ./tests/temp-gutenberg-checkout dirs have been removed and the ./package.json changes have been reverted and pnpm test-extensions completes successfully
  • Run pnpm fixtures:test:gbv trunk and make sure all the tests complete successfully

Todo:

  • Get block unit tests running

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello glendaviesnz! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D63561-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions github-actions bot added [Block] Subscriptions [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jul 1, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: July 20, 2021.
  • Scheduled code freeze: July 15, 2021.

@glendaviesnz glendaviesnz force-pushed the add/block-tests-against-gutenberg-versions branch from bd9a0d5 to 9d8763d Compare July 4, 2021 21:36
@brbrr
Copy link
Contributor

brbrr commented Jul 5, 2021

@glendaviesnz Is there any info where I can learn more about the motivation behind this PR?

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jul 5, 2021
@glendaviesnz
Copy link
Contributor Author

glendaviesnz commented Jul 5, 2021

@glendaviesnz Is there any info where I can learn more about the motivation behind this PR?

p1HpG7-cuI-p2 Very open to ideas about other ways of approaching this.

Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea of being able to run against a different version of Gutenberg is a good idea, but I don't like the amount of hackery going on in the script you're adding here.

I have to wonder how this even works given the failures in #19328 where renovate is trying to update the same pacakges.

Unfortunately I don't know enough about how all this stuff works to be able to suggest a better way to do things.

@@ -38,6 +38,7 @@
"fixtures:regenerate": "REGENERATE_FIXTURES=y GENERATE_MISSING_FIXTURES=y pnpx jest",
"fixtures:generate": "GENERATE_MISSING_FIXTURES=y pnpx jest",
"fixtures:test": "jest validate.js",
"fixtures:test:gbv": "node tests/test-gutenberg-version.mjs",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add .mjs to the set of files that are linted, like we just did for .cjs as part of PR 20085 (see here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do that if we decide to go ahead with this PR based on outcome of discussions at p1HpG7-cuI-p2

Comment on lines +152 to +159
'showdown',
'simple-html-tokenizer',
'hpq',
'react-autosize-textarea',
'traverse',
'css-mediaquery',
'@emotion/styled',
'@emotion/react',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here? Are all of these going to have to be added someday when we get around to making #19328 happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just temporarily adding some additional dependencies that the latest Gutenberg needs to successfully build - I assume that these could be removed when #19328 happens, although there is always the potential that the cutting edge Gutenberg is going to have some dependencies that the Jetpack repo doesn't.

@glendaviesnz
Copy link
Contributor Author

I think the idea of being able to run against a different version of Gutenberg is a good idea, but I don't like the amount of hackery going on in the script you're adding here.

Not the ideal setup in my view either, but I couldn't find any other way of making this happen without a temporary adjustment of the current dependencies - and the only way to automate that is a temporary hack of the package.json files as far as I can see.

If the issues with #19328 are resolved would the plan be to try and keep the Jetpack repo more in-sync with the latest @WordPress package releases? If that was the case maybe this approach isn't necessary?

I have to wonder how this even works given the failures in #19328 where renovate is trying to update the same pacakges.

It probably works because we aren't trying to build the whole project with the new dependencies, it is only the Jetpack block code that is being compiled against them on the fly via the jasmine test runner

@anomiex
Copy link
Contributor

anomiex commented Jul 7, 2021

If the issues with #19328 are resolved would the plan be to try and keep the Jetpack repo more in-sync with the latest @WordPress package releases? If that was the case maybe this approach isn't necessary?

It'd be good to keep better on top of the renovate backlog, yes. Part of the problem is that we don't have anyone really familiar with all this React code on Crew, so if something breaks in an update it's hard for us to fix on our own.

It probably works because we aren't trying to build the whole project with the new dependencies, it is only the Jetpack block code that is being compiled against them on the fly via the jasmine test runner

But even test-extensions is failing there.

@glendaviesnz
Copy link
Contributor Author

But even test-extensions is failing there.

Yeh, because of changes in the Gutenberg packages a few of the tests were failing, I had to update quite a few of the tests to get them to run against the different dependency trees.

In theory, if I get this PR finalised and merged, and #19328 is rebased, the test-extensions issues should be resolved there.

@anomiex
Copy link
Contributor

anomiex commented Jul 8, 2021

If the issues with #19328 are resolved would the plan be to try and keep the Jetpack repo more in-sync with the latest @WordPress package releases? If that was the case maybe this approach isn't necessary?

Yeh, because of changes in the Gutenberg packages a few of the tests were failing, I had to update quite a few of the tests to get them to run against the different dependency trees.

In theory, if I get this PR finalised and merged, and #19328 is rebased, the test-extensions issues should be resolved there.

Maybe it'd make more sense to fix #19328 so it can be merged, then see if the controversial parts of this approach are still necessary?

That might also simplify the necessary changes, as when doing it in #19328 you wouldn't need to continue to support the old versions of the packages too.

@glendaviesnz
Copy link
Contributor Author

Maybe it'd make more sense to fix #19328 so it can be merged, then see if the controversial parts of this approach are still necessary?

Yeh, good idea, I will take another look at it from that angle.

@glendaviesnz
Copy link
Contributor Author

Closed in favour of #20327 which removes the test updates which are moved to #20326

@github-actions github-actions bot removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Needs Team Review labels Jul 12, 2021
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.

4 participants