Registry / testing / stencil-awesome-test

stencil-awesome-test

JSON →
library1.0.6jsnpmunverified

Provides generic test utilities for Stencil components, currently at version 1.0.6. Designed to simplify unit testing of Stencil-built web components, with TypeScript definitions included. Key differentiator: purpose-built for Stencil's testing patterns, reducing boilerplate when using tools like Jest.

npm install stencil-awesome-test
INSTALL
IMPORT
SIG · STENCIL-AWESOME-TE
S
stencil-awesome-test
testingjavascriptv1.0.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 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'); });
Debug
Known issues
deprecatedrenderTestComponent() may be deprecated in future versions; use newTestSpecPage() instead.
fix
Replace renderTestComponent() with newTestSpecPage() from @stencil/core/testing.
affects: >=1.0.0
gotchaComponents array must include all custom elements used in the template, otherwise they won't be defined.
fix
Ensure the components array includes every component referenced in the html string.
affects: >=0.0.0
breakingBreaking change: The returned page object's root property changed from ShadowRoot to HTMLElement in v1.0.0.
fix
Access page.root (now HTMLElement) instead of page.root.shadowRoot for component root.
affects: >=1.0.0
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.
fix
Add '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.
fix
Ensure the component is properly exported and uses the @Component decorator from @stencil/core.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
@stencil/corerequiredPeer dependency required for Stencil component testing; must be >=2.
Agent activity
3 hits · last 30 days
node
2
Resources
stencil-awesome-test — npm install stencil-awesome-test · libregistry