- ๐ง Server-side rendering of Astro components in non-Astro environments like Vitest or Node.js
- ๐งช Test-friendly API for rendering
.astro
components with props, slots, and hydration strategies - ๐ช Zero-config usageโjust import and render, no need for full Astro setup
- ๐งฉ Supports static, lazy, and client-only hydration modes
- ๐ง Typed API with JSDoc annotations for IntelliSense and DX-first workflows
- ๐ธ๏ธ Compatible with Astro v5+, leveraging the experimental AstroContainer API
- ๐ Ideal for unit and integration testing of UI components
Install the package using your favorite package manager:
npm install "@igor.dvlpr/astro-render-component"
# or
pnpm add "@igor.dvlpr/astro-render-component"
# or
yarn add "@igor.dvlpr/astro-render-component"
Bring your own testing framework, e.g. Vitest and your own DOM-like environment, e.g. Happy-Dom and start rendering your Astro components in order to test them.
// @โvitest-environment happy-dom
import { renderAstroComponent } from '@igor.dvlpr/astro-render-component'
import MyComponent from '../components/MyComponent.astro'
import { expect } from 'vitest'
const fragment = await renderAstroComponent(MyComponent, { props: { title: 'Hello' } })
expect(fragment.querySelector('h1')?.textContent).toBe('Hello')
๐ The changelog is available here: CHANGELOG.md.
Licensed under the MIT license which is available here, MIT license.
Consider buying me a coffee. โ

Thank you for supporting my efforts! ๐๐
@igor.dvlpr/astro-easynav-button
๐งญ Add an easy-to-use navigational button (jump to top/bottom) to your Astro site. ๐ผ
@igor.dvlpr/astro-post-excerpt
โญ An Astro component that renders post excerpts for your Astro blog - directly from your Markdown and MDX files. Astro v2+ collections are supported as well! ๐
๐ช Provides ways of testing whether an array of chars is present inside a given String. โ
@igor.dvlpr/magic-queryselector
๐ช A TypeScript-types patch for querySelector/querySelectorAll, make them return types you expect them to! ๐ฎ
@igor.dvlpr/vscode-folderpicker
โจ Provides a custom Folder Picker API + UI for Visual Studio Code. ๐จ
Created by Igor Dimitrijeviฤ (@igorskyflyer).