-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser: Pass-through PHP errors in tests #11429
Merged
Merged
Conversation
This file contains 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
In #11320 we started running all parsers against the same set of unit tests. Unfortunately when the PHP-based parsers failed inside the PHP process or returned non-JSON data then the tests would fail without providing any information about why. My personal workaround was to manually run the PHP test runner from the command line to see the output. This was inefficient. In this patch we're trapping the response code from the PHP test runner and throwing an `Error` with the output from `php` so that our `jest` tests can see and report them. This will make it easier debug failing tests.
dmsnell
added
the
[Feature] Parsing
Related to efforts to improving the parsing of a string of data and converting it into a different f
label
Nov 2, 2018
aduth
approved these changes
Nov 2, 2018
This was referenced Jun 20, 2023
This was referenced Nov 27, 2023
This was referenced May 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Parsing
Related to efforts to improving the parsing of a string of data and converting it into a different f
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.
In #11320 we started running all parsers against the same set of unit
tests. Unfortunately when the PHP-based parsers failed inside the PHP
process or returned non-JSON data then the tests would fail without
providing any information about why.
My personal workaround was to manually run the PHP test runner from
the command line to see the output. This was inefficient.
In this patch we're trapping the response code from the PHP test runner
and throwing an
Error
with the output fromphp
so that ourjest
tests can see and report them. This will make it easier debug failing
tests.
Testing
You can see the impact of the change by introducing a syntax error in the
default PHP parser. Inside the
parse()
method I added a new line with<!--
as its contents - invalid PHP.In master I ran:
npm run test-unit packages/block-serializer-default-parser
In this branch though…