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

Ability to use msw for ws mocks in non-Node runtimes like Bun #2417

Open
1 task
maurice opened this issue Jan 24, 2025 · 0 comments
Open
1 task

Ability to use msw for ws mocks in non-Node runtimes like Bun #2417

maurice opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@maurice
Copy link

maurice commented Jan 24, 2025

Scope

Improves an existing behavior

Compatibility

  • This is a breaking change

Feature description

I'm trying to write a unit test with msw's ws support. However I'm running the tests in Bun with Bun's test-runner.

Unfortunately when initialising the msw server I get

# Unhandled error between tests
-------------------------------
1 | (function (entry, fetcher)
              ^
SyntaxError: Export named 'HTTPParser' not found in module 'http'.
-------------------------------

So clearly this is an area where Bun's node emulation is incomplete.

On the Bun side it was already reported here oven-sh/bun#15535 (closed as unplanned), but again (this time referencing msw) here oven-sh/bun#13072 which is open but it's not clear when/if it will be picked up.

In the meantime, I wonder if there is something that msw could do. Eg perhaps there's a standalone HTTP parser that could be used instead?

For now I might have to switch from Bun to Node test-runner just because of this 😢 unless you can suggest something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant