Skip to content

Keep the test harness off stderr, and off the parent's colour settings - #2

Merged
schneiderjoseph merged 1 commit into
mainfrom
fix-test-harness-streams
Sep 9, 2026
Merged

schneiderjoseph merged 1 commit into
mainfrom
fix-test-harness-streams

Conversation

@schneiderjoseph

Copy link
Copy Markdown
Owner

prepublishOnly refused to publish 0.1.0: two tests failed on a machine with FORCE_COLOR set, and passed everywhere else.

The helper set NO_COLOR on the child while FORCE_COLOR was inherited from the parent. Node warns on stderr when both are set, and the failure branch merged stderr into stdout before JSON.parse, so a harmless warning became "Unexpected non-whitespace character after JSON". The CLI was never at fault: its --json output is clean on stdout.

  • The child inherits neither colour variable; only NO_COLOR is set
  • stdout and stderr are returned separately, so what is parsed is what the command printed. No assertion needed stderr
  • New test: check --json stays parseable with both colour variables set, which is the environment shape that produced the warning

Verified with FORCE_COLOR set, with NO_COLOR set, and with neither: 32 pass.

Summary

Type

Devia compliance

  • Rules touched (IDs):
  • New rule? source cited, severity, priority, validation method:
  • Breaking for adopters? (rule id, .devia/ layout, CLI contract):
  • CHANGELOG.md updated:
  • Generated files rebuilt (npm run build:index):

Checks

  • npm run validate passes
  • npm test passes
  • node bin/devia.mjs check --root . passes
  • devia init still produces a valid project (devia validate clean in a scratch repo)

Not verified

prepublishOnly refused to publish 0.1.0: two tests failed on a machine with
FORCE_COLOR set, and passed everywhere else.

The helper set NO_COLOR on the child while FORCE_COLOR was inherited from the
parent. Node warns on stderr when both are set, and the failure branch merged
stderr into stdout before JSON.parse, so a harmless warning became
"Unexpected non-whitespace character after JSON". The CLI was never at fault:
its --json output is clean on stdout.

- The child inherits neither colour variable; only NO_COLOR is set
- stdout and stderr are returned separately, so what is parsed is what the
  command printed. No assertion needed stderr
- New test: check --json stays parseable with both colour variables set, which
  is the environment shape that produced the warning

Verified with FORCE_COLOR set, with NO_COLOR set, and with neither: 32 pass.
@schneiderjoseph
schneiderjoseph merged commit 815c0b9 into main Sep 9, 2026
4 checks passed
@schneiderjoseph
schneiderjoseph deleted the fix-test-harness-streams branch September 14, 2026 16:08
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