diff --git a/CHANGELOG.md b/CHANGELOG.md index d192330..4773846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- **`abap2ui5-unit --class` no longer misdiagnoses the classes it did not run.** Every other class with a test include had no `tests` in its result, and the summary read that as "a test include, but the runner found no test method - is the local class FOR TESTING?". `scripts/ci-unit.mjs` marks such a class `notSelected` and the summary lists it as not selected, the way the VS Code extension's results view already skips it. - **`migrate_report` runs report2UI5.** abap-cloud-gui renamed its converter report2cloud to report2UI5 (`tools/report2ui5`) and narrowed it to the user interface of a report - the selection screen, the event blocks, the list, diff --git a/scripts/ci-unit.mjs b/scripts/ci-unit.mjs index 455317b..b5475d9 100755 --- a/scripts/ci-unit.mjs +++ b/scripts/ci-unit.mjs @@ -219,6 +219,10 @@ export function renderSummary({ framework, mode, results }) { lines.push(`- ${r.cls.toUpperCase()}: no test include (deployed for the classes that call it)`); continue; } + if (r.notSelected) { + lines.push(`- ${r.cls.toUpperCase()}: not selected (--class named others)`); + continue; + } const tests = r.tests || []; ran += tests.filter((t) => !t.skipped).length; if (r.notRun) { @@ -412,7 +416,11 @@ async function main(argv) { return 2; } for (const r of results) { - if (!withTests.includes(r.cls)) continue; + if (!withTests.includes(r.cls)) { + // a class with tests that --class did not name: not part of this run + if (r.testclasses && !r.deployError) r.notSelected = true; + continue; + } r.tests = run.tests.filter((t) => t.object === r.cls.toUpperCase()); r.failed = run.failed && run.failed.object === r.cls.toUpperCase() ? run.failed : null; /* The generated runner stops at the first failure: a class it had diff --git a/test/sandbox.test.mjs b/test/sandbox.test.mjs index 52d6200..5141a46 100644 --- a/test/sandbox.test.mjs +++ b/test/sandbox.test.mjs @@ -245,6 +245,19 @@ test('the CI runner reads the project\'s framework pin, collects classes, interf assert.match(stopped, /\*\*ZCL_F\*\*: not run - the runner stops at the first failure \(ZCL_E\)/); assert.doesNotMatch(stopped, /found no test method/); assert.match(stopped, /1 test method\(s\) ran, 1 class\(es\) failing/); + /* --class narrows the run: a class with a test include that was not named + * ran nothing on purpose, and is not "a class without test methods" */ + const narrowed = renderSummary({ + framework: '1.145.0', + mode: 'npm', + results: [ + { cls: 'zcl_g', testclasses: true, tests: [{ localClass: 'ltcl', method: 'ok_one' }], failed: null }, + { cls: 'zcl_h', testclasses: true, notSelected: true }, + ], + }); + assert.match(narrowed, /- ZCL_H: not selected \(--class named others\)/); + assert.doesNotMatch(narrowed, /found no test method/); + assert.match(narrowed, /1 test method\(s\) ran, 0 class\(es\) failing/); }); /* abap2ui5-unit runs on the npm package by default: a checkout somebody