feat(ui5): Add QUnit best-practices skill#80
Conversation
There was a problem hiding this comment.
@codeworrior Could you have a look at this QUnit best practices, please?
codeworrior
left a comment
There was a problem hiding this comment.
Overall LGTM, but IMO, there are still a few things to be clarified / added.
Adds the ui5-best-practices-qunit skill covering coding standards for OpenUI5/SAPUI5 unit test files. Follows the same structure as the OPA5 skill: a lean SKILL.md router plus three focused reference files loaded on demand by task type (writing new tests, modernizing existing ones, async patterns). - SKILL.md: trigger description with literal user phrases, core rules table, quick-reference checklist - references/writing-new-tests.md: module structure, AAA pattern, test naming, helpers, file setup (/*global QUnit */, sap.ui.define imports) - references/modernizing-tests.md: var/const/let, bind, assert.async, Core.applyChanges, sinon sandbox, assert.expect, import cleanup, encoding fix, what-not-to-change guard table - references/async-patterns.md: nextUIUpdate vs Core.applyChanges decision table (incl. fake-timer exceptions), waitForEvent, waitForRendering via addEventDelegate, when not to convert assert.async - README.md: adds ui5-best-practices-qunit section - plugin.json / .github/plugin/plugin.json: adds "qunit" keyword - All files ISO 8859-1 compliant (no em dashes or non-ASCII) JIRA: BGSOFUIPIRIN-7067
d894c0d to
96cbd54
Compare
…curacies PR review feedback (flovogt, codeworrior): - README: sort skills alphabetically (qunit after opa5) - async-patterns: promote nextUIUpdate(clock) as the mainstream fake-timer approach (not a limited caveat); add nextUIUpdate.runSync() for sync helpers; replace "note in commit message" with per-occurrence inline comment guidance; fix import path to sap/ui/test/utils/nextUIUpdate; note deprecated sap/ui/qunit/utils/nextUIUpdate re-export (since 1.127); add legacy-free UI5 warning; remove misleading placeAt() exception row - modernizing-tests: expand §5 with bridge-vs-sandbox consistency rule and verifyAndRestore guidance; expand §7 to cover non-standard Core param names and sap.ui.getCore() distinction; soften §8 encoding wording from "must be ISO 8859-1" to "avoid non-ASCII"; update grep patterns to reflect real project layouts; add §9 QUnit 1 -> QUnit 2 globals migration - writing-new-tests: add sinon bridge-vs-dependency consistency guidance, CPOUI5FOUNDATION-1204 note, fix grep path patterns - SKILL.md: add QUnit 1 migration trigger, update sinon sandbox/bridge rule, fix fake-timer checklist item, soften encoding wording throughout
96cbd54 to
dd5abe4
Compare
|
Here is the original qUnit improvement pilot change 6566798 (Gerrit ID). |
|
@plamenivanov91 please rebase |
|
Again, well done! Only a few comments remaining. |
- Correct sap.ui.getCore() guidance: mid-code calls are a hidden dependency on sap/ui/core/Core and prevent import removal; carve out bootstrap exception (attachInit/ready) - Expand non-ASCII guidance: allow Unicode escapes (e.g. \u00a0) for semantically meaningful characters instead of blanket ASCII-only - New tests: prohibit deprecated Core APIs; name concrete replacements (Element.getElementById, ControlBehavior.getAnimationMode, Localization.getLanguage)
|
As recommended by @pskelin , I installed skill-creator and tested the PR. Here is a short AI summary of the test: The so called gap is not really relevant, as it's already implemented in the subsidiary files. Also recommended by @kineticjs , I ran this skill guideline. Here is the AI summary of it: Basically it's more polish than actual relevant changes. AI recommends leaving the current PR as is, being relevant and useful. |
|
@codeworrior @d3xter666 looking forward to your review |
codeworrior
left a comment
There was a problem hiding this comment.
LGTM. My only comment is about a rare edge case.
- removed non ascii symbols
Adds the
ui5-best-practices-qunitskill covering coding standards for OpenUI5/SAPUI5 unit test files. Follows the same structure as the OPA5 skill: a lean SKILL.md router plus three focused reference files loaded on demand by task type.Files
/*global QUnit */,sap.ui.defineimports), deprecated Core API replacements (Element.getElementById,ControlBehavior.getAnimationMode,Localization.getLanguage)var/const/let,.bind,assert.async,Core.applyChanges, sinon sandbox,assert.expect, import cleanup, encoding fix, what-not-to-change guard tablenextUIUpdatevsCore.applyChangesdecision table (incl. fake-timer exceptions),waitForEvent,waitForRenderingviaaddEventDelegate, when not to convertassert.asyncui5-best-practices-qunitsection"qunit"keywordAll files ISO 8859-1 compliant (no em dashes or non-ASCII); Unicode escapes used for semantically meaningful characters.
Review feedback addressed
sap.ui.getCore()mid-code calls count as a hiddenCoredependency and prevent import removal; top-levelattachInit/readycalls are out of scopebeforeEachexception clarified: when an event must be attached before the initial render, move the full setup (attachEvent+placeAt+await nextUIUpdate()) into the test body to avoid QUnit's internal scheduling inserting a render in betweenJIRA: BGSOFUIPIRIN-7067