JUnit XML Dialect Normalizer
JUnit XML has no single current specification, and CI consumers do not accept every producer dialect consistently. This extension provides one local command that validates the active report and rewrites nested suites into a deterministic, flat testsuites document for the selected consumer.
Install and try it in one minute
- Install JUnit XML Dialect Normalizer from the Visual Studio Marketplace.
- In VS Code, create a new file named
sample-junit.xml and paste this harmless synthetic report:
<?xml version="1.0"?>
<testsuites>
<testsuite name="outer">
<testcase name="passes" time="0.2" />
<testsuite name="inner">
<testcase name="fails" time="0.3">
<failure message="synthetic failure" />
</testcase>
</testsuite>
</testsuite>
</testsuites>
- Press
Ctrl+Shift+P (or Cmd+Shift+P on macOS), type JUnit XML: Normalize for CI Consumer, and select that command.
- Confirm that VS Code reports Normalized JUnit XML for azure-pipelines. The active document should now contain two top-level suites named
outer and outer / inner; the root totals should be tests="2", failures="1", and time="0.5".
- Review the edit and save only if you want to keep it. VS Code Undo reverses the change.
The default target is Azure Pipelines. To try GitLab instead, set JUnit XML Dialect Normalizer: Target to gitlab in VS Code Settings before running the same command.
Normal workflow
- Open a JUnit XML report in VS Code.
- Set
junitXmlDialectNormalizer.target to azure-pipelines or gitlab.
- Run JUnit XML: Normalize for CI Consumer from the Command Palette.
- Review and save the edited document.
The command works entirely in the editor. It makes no network requests and sends no telemetry. It rejects DTD and entity declarations, malformed XML, unsupported roots, excessive input, and empty GitLab-targeted reports. On failure, the document is not changed.
Normalization flattens nested suites, retains testcase content and suite metadata, adds ancestor names to flattened suite names, and recalculates tests, failures, errors, skipped, and time. Keep the original report under source control or regenerate it if you need to reverse the edit.
Local verification
From the materialized project directory, run:
node tests/run-tests.js
node scripts/check-bundle.js --check
Both checks use only Node.js built-in modules. No dependency installation is required.
Extension Development Host (contributors)
Open this folder in VS Code, start an Extension Development Host for the folder, open a JUnit XML fixture, and invoke the command from the Command Palette. The automated fixture test also exercises command registration, document replacement, target configuration, and success messaging with a deterministic VS Code API fixture.
Scope and limitations
This MVP supports the conventional testsuites, testsuite, and testcase structure. It intentionally does not implement XML schemas, arbitrary custom entities, XSLT, automatic file discovery, background processing, uploads, or default-on telemetry. Always review normalized output before supplying it to CI.