Enhancement: add more readable parser error snapshots - #130
Open
wasd243 wants to merge 3 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
==========================================
+ Coverage 71.17% 71.25% +0.08%
==========================================
Files 220 220
Lines 6234 6224 -10
==========================================
- Hits 4437 4435 -2
+ Misses 1797 1789 -8
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
wasd243
force-pushed
the
feat/position-in-error-output
branch
from
July 29, 2026 22:10
4fc002f to
4de347e
Compare
Contributor
Author
|
I noticed this when testing parser errors with longer When the input is large, locating errors from {
"token": "right-block",
"rule": "fallback",
"span": [
// very large number
// very large number
],
"kind": "no-rules-match"
}The compiler-style |
wasd243
marked this pull request as ready for review
July 29, 2026 22:33
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.
Description
This PR adds an optional
errors.stderrsnapshot for parser tests, providing compiler-style diagnostics with precise source locations.Developers can optionally add an
errors.stderrfile to failing test cases to verify human-readable parser diagnostics.errors.jsonis still required for parser-error tests.errors.stderris only intended to improve readability for long test inputs (e.g. full articles used for dogfooding, Unicode tests).errors.stderris not generated automatically. To enable it for a test, create an emptyerrors.stderrfile first.Example output:
Dependency
This PR adds codespan-reporting as a dev-dependency to render compiler-style diagnostics for
errors.stderr.