Repository navigation
fix(test): provide experimental config in Cloudflare session-false test - #17606
Conversation
The Cloudflare adapter's `astro:config:setup` reads `config.experimental.collectionStorage` (added in withastro#17543). The mock config in this test omitted `experimental` entirely, so the hook threw `TypeError: Cannot read properties of undefined (reading 'collectionStorage')`. A resolved `AstroConfig` always has this key populated, since the schema defaults it to `'single-file'`, so the mock was the incomplete party rather than the adapter. Set it explicitly to match a real config. This surfaced only after withastro#16871 and withastro#17543 landed together: this PR's checks last ran before withastro#17543 merged, so neither PR's CI ever exercised the combination.
|
|
One alternative, if you'd rather the adapter tolerate partial configs than fix the mock. The read is here: Making that I went with the test instead because a resolved |
Changes
Fixes the three
@astrojs/cloudflaresession-falsetests failing onmainand blocking #17558.The adapter's
astro:config:setupgained an unguarded read ofconfig.experimental.collectionStoragein #17543 (src/index.ts:289).session-false.test.tscalls that hook with a mock config that has noexperimentalkey, so it threwTypeError: Cannot read properties of undefined (reading 'collectionStorage'). This PR adds the missing key to the mock:A resolved
AstroConfigalways has it, since the schema defaults it to'single-file', so the mock was incomplete rather than the adapter.Testing
experimental.Docs
None needed, test-only change. No changeset for the same reason.