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

Add env section to testing guide #193

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Add env section to testing guide #193

merged 1 commit into from
Jan 8, 2024

Conversation

drwpow
Copy link
Contributor

@drwpow drwpow commented Jan 7, 2024

Suggestion

I had a little bit of trouble getting a good testing setup for Hono + Cloudflare Workers, because they use so many env vars. I read this testing guide initially, but as it gave no hints to env, I tried a bunch of different solutions (even including some complicated Vitest code replacement) before I realized this was so easy to pull off.

Open to feedback/suggestions if there’s a better way to do this (i.e. if there’s a better recommended way), but I found this a relatively simple, flexible setup for my own testing.

@yusukebe
Copy link
Member

yusukebe commented Jan 8, 2024

Hi @drwpow

This is a good suggestion.

For mocking, this approach is great. I'll merge this for it.

And, another approach, we can use Wrangler's unstable_dev, but it's not documented. The issue: #194

@yusukebe yusukebe merged commit 2be705e into honojs:main Jan 8, 2024
@drwpow drwpow deleted the patch-1 branch January 8, 2024 15:03
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.

2 participants