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

fix(cli): mock document.execCommand when emulating browser env #7062

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Jul 2, 2024

Description

A user reported importing the quill dependency in some plugin/schema, which (on startup) calls document.execCommand, which does not exist in our mocked environment and thus crashes.

This PR mocks the function as a no-op.

What to review

sanity schema extract works as before. Adding a document.execCommand() call in a schema file does not crash.

Testing

The browser env mocking does not have tests currently, and it throws when trying to run it in jest because of the odd worker setup they are using. I couldn't find an immediate and clean way to test this - perhaps we could take a stab at some separated tests that runs in regular node environment at some point?

Notes for release

  • Fixes an issue when trying to extract schemas/deploy GraphQL APIs when a subdependency tries to call document.execCommand at import time

@rexxars rexxars requested a review from a team as a code owner July 2, 2024 23:31
@rexxars rexxars requested review from binoy14 and removed request for a team July 2, 2024 23:31
Copy link

vercel bot commented Jul 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 11:35pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 11:35pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 11:35pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 11:35pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 11:35pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jul 2, 2024 11:35pm

Copy link
Contributor

github-actions bot commented Jul 2, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Jul 2, 2024

Component Testing Report Updated Jul 2, 2024 11:44 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 45s 2 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 17s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 5s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 3s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 20s 27 0 0

Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested both scenarios and works as expected. Thanks!

@rexxars rexxars added this pull request to the merge queue Jul 8, 2024
Merged via the queue into next with commit e54ae8a Jul 8, 2024
43 checks passed
@rexxars rexxars deleted the fix/mock-document-exec-command branch July 8, 2024 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants