Astro adapter testing #8524
Unanswered
friedemannsommer
asked this question in
Q&A
Replies: 1 comment 3 replies
-
There is currently no proper resource for that. Maybe it is something we should work on. At the moment I think your best bet would be to follow what the Astro adapters that are not on the core repo do: https://github.com/withastro/adapters There we have an For the reasons you mentioned, the tests use the real file system. Each test uses a fixture folder and tests what is generated in that folder. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any documentation on how to test a third party Astro adapter? I seem to be unable to find it.
The only approach that i can (currently) think of is to create full astro project fixture and use the
import { build, preview } from 'astro'
functions to start a preview server and then send requests (viafetch
or a similar HTTP client) to it.It's probably not possible to use a virtual filesystem (like "memfs" or "mock-fs") since Vite might use bindings to native code right?
In the end i'm looking for a relatively easy and maintainable test setup, which hopefully isn't flakey.
For context, the adapter i want to test targets the Node.js runtime and can therefore rely on any
node:*
and npm module. The only limiting factor is my spare time.Beta Was this translation helpful? Give feedback.
All reactions