Add CI verification build and component unit tests#48
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/IgniteUI/igniteui-astro-components/sessions/70d0247f-9562-4006-bb77-0d3830e46a64 Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
Agent-Logs-Url: https://github.com/IgniteUI/igniteui-astro-components/sessions/70d0247f-9562-4006-bb77-0d3830e46a64 Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
ChronosSF
May 22, 2026 08:59
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automated CI verification and a comprehensive Vitest-based unit-test suite to validate rendering/props behavior for the Astro component library, ensuring regressions are caught on PRs and pushes to main.
Changes:
- Added a GitHub Actions CI workflow with parallel
test(Vitest) andbuild(playground type-check + static build) jobs. - Introduced Vitest configuration for
.astrosupport, including virtual module stubs for docs-template integrations. - Added shared test fixtures plus a full set of component render/props unit tests; updated root scripts/deps to run them.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
Adds CI jobs for unit tests and a full playground check/build. |
package.json |
Adds vitest + test/test:watch scripts. |
package-lock.json |
Locks vitest and its dependency graph. |
vitest.config.ts |
Configures Vitest via Astro’s Vite config and stubs required virtual modules. |
tests/setup.ts |
Adds shared mock fixtures (platform/env) for component tests. |
tests/components/ApiLink.test.ts |
Verifies ApiLink URL generation, prefixing, and anchors. |
tests/components/ApiRef.test.ts |
Verifies ApiRef list rendering and URL segments. |
tests/components/DocsAside.test.ts |
Verifies aside variants, labels, and icon behavior. |
tests/components/DocsBreadcrumb.test.ts |
Verifies breadcrumb rendering and accessibility attributes. |
tests/components/DocsSidebar.test.ts |
Verifies sidebar rendering, active state, and filter visibility. |
tests/components/DocsSubHeader.test.ts |
Verifies subheader sections (theme toggle/selectors/sidebar toggle). |
tests/components/DocsToc.test.ts |
Verifies TOC empty guard, labels, and anchors. |
tests/components/DocsTree.test.ts |
Verifies tree variants, active state, and aria-label. |
tests/components/DocsTreeItem.test.ts |
Verifies leaf/group rendering and data/aria attributes. |
tests/components/GlobalFooter.test.ts |
Verifies footer container rendering. |
tests/components/GlobalNavBar.test.ts |
Verifies nav container rendering. |
tests/components/LicenseIndicator.test.ts |
Verifies license badge rendering/guards. |
tests/components/MobileSidebarToggle.test.ts |
Verifies toggle label + aria attributes. |
tests/components/MobileTocToggle.test.ts |
Verifies headings guard, labels, anchors, and aria-expanded. |
tests/components/PlatformBlock.test.ts |
Verifies conditional slot rendering by platform. |
tests/components/Sample.test.ts |
Verifies sample widget iframe URL derivation and props. |
tests/components/Search.test.ts |
Verifies search trigger/dialog/input markup. |
tests/components/SearchAdvanced.test.ts |
Verifies advanced search element attributes + tab serialization. |
tests/components/SidebarFilterInput.test.ts |
Verifies filter input accessibility/clear/status elements. |
tests/components/SidebarLabel.test.ts |
Verifies label rendering, child count, badges, and premium icon. |
tests/components/ThemingWidget.test.ts |
Verifies widget no-render guard when themeApiUrl is empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+11
| import { describe, it, expect } from 'vitest'; | ||
| import { experimental_AstroContainer as AstroContainer } from 'astro/container'; | ||
| import GlobalNavBar from '../../src/components/GlobalNavBar/GlobalNavBar.astro'; | ||
|
|
||
| describe('GlobalNavBar', () => { | ||
| it('renders the nav bar container element', async () => { | ||
| const container = await AstroContainer.create(); | ||
| // The component fetches remote nav HTML; it renders an empty div when offline. | ||
| const html = await container.renderToString(GlobalNavBar, { | ||
| props: { lang: 'en' }, | ||
| }); |
Comment on lines
+1
to
+11
| import { describe, it, expect } from 'vitest'; | ||
| import { experimental_AstroContainer as AstroContainer } from 'astro/container'; | ||
| import GlobalFooter from '../../src/components/GlobalFooter/GlobalFooter.astro'; | ||
|
|
||
| describe('GlobalFooter', () => { | ||
| it('renders the footer container element', async () => { | ||
| const container = await AstroContainer.create(); | ||
| // The component fetches remote footer HTML; it renders an empty div when offline. | ||
| const html = await container.renderToString(GlobalFooter, { | ||
| props: { lang: 'en' }, | ||
| }); |
Comment on lines
+3
to
+6
| /** | ||
| * Shared mock `platformContext` injected via `AstroContainer` locals | ||
| * for every component that reads `Astro.locals.platformContext`. | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a CI pipeline and a full suite of Vitest unit tests that verify props and rendering for all Astro components under
/src.Changes
CI workflow (
.github/workflows/ci.yml)Two parallel jobs on every push/PR to
main:test– installs root dependencies and runsnpm test(Vitest)build– installs root + playground dependencies, type-checks the playground (astro check), then performs a full static build (astro build) that renders every component pageTest infrastructure
vitest.config.ts– configures Vitest usinggetViteConfigfromastro/configso.astrofiles are processed correctly; includes an inline Vite plugin that stubsvirtual:docs-template/site-metaandvirtual:docs-template/nav-html(normally provided bysiteMetaIntegration)tests/setup.ts– sharedMOCK_PLATFORM/MOCK_ENVfixtures passed viaAstroContainerlocals to components that readAstro.locals.platformContextpackage.json– addedvitestdevDependency andtest/test:watchscriptsComponent tests (
tests/components/— 112 tests, 21 files)DocsAsideDocsTocDocsTreeDocsTreeItemDocsBreadcrumbDocsSidebarDocsSubHeaderApiLinkApiRefPlatformBlockSampleMobileSidebarToggleMobileTocToggleSearchSearchAdvancedLicenseIndicatorGlobalNavBarGlobalFooterSidebarFilterInputSidebarLabelThemingWidgetthemeApiUrlis empty