import { FunctionComponent } from 'react'; import { RegisterOptions } from '../register'; export function registerComponent( TestComponent: FunctionComponent, componentName: string | undefined, options?: RegisterOptions ) { /* * This register can only happen once, unfortunately. So the TestComponent needs to * work for all tests. If ran more than once, window.customElements.define will throw * the error: "NotSupportedError: This name has already been registered in the registry." * * Also note that there is not way to "unregister" a web component, so an afterAll * cannot be used. */ (global as any).WEB_COMPONENT_NAME = componentName; const { register } = require('../register'); register(TestComponent, true, options); }