Skip to content
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

feat(environment-jsdom): allow passing html content to jsdom environment #11950

Merged
merged 7 commits into from Oct 16, 2021

Conversation

MarvelSQ
Copy link
Contributor

@MarvelSQ MarvelSQ commented Oct 11, 2021

Summary

Allow developer to modify html content through testEnvironmenrOptions.html

Test plan

cause of some module rely on document elements

export default createBrowserHistory({
  basename: document.getElementsByTagName('base')[0].href,
});

current behavior
截屏2021-10-11 下午4 36 10

by passing a html to jsdom, i can avoid this error

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot facebook-github-bot commented Oct 11, 2021

Hi @MarvelSQ!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

Copy link
Collaborator

@SimenB SimenB left a comment

thanks! This needs tests, a changelog entry, and an update to the docs

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot facebook-github-bot commented Oct 11, 2021

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

1 similar comment
@facebook-github-bot
Copy link
Contributor

@facebook-github-bot facebook-github-bot commented Oct 11, 2021

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@MarvelSQ MarvelSQ requested a review from SimenB Oct 12, 2021
@codecov-commenter
Copy link

@codecov-commenter codecov-commenter commented Oct 12, 2021

Codecov Report

Merging #11950 (7e7e5b4) into main (3a85065) will decrease coverage by 0.00%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11950      +/-   ##
==========================================
- Coverage   68.76%   68.76%   -0.01%     
==========================================
  Files         322      322              
  Lines       16620    16623       +3     
  Branches     4795     4798       +3     
==========================================
+ Hits        11429    11430       +1     
- Misses       5159     5160       +1     
- Partials       32       33       +1     
Impacted Files Coverage Δ
packages/jest-environment-jsdom/src/index.ts 42.37% <75.00%> (-0.49%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a85065...7e7e5b4. Read the comment docs.

@MarvelSQ
Copy link
Contributor Author

@MarvelSQ MarvelSQ commented Oct 15, 2021

thanks! This needs tests, a changelog entry, and an update to the docs

  • test html option
  • add html in configuration.md
  • update CHANGELOG

SimenB
SimenB approved these changes Oct 15, 2021
Copy link
Collaborator

@SimenB SimenB left a comment

looks good! just some formatting nits 🙂

CHANGELOG.md Show resolved Hide resolved
e2e/custom-jsdom-html/package.json Outdated Show resolved Hide resolved
@MarvelSQ
Copy link
Contributor Author

@MarvelSQ MarvelSQ commented Oct 16, 2021

looks good! just some formatting nits 🙂

formatting error fixed

@SimenB SimenB merged commit 7f39f0a into facebook:main Oct 16, 2021
30 checks passed
@SimenB
Copy link
Collaborator

@SimenB SimenB commented Oct 17, 2021

https://github.com/facebook/jest/releases/tag/v27.3.0

@github-actions
Copy link

@github-actions github-actions bot commented Nov 17, 2021

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants