Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
renderTestComponent
✓ import { renderTestComponent } from 'stencil-awesome-test';
✗ const renderTestComponent = require('stencil-awesome-test');
Package is ESM-first; CommonJS require may work but is not recommended.
TestComponent
✓ import { TestComponent } from 'stencil-awesome-test';
✗ import TestComponent from 'stencil-awesome-test';
TestComponent is a named export, not default.
ComponentProps
✓ import type { ComponentProps } from 'stencil-awesome-test';
✗ import { ComponentProps } from 'stencil-awesome-test';
Use type import for TypeScript types to avoid runtime overhead.
Shows how to render a Stencil component with props and assert on the output using the test utility.
import { renderTestComponent } from 'stencil-awesome-test';
import { MyComponent } from './my-component';
it('renders with props', async () => {
const page = await renderTestComponent({
components: [MyComponent],
html: '<my-component first="John"></my-component>'
});
expect(page.root).toBeTruthy();
expect(page.root.textContent).toContain('John');
});
Errors
Common errors & fixes
TypeError: Cannot destructure property 'root' of 'page' as it is undefined.
waitForChanges() not called after initial render, so the component is not yet attached to DOM.
fixAdd 'await page.waitForChanges();' after the render call before accessing page properties.
Error: 'MyComponent' is not a valid constructor or is not a Stencil component.
The component class is not exported or not a Stencil component decorated with @Component.
fixEnsure the component is properly exported and uses the @Component decorator from @stencil/core.
Audit
Dependencies
@stencil/corerequiredPeer dependency required for Stencil component testing; must be >=2.