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(service-worker): bind fetch to globalThis #3500

Merged

Conversation

sapphi-red
Copy link
Contributor

This PR fixes #3176 correctly. It was not working with #3200.

I added a test but it's full of mocks and probably not much useful. Feel free to remove it 😅
Ideally an e2e test is needed.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@yusukebe
Copy link
Member

Hi @sapphi-red

Thanks! I'll check it later.

@yusukebe
Copy link
Member

Hi @sapphi-red Thank you for the PR.

I added a test but it's full of mocks and probably not much useful. Feel free to remove it 😅

I think it's good to use the mocks.

Ideally an e2e test is needed.

Exactly. If we decide to add it, we can put it into the runtime-tests. But we don't have to hurry.


I've left one comment. Please check it!

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.58%. Comparing base (31b4cd4) to head (f79db99).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3500   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files         155      155           
  Lines        9357     9357           
  Branches     2730     2761   +31     
=======================================
  Hits         8944     8944           
  Misses        413      413           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@yusukebe
Copy link
Member

@sapphi-red

Looks good to me! Thank you for your contribution. I'll merge this and release a new version.

@yusukebe yusukebe merged commit de7827e into honojs:main Oct 11, 2024
16 checks passed
@sapphi-red sapphi-red deleted the fix-service-worker-bind-fetch-to-self branch October 15, 2024 02:39
TinsFox pushed a commit to TinsFox/hono that referenced this pull request Oct 28, 2024
* fix(service-worker): bind fetch to `globalThis`

* chore: ignore lint error
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.

[Service Worker] "Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation"
2 participants