Skip to content

W-23530974: Normalize CRLF in TCK JSON string comparison#136

Merged
mlischetti merged 1 commit into
masterfrom
W-23530974-fix-tck-crlf-windows
Jul 22, 2026
Merged

W-23530974: Normalize CRLF in TCK JSON string comparison#136
mlischetti merged 1 commit into
masterfrom
W-23530974-fix-tck-crlf-windows

Conversation

@mlischetti

Copy link
Copy Markdown
Contributor

What

Fixes the Windows-only TCK lane failure introduced in #135 (run).
A conformance case outputs JSON with an embedded CSV string value. DataWeave's CSV writer emits CRLF on Windows but LF elsewhere, so the escaped \r\n vs \n inside the JSON string value made compareJson report a mismatch. macOS/Linux (LF) never hit it.

Fix

Normalize CRLF → LF within JSON string values during comparison (deepEqual gains a normEol flag, used by the JSON path), matching the CLI's AssertionHelper EOL handling.

Scoped to the JSON path only — XML text nodes are already normalized by fast-xml-parser, and csv/txt/etc. already EOL-normalize.

Testing

  • npm run test:unit121 passed (+2: CRLF-in-string matches; different strings still differ)
  • npm run test:tck660 passed, 57 skipped, 0 failures (unchanged on macOS)
  • tsc --noEmit clean

🤖 Generated with Claude Code

The TCK lane failed on the Windows CI runner: a JSON output embedding a CSV
value is written with CRLF line endings on Windows but the fixture uses LF, so
the escaped \r\n vs \n inside the JSON string value made compareJson report a
mismatch. macOS/Linux (LF) never hit it.

Normalize CRLF -> LF within JSON string values during comparison (deepEqual
gains a normEol flag used by the JSON path), matching the CLI's AssertionHelper
EOL handling. XML text nodes are already normalized by fast-xml-parser, and
csv/txt/etc. already EOL-normalize, so the fix is scoped to the JSON path.

- compare.ts: deepEqual(a, b, normEol=false); compareJson passes normEol=true.
- 2 unit tests: CRLF-vs-LF inside a string value matches; genuinely different
  string values still differ.

TCK lane: 660 pass / 57 skip unchanged locally. Unit lane: 121.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mlischetti
mlischetti requested a review from a team as a code owner July 22, 2026 18:48
@mlischetti
mlischetti merged commit 9ab1e6f into master Jul 22, 2026
4 checks passed
@mlischetti
mlischetti deleted the W-23530974-fix-tck-crlf-windows branch July 22, 2026 19:06
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.

2 participants