Docs: Document how to run the QUnit test suite#12699
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 Core Committers: Use this line as a base for the props when committing in SVN: 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.
Pull request overview
Documents how to run WordPress Core’s JavaScript QUnit test suite from a fresh checkout by pointing contributors to the qunit:compiled Grunt task and explaining the build prerequisite for running QUnit directly.
Changes:
- Adds README instructions for running QUnit tests via
qunit:compiled. - Explains why running
qunitdirectly requires pre-built assets inbuild/.
Comments suppressed due to low confidence (1)
README.md:109
- This paragraph mixes
npx grunt …with a baregrunt build, which can be confusing (and may not work ifgruntisn’t on PATH). It’s also more precise to mentioncopy:qunit, sincequnit:compiledruns it.
`qunit:compiled` builds first, then runs the suite. The QUnit runner loads
scripts from the built `build/` directory, so a plain `npx grunt qunit`
requires a completed `grunt build` first—without a build, every test fails
with a `jQuery is not defined` error.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
README.md:108
- For consistency with the suggested command above (and to avoid implying a different invocation path), this reference should also use
npm run gruntinstead ofnpx grunt.
`qunit:compiled` builds first, then runs the suite. The QUnit runner loads
scripts from the built `build/` directory, so a plain `npx grunt qunit`
requires a completed `npm run build` first—without a build, every test fails
README.md:103
- Use the existing npm script wrapper for Grunt (
package.jsonscripts has"grunt": "grunt") to keep the README consistent with other commands here and with CI (.github/workflows/reusable-javascript-tests.ymlrunsnpm run grunt qunit:compiled).
npx grunt qunit:compiled
Adds a README.md section explaining how to run the JavaScript QUnit test suite from a fresh checkout, using `npm run grunt qunit:compiled` to build required files before running the suite. Documents why running `npm run grunt qunit` directly without a prior `npm run build` fails with a `jQuery is not defined` error, since the QUnit runner loads scripts from the built `build/` directory. Fixes #65719. Props lance.willett@automattic.com
d6bcf8c to
ab747e0
Compare
|
|
||
| `qunit:compiled` builds first, then runs the suite. The QUnit runner loads | ||
| scripts from the built `build/` directory, so a plain `npm run grunt qunit` | ||
| requires a completed `npm run build` first—without a build, every test fails |
There was a problem hiding this comment.
| requires a completed `npm run build` first—without a build, every test fails | |
| requires a completed `npm run build` first without a build, every test fails |
Nit
Documents how to run the JavaScript QUnit test suite from a fresh checkout.
This adds the
qunit:compiledcommand, which builds the required files before running the suite. It also explains the build prerequisite for runningqunitdirectly.Trac ticket: https://core.trac.wordpress.org/ticket/65719
Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5
Used for: Drafting, applying, and validating the documentation update under contributor direction.