test(cloudflare): Add integration test infrastructure #16848
+557
−43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried using
cloudflare:test
and the wrangler vitest pool but with the config it doesn't appear like there's an easy way to have more than one wrangler config. This isn't very useful if you want to add lots of different tests with different wrangler configurations!After much frustration and attempts I decided to just copy the Node integration test runner and strip out all the stuff we didn't need. This took less time than I'd already spend messing around. I debated making the test runners use shared code but quickly discounted that because of how little actually ends up being shared.
This PR:
createBasicSentryServer
from the Node integration test to@sentry-internal/test-utils
so it can be used by bothdev-packages/cloudflare-integration-tests/
with all the basic files it needsspawn('wrangler', ['dev', '--config', wranglerConfigPath, '--var', 'SENTRY_DSN:${SENTRY_DSN}']);
fetch
handler which asserts the entire envelope