Repository navigation
fix: write non-ASCII test fixtures as JSON escape sequences - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the failing CI on the initial commit (run 37125064280): the
TestandGolden file matches BlockNotejobs both failed on theline_sepfixture.Cause
line_sepexercises U+2028 / U+2029 (line and paragraph separators). Those were written as raw characters intestdata/blocknote_fixtures.json, and something in the toolchain stripped them, so the committed fixture silently became plainabc:go testconvertedabcbut the golden file expectsa b c;abcand got a different result from the golden file.Lint passed. Nothing was wrong with the converter itself.
Changes
testdata/blocknote_fixtures.json): restoreline_sepand rewrite the file with every non-ASCII character as a\uXXXXescape, so no editor or tool can strip one again.js/golden.test.ts): escape U+2028, U+2029 and U+FEFF when writingtestdata/blocknote_golden.json.JSON.stringifyemits them raw, which is the same trap. Only two lines of the golden file change (raw characters become escapes); the converted output is identical.golden_test.go):TestFixturesAreASCIIfails if the fixtures contain any raw non-ASCII byte, or if either testdata file contains a raw U+2028, U+2029 or U+FEFF. It immediately caught a second case, a raw U+FEFF in the golden file (the zero-width fixture), which is fixed here too.Test plan
go test -race ./...golangci-lint runcd js && npm run golden(real BlockNote output matches the golden file)Lint,Test,Golden file matches BlockNote)🤖 Generated with Claude Code