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

Unit and e2e test scaffolding for custom blocks #103

Closed
danielbachhuber opened this issue Jun 4, 2018 · 5 comments
Closed

Unit and e2e test scaffolding for custom blocks #103

danielbachhuber opened this issue Jun 4, 2018 · 5 comments

Comments

@danielbachhuber
Copy link
Member

We make it easy for WordPress plugin authors to add (unit) tests with wp scaffold plugin-tests.

It would be helpful to have a similar "standard automated testing" pattern for WordPress block authors.

This could even be used to help prevent scenarios like WordPress/gutenberg#3693 (comment)

The blocks in the gutenberg-examples repo don't work, and neither does the code in the "create blocks" tutorial. The code examples are all out of date and need to be updated to keep up with Gutenberg development.

Related WordPress/gutenberg#641
Originally WordPress/gutenberg#3706

@danielbachhuber
Copy link
Member Author

@nerrad Do you have anything abstracted at this point that you might be able to share?

@nerrad
Copy link

nerrad commented Jun 4, 2018

What I have right now is still somewhat dependent on the gutenberg package as a whole (because current package releases are still a bit buggy (see WordPress/gutenberg#3955 (comment)). However, once I convert our tests over to using the modular published packages I'll be happy to document/share what we're using. Maybe a first step will be to get some documentation, writing that out will help (me at least) work out where wp-cli can aid that with a scaffold command.

@nerrad
Copy link

nerrad commented Jun 4, 2018

It should be added though, that coming up with a baseline scaffold for custom block tests could be a hard to iron out because test needs can differ widely among custom block implementations. For instance some block authors may just need to test using mocks whereas other block authors may want to test using actual gb packages. However, I suppose a good default would be to have the configuration set to use actual imports and mocks can be implemented at the test level (by block authors if they want)?

Also what were you thinking this scaffold command would do/build?

@danielbachhuber
Copy link
Member Author

Also what were you thinking this scaffold command would do/build?

Basic unit and e2e tests, using the same pattern established by Gutenberg. It could be a prototypical implementation that would need to be modified before use.

@swissspidy
Copy link
Member

This should be covered by @wordpress/create-block nowadays

@swissspidy swissspidy closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants