fix(webhelpers): improve browser test fixture to append element and await custom element upgrade and Lit update completion; add generic return type; update npm packaging release config; remove pnpm onlyBuiltDependencies

This commit is contained in:
2025-12-30 11:29:44 +00:00
parent c9950d31ac
commit 2b81e8e5aa
5 changed files with 35 additions and 12 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2025-12-30 - 3.1.4 - fix(webhelpers)
improve browser test fixture to append element and await custom element upgrade and Lit update completion; add generic return type; update npm packaging release config; remove pnpm onlyBuiltDependencies
- ts_tapbundle/webhelpers.ts: make fixture generic and return T; append created element to document; await customElements.whenDefined for custom elements and await updateComplete for Lit/async components to ensure stable rendering in tests
- npmextra.json: add @git.zone/cli module metadata and release.registries/accessLevel; add @ship.zone/szci entry
- pnpm-workspace.yaml: remove onlyBuiltDependencies entries
## 2025-11-21 - 3.1.3 - fix(docs)
Update package author and expand license/legal and issue-reporting information in tapbundle docs

View File

@@ -1,9 +1,5 @@
{
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
@@ -12,6 +8,16 @@
"description": "a test utility to run tests that match test/**/*.ts",
"npmPackagename": "@git.zone/tstest",
"license": "MIT"
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@ship.zone/szci": {
"npmGlobalTools": []
}
}

View File

@@ -1,4 +0,0 @@
onlyBuiltDependencies:
- esbuild
- mongodb-memory-server
- puppeteer

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tstest',
version: '3.1.3',
version: '3.1.4',
description: 'a test utility to run tests that match test/**/*.ts'
}

View File

@@ -22,10 +22,24 @@ class WebHelpers {
// Initialize fixture function based on environment
if (smartenv.isBrowser) {
this.fixture = async (htmlString: string): Promise<HTMLElement> => {
this.fixture = async <T extends HTMLElement>(htmlString: string): Promise<T> => {
const container = document.createElement('div');
container.innerHTML = htmlString.trim();
const element = container.firstChild as HTMLElement;
const element = container.firstElementChild as T;
// Append to document so custom elements upgrade and lifecycle hooks fire
document.body.appendChild(element);
// Wait for custom element definition if it's a custom element
if (element.localName.includes('-')) {
await customElements.whenDefined(element.localName).catch(() => {});
}
// Wait for Lit/async components to finish rendering
if ((element as any).updateComplete) {
await (element as any).updateComplete;
}
return element;
};
} else {