Summary
The visual IDE (visual-ide/) has a stdout marker parser (src/transpiler/stdoutParser.js) that parses [xazz:*] markers, but there is no unit test for it, and the contract tests (visual-ide/tests/contract.mjs) don't cover the parser. Recently the [xazz:chart] and [xazz:dp] markers changed from a two-line format to a single-line self-contained format (with the old two-line form kept as a fallback). This is untested and worth locking down.
Context
- Parser:
visual-ide/src/transpiler/stdoutParser.js — parseStdout(lines) returns ExecutionEvent[]; helpers getChartEvents, getErrorEvents, getTextEvents.
- New single-line formats:
[xazz:chart] {JSON} (and legacy: [xazz:chart] then JSON on next line)
[xazz:dp] {JSON}
- The repo has no JS test runner for this file (no vitest/jest configured).
visual-ide/package.json scripts use node tests/*.mjs for contract tests.
Task
Add a lightweight test harness for stdoutParser.js:
- A
visual-ide/tests/stdoutParser.mjs (plain Node, no new deps) that imports parseStdout from the transpiler and asserts:
- single-line
[xazz:chart] {json} produces a chart event with transformed data (bar/line with x/y; pie with label/value).
- legacy two-line
[xazz:chart] + JSON still parses (fallback).
[xazz:dp] {json} is ignored as a text/unknown event (the parser doesn't emit dp events — assert it doesn't crash and yields a text event).
[xazz:result] {json} yields a text event (current behavior).
[xazz:error] + AI_SUGGESTION: legacy block yields an error event with suggestion.
- random/non-marker lines yield
text events.
- Wire it into
package.json as "test:stdout": "node tests/stdoutParser.mjs".
- Document in the test file how to run it.
Definition of Done
cd visual-ide && npm run test:stdout passes (requires no server, no browser).
- The existing
npm run build still works.
- Assertions cover both the new single-line and legacy two-line marker forms.
Notes
- Pure JS, no React/DOM — can run in plain Node with the ESM
import.
- Do not rename or restructure
parseStdout; only add tests (fix any bug you find, but note it clearly in the PR).
Summary
The visual IDE (
visual-ide/) has a stdout marker parser (src/transpiler/stdoutParser.js) that parses[xazz:*]markers, but there is no unit test for it, and the contract tests (visual-ide/tests/contract.mjs) don't cover the parser. Recently the[xazz:chart]and[xazz:dp]markers changed from a two-line format to a single-line self-contained format (with the old two-line form kept as a fallback). This is untested and worth locking down.Context
visual-ide/src/transpiler/stdoutParser.js—parseStdout(lines)returnsExecutionEvent[]; helpersgetChartEvents,getErrorEvents,getTextEvents.[xazz:chart] {JSON}(and legacy:[xazz:chart]then JSON on next line)[xazz:dp] {JSON}visual-ide/package.jsonscripts usenode tests/*.mjsfor contract tests.Task
Add a lightweight test harness for
stdoutParser.js:visual-ide/tests/stdoutParser.mjs(plain Node, no new deps) that importsparseStdoutfrom the transpiler and asserts:[xazz:chart] {json}produces achartevent with transformed data (bar/line with x/y; pie with label/value).[xazz:chart]+ JSON still parses (fallback).[xazz:dp] {json}is ignored as a text/unknown event (the parser doesn't emit dp events — assert it doesn't crash and yields a text event).[xazz:result] {json}yields atextevent (current behavior).[xazz:error]+AI_SUGGESTION:legacy block yields an error event with suggestion.textevents.package.jsonas"test:stdout": "node tests/stdoutParser.mjs".Definition of Done
cd visual-ide && npm run test:stdoutpasses (requires no server, no browser).npm run buildstill works.Notes
import.parseStdout; only add tests (fix any bug you find, but note it clearly in the PR).