-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
.wp-env.json schema: Fix schema and add unit tests #63281
Conversation
Size Change: 0 B Total Size: 1.76 MB ℹ️ View Unchanged
|
Flaky tests detected in f8339b5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9851546729
|
f8339b5
to
bbf04ac
Compare
b068f99
to
46e393b
Compare
77bf60d
to
9a52eed
Compare
9a52eed
to
2da12ee
Compare
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. |
import wpEnvSchema from '../../schemas/json/wp-env.json'; | ||
|
||
describe( '.wp-env.json schema', () => { | ||
const jsonFiles = glob.sync( [ '.wp-env.json' ], { onlyFiles: true } ); |
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.
I don't think any new .wp-env.json
files will be added in the future, but I am concerned that there may be a better pattern.
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.
I'd remove the jsonFiles
array entirely if there's only one.
- Import the
.wp-env.json
file just like the schema as an internal dependency. - Remove the
'found .wp-env.json files'
test. - Replace the
test.each
with a singular test. - Replace the
require( filepath )
with the imported variable.
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.
⚠️ Note: One strange thing is that when I run this unit test locally, I get the following error:
I wasn't seeing any errors when running locally.
So this looks good to me 👍
Follow-up #63253
Implement the suggestion in this comment
What?
This PR adds a unit test to validate the wp-env meta schema and the
.wp-env.json
present in the project.At the same time, it fixes errors in the metadata detected by the tests.
Why?
To ensure that we provide a correct meta-schema for developers.
How?
The implementation is similar to the unit tests for other schemas.
Testing Instructions
.wp-env.json
file and add the invalid value or property.npm run test:unit test/integration/wp-env-schema.test.js
validates schema for ".wp-env.json"
test should fail.Please let me know if this problem occurs in your environment.