feat: allow debug receive outerHTML #292
Closed
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/Motivation (TLDR;)
This PR adds a new feature to the Jest Preview library that allows developers to pass HTML output generated by other libraries to the
debug
function. Specifically, this PR replaces the current implementation of thedebug
function in/src/preview.ts
with a new function that accepts an HTML string as a parameter. This makes it possible for developers to use other libraries (such as react-native-to-jest-preview) to generate the HTML output for Jest Preview.Related issues
Features
debug
function to accept an HTML string generated by other librariesdebug
function in/src/preview.ts
with a new implementation that accepts an HTML string parameterFixes
Chores
Changes Made
This PR modifies the
/src/preview.ts
file to add support for passing an HTML string to thedebug
function. Specifically, thedebug
function has been replaced with a new function that accepts anouterHTML
parameter. If the parameter is not provided, the function falls back to the previous behavior of usingdocument.documentElement.outerHTML
.Here is the specific change that was made: