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

Keep AsyncLocalStorage context across bun:test test cases #15668

Closed
jan-wilhelm opened this issue Dec 9, 2024 · 1 comment
Closed

Keep AsyncLocalStorage context across bun:test test cases #15668

jan-wilhelm opened this issue Dec 9, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jan-wilhelm
Copy link

What is the problem this feature would solve?

I am writing a somewhat low-level util method for my backend service that relies on AsyncLocalStorage for Dependency Injection. When I want to test services that rely on this method, I want to create the AsyncLocalStorage store from a beforeEach or beforeAll method, maybe even a global setup file. However, in each individual test case, it seems like that context is gone (the store resolves to undefined).

What is the feature you are proposing to solve the problem?

not really a new feature - the test runner should ideally work in a way where it keeps context across the entire test run lifecycle

What alternatives have you considered?

No response

@jan-wilhelm jan-wilhelm added the enhancement New feature or request label Dec 9, 2024
@jan-wilhelm
Copy link
Author

actually, it looks like this issue is not Bun's fault. Bun is behaving according to the spec - but the AsyncLocalStorage spec is unintuitive for use-cases like this. See nodejs/node#53037 for more context. Closing as out of scope for Bun

@jan-wilhelm jan-wilhelm closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant