UNPKG

@podium/test-utils

Version:

Misc common test utils for Podium

59 lines (58 loc) 1.7 kB
/** * @typedef {object} PodletServerOptions * @property {string} [manifest="/manifest.json"] * @property {string} [fallback="/fallback.html"] * @property {string} [content="/index.html"] * @property {string} [version="1.0.0"] * @property {string} [pathname="/"] * @property {string} [name="component"] * @property {{ js?: string; css?: string; }} [assets] * @property {Record<string, string>} [proxy] */ export class PodletServer extends EventEmitter<[never]> { static makeVersion(index?: number): string; /** * @constructor * @param {PodletServerOptions} options */ constructor({ manifest, fallback, content, version, pathname, name, assets, proxy, }?: PodletServerOptions); _server: any; _manifest: {}; _podlet: Podlet; _routeManifest: string; _routeContent: string; _routeFallback: string; _routeError: string; _headersManifest: {}; _headersContent: {}; _statusCode: number; _headersFallback: {}; _bodyManifest: string; _bodyContent: string; _bodyFallback: string; _metrics: { manifest: number; fallback: number; content: number; error: number; }; _app: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>; listen(host?: string): Promise<any>; close(): Promise<any>; } export type PodletServerOptions = { manifest?: string; fallback?: string; content?: string; version?: string; pathname?: string; name?: string; assets?: { js?: string; css?: string; }; proxy?: Record<string, string>; }; import EventEmitter from 'events'; import Podlet from '@podium/podlet'; import http from 'http';