dev-diagnosis-cli 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.5 — unreleased
3
+ ## 0.1.6 — unreleased
4
+
5
+ - Fix: an empty JUnit file (0 bytes, whitespace only, or a declaration/comment
6
+ and nothing else) no longer parses as a clean run of zero tests — the XML
7
+ reader now requires a root element, so the file is reported as
8
+ "no root element", listed in the warnings, and the `flakes` check fails
9
+ instead of silently reporting on half-read data. A genuinely empty report
10
+ (`<testsuites></testsuites>`) still parses to zero tests. (62 tests.)
11
+ - Docs: the 0.1.5 entry below is now dated — it went live on npm on
12
+ 2026-11-11 but the entry still said "unreleased".
13
+
14
+ ## 0.1.5 — 2026-11-11
4
15
 
5
16
  - Fix: a JUnit file that cannot be parsed no longer passes silently —
6
17
  `flakes` used to collect the parse error into a warnings list nothing
package/README.md CHANGED
@@ -107,12 +107,12 @@ Runs the build command twice: cold, with the cache directory moved aside, and wa
107
107
 
108
108
  ### `flakes` — which tests are flaky
109
109
 
110
- Reads JUnit XML across CI runs — each subdirectory of `<junit-dir>` is one run, and each `*.xml` file directly under it is a run of its own — and ranks tests by instability, using a Wilson 95% lower bound so a test that failed twice in two runs outranks one that failed twice in twenty. It distinguishes *passed-on-retry* (failed then passed in the same run, the classic flake signature) from *always-failing* and plain cross-run flakes, and labels each test `new`, `chronic` or `recovered` from its history. CRLF line endings are normalised before parsing, so Windows-produced XML parses the same as Unix-produced XML.
110
+ Reads JUnit XML across CI runs — each subdirectory of `<junit-dir>` is one run, and each `*.xml` file directly under it is a run of its own — and ranks tests by instability, using a Wilson 95% lower bound so a test that failed twice in two runs outranks one that failed twice in twenty. It distinguishes *passed-on-retry* (failed then passed in the same run, the classic flake signature) from *always-failing* and plain cross-run flakes, and labels each test `new`, `chronic` or `recovered` from its history. CRLF line endings are normalised before parsing, so Windows-produced XML parses the same as Unix-produced XML. A file that cannot be parsed — broken XML, or a file with no root element at all (empty, whitespace-only, a lone declaration) — is printed as a warning and fails the check, so the verdict is never based on half-read data; a genuinely empty report (`<testsuites></testsuites>`) still counts as zero tests.
111
111
 
112
112
  ## Development
113
113
 
114
114
  ```sh
115
- npm test # node:test, no extra dependencies — 58 tests
115
+ npm test # node:test, no extra dependencies — 62 tests
116
116
  npm run example # run the CLI against the demo fixture
117
117
  ```
118
118
 
package/lib/xml.mjs CHANGED
@@ -165,6 +165,11 @@ export function parseXml(source, options = {}) {
165
165
  index = start.end;
166
166
  }
167
167
  if (stack.length > 1) fail(`unclosed tag <${stack[stack.length - 1].name}>`, length);
168
+ // An empty document, a file of only whitespace, or a file of only a
169
+ // declaration/comment is not XML at all: it has no root element, so
170
+ // treating it as "zero testcases" would silently report a run set as
171
+ // clean when one of its files was never read.
172
+ if (!document.children.some((child) => isElement(child))) fail('no root element', length);
168
173
  return document;
169
174
  }
170
175
 
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"WJDdidi-1","bin":{"dev-diagnosis":"bin/dev-diagnosis.js"},"bugs":{"url":"https://github.com/WJDdidi-1/dev-doctor/issues"},"description":"One offline CLI that diagnoses a repo the way four small tools do: context noise for AI agents, missing CLI commands, build-cache value, and flaky tests.","engines":{"node":">=18"},"files":["bin/","lib/","examples/","README.md","LICENSE","CHANGELOG.md"],"homepage":"https://github.com/WJDdidi-1/dev-doctor#readme","keywords":["cli","diagnostics","ai-coding","context","build-cache","flaky-tests","path","developer-tools","offline"],"license":"Apache-2.0","name":"dev-diagnosis-cli","repository":{"type":"git","url":"git+https://github.com/WJDdidi-1/dev-doctor.git"},"scripts":{"example":"node examples/demo.mjs","test":"node --test"},"type":"module","version":"0.1.5"}
1
+ {"author":"WJDdidi-1","bin":{"dev-diagnosis":"bin/dev-diagnosis.js"},"bugs":{"url":"https://github.com/WJDdidi-1/dev-doctor/issues"},"description":"One offline CLI that diagnoses a repo the way four small tools do: context noise for AI agents, missing CLI commands, build-cache value, and flaky tests.","engines":{"node":">=18"},"files":["bin/","lib/","examples/","README.md","LICENSE","CHANGELOG.md"],"homepage":"https://github.com/WJDdidi-1/dev-doctor#readme","keywords":["cli","diagnostics","ai-coding","context","build-cache","flaky-tests","path","developer-tools","offline"],"license":"Apache-2.0","name":"dev-diagnosis-cli","repository":{"type":"git","url":"git+https://github.com/WJDdidi-1/dev-doctor.git"},"scripts":{"example":"node examples/demo.mjs","test":"node --test"},"type":"module","version":"0.1.6"}