-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 local version of wp-env schema to .wp-env.json #63253
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thanks for adding this 👍
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.
Looks good!
For our blocks and themes, we test the files with Ajv as part of the automated testing.
gutenberg/test/integration/blocks-schema.test.js
Lines 33 to 42 in ed018ef
test.each( jsonFiles )( 'validates schema for `%s`', ( filepath ) => { | |
// We want to validate the block.json file using the local schema. | |
const { $schema, ...blockMetadata } = require( filepath ); | |
expect( $schema ).toBe( 'https://schemas.wp.org/trunk/block.json' ); | |
const result = ajv.validate( blockSchema, blockMetadata ) || ajv.errors; | |
expect( result ).toBe( true ); | |
} ); |
gutenberg/test/integration/theme-schema.test.js
Lines 37 to 47 in ed018ef
test.each( jsonFiles )( 'validates schema for `%s`', ( filepath ) => { | |
// We want to validate the theme.json file using the local schema. | |
const { $schema, ...metadata } = require( filepath ); | |
// we expect the $schema property to be present in the theme.json file | |
expect( $schema ).toBeTruthy(); | |
const result = ajv.validate( themeSchema, metadata ) || ajv.errors; | |
expect( result ).toBe( true ); | |
} ); |
Adding tests for our .wp-env.json would be a good next step.
Co-authored-by: t-hamano <[email protected]> Co-authored-by: fabiankaegy <[email protected]> Co-authored-by: ajlende <[email protected]>
Co-authored-by: t-hamano <[email protected]> Co-authored-by: fabiankaegy <[email protected]> Co-authored-by: ajlende <[email protected]>
Similar to #61312
What?
This PR adds a reference to the local schema in the wp-env config file used by the Gutenberg project.
Why?
.wp-env.json
..wp-env.json
in the Gutenberg project.Testing Instructions
.wp-env.json
file in a code editor.