Opened 3 hours ago
Last modified 3 hours ago
#66324 new defect (bug)
The wp.updates QUnit tests have never run
| Reported by: | dlocc | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Build/Test Tools | Version: | 4.6 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | javascript |
Description
tests/qunit/wp-admin/js/updates.js and tests/qunit/fixtures/updates.js were added with Shiny Updates in [37714], along with the update count markup in tests/qunit/index.html. But index.html never loads the fixture, updates.js, or the tests, so none of the wp.updates tests have ever run.
Loading them shows one more problem. The fixture sets totals: {}, so wp.updates.decrementCount() throws on settings.totals.counts. Because that error escapes the test, QUnit also reports it as a "Script error." on an unrelated wpapi test.
With the three script tags added and the fixture's totals filled in to match its markup, the full suite passes: 704 of 704 assertions, including the 38 wp.updates ones, on both index.html and the minified compiled.html (npm run grunt qunit:compiled).
#59644 plans to move these tests off QUnit. Getting them running first means they come along when that happens.
I found this while working on #66315, where a tester suggested adding assertions to this file. I have a patch ready and will link the PR here.
Change History (1)
This ticket was mentioned in PR #14319 on WordPress/wordpress-develop by @dlocc.
3 hours ago
#1
- Keywords has-patch has-unit-tests added
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The QUnit tests and fixture for
wp.updateswere added with Shiny Updates in [37714] (WordPress 4.6), buttests/qunit/index.htmlnever loaded them, orupdates.jsitself, so they have never run.This PR:
tests/qunit/fixtures/updates.js,build/wp-admin/js/updates.js, andtests/qunit/wp-admin/js/updates.jsintests/qunit/index.html.totals: {},wp.updates.decrementCount()throws onsettings.totals.counts. Because that error escapes the test, QUnit also reports it as a "Script error." on an unrelated wpapi test.#59644 plans to move these tests off QUnit. Getting them running first means they come along when that happens.
Testing Instructions
npm run grunt qunit:compiled, which is what CI runs.wp.updates.index.htmland the minifiedcompiled.html, including the 38wp.updatesassertions.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Finding that the suite never ran, writing the patch, and running the QUnit suite before and after. I reviewed the code and the test results before submitting.