Skip to content

fix(export): set exit code 0 on a successful export#152

Open
arpitjain099 wants to merge 1 commit into
google-labs-code:mainfrom
arpitjain099:chore/export-exit-zero
Open

fix(export): set exit code 0 on a successful export#152
arpitjain099 wants to merge 1 commit into
google-labs-code:mainfrom
arpitjain099:chore/export-exit-zero

Conversation

@arpitjain099

Copy link
Copy Markdown

The export success branches (css-tailwind, json-tailwind, dtcg, css-vars) write their output but never assign process.exitCode, so a successful run just leaves whatever value was already there rather than an explicit 0. This is the success-path counterpart to #126: that PR decoupled the exit code from source lint findings, but its subprocess test only covers json-tailwind, and a real process exits 0 when exitCode is unset, so the gap slipped through. I set process.exitCode = 0 after the format branches (every error branch already returns first, so it only runs on success).

While confirming that, the in-process export.test.ts added in #109 turned out to be failing on main: it asserts process.exitCode === 0 after a css-vars export, which was undefined. The same file also read error.error for the human-readable message, but the error envelope is { error: CODE, message: TEXT }, so I pointed that one assertion at error.message.

Verified with bun test in packages/cli: the two export.test.ts failures now pass and the full suite is green (308 pass, 1 skip, 0 fail), bun run lint clean. Happy to adjust if you'd rather split the test-assertion tweak out. Thanks!

The success branches (css-tailwind, json-tailwind, dtcg, css-vars) write
their output but never assign process.exitCode, so a successful export
left the code at its incoming value instead of an explicit 0. That is the
success-path counterpart to google-labs-code#126, which decoupled the exit code from
source lint findings; the subprocess test there only exercises json-tailwind
and a real process happens to exit 0 when exitCode is unset, so the gap went
unnoticed. Set process.exitCode = 0 after the format branches (every error
branch already returns first).

The in-process export.test.ts added in google-labs-code#109 asserts process.exitCode === 0
after a css-vars export, so it was failing on main. Also fix a companion
assertion in that file: it read error.error for the human message, but the
error envelope is { error: CODE, message: TEXT }, so the text lives on
error.message.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant