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

Include examples of tests #26

Closed
iandunn opened this issue Jul 13, 2018 · 10 comments
Closed

Include examples of tests #26

iandunn opened this issue Jul 13, 2018 · 10 comments
Assignees

Comments

@iandunn
Copy link
Member

iandunn commented Jul 13, 2018

I've found it time consuming to get Jest properly configured with Babel and JSX and all the things. I think it'd be useful to include working testings and all the required build tool configs, in order to make this easier and more convenient for people.

@keesiemeijer
Copy link

I'm new to JS testing and this would be extremely helpful. There is very little documentation about setting up the test environment for custom blocks. From the few plugins that have it set up it's not entirely clear how it was done (and if it was done correctly).

@iandunn
Copy link
Member Author

iandunn commented Apr 9, 2019

wp-scripts probably makes this easier, but the docs only talk about how to install the script, and don't have any examples of actual tests.

@iandunn
Copy link
Member Author

iandunn commented Apr 10, 2019

Related wp-cli/ideas#103

@swissspidy
Copy link
Member

This is still relevant.

I am having trouble getting Jest to run with wp-scripts, see today's discussion on Slack: https://wordpress.slack.com/archives/C02QB2JS7/p1556031641343900.

@iandunn
Copy link
Member Author

iandunn commented Aug 6, 2019

I started a repo in order to try and get a minimal example working.

https://github.com/iandunn/wp-scripts-test-example

I forked https://github.com/eventespresso/event-espresso-core (props @nerrad) and started removing everything that wasn't absolutely necessary for unit tests. it'd be nice to add e2e as well, but so far i've only had time for unit.

It's working, but still requires a lot of stuff that seems like wp-scripts should take care of automatically. I ran out of time to experiment more, though.

cc @gziolo in case you have any insight into what (if anything) wp-scripts can handle, and what still needs work upsteam.

@gziolo
Copy link
Member

gziolo commented Aug 7, 2019

Now that I nearly finished adding support for lint-js (#83), I will try to integrate unit and e2e tests into this repository.

I hope I can identify all the issues we have at the moment when working outside of Gutenberg. I anticipate we might want to be more strict about pattern matching for both types of tests. This should make documenting easier and further usage less confusing.

@gziolo gziolo self-assigned this Aug 7, 2019
@iandunn
Copy link
Member Author

iandunn commented Aug 7, 2019

That would be extremely helpful, thank you!

@iandunn
Copy link
Member Author

iandunn commented Aug 12, 2019

As another example for people, @ryelle got unit tests working for WordCamp.org in WordPress/wordcamp.org#211.

@gziolo
Copy link
Member

gziolo commented Aug 13, 2019

I opened #84 to perform my own explorations and identified a few places where we can improve WordPress packages to make it more seamless.

@gziolo
Copy link
Member

gziolo commented Feb 9, 2022

Tests are located in:
https://github.com/WordPress/gutenberg-examples/tree/trunk/test

It had some further iterations and it works well now.

@gziolo gziolo closed this as completed Feb 9, 2022
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

4 participants